Skip to content

[FrameworkBundle][Translation] Move translation compiler pass #22619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 6, 2017
Merged

[FrameworkBundle][Translation] Move translation compiler pass #22619

merged 1 commit into from
Jul 6, 2017

Conversation

lepiaf
Copy link
Contributor

@lepiaf lepiaf commented May 3, 2017

Q A
Branch? 3.4
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? yes
Tests pass? yes
Fixed tickets part of #21284
License MIT
Doc PR n/a

move TranslationDumperPass, TranslationExtractorPass, TranslatorPass to Translation component.

Copy link
Member

@stof stof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conflict rules are missing to ensure it does not get installed with an older version of symfony/translation (which would not allow registering it)

UPGRADE-3.3.md Outdated
@@ -244,6 +244,18 @@ FrameworkBundle
class has been deprecated and will be removed in 4.0. Use the
`Symfony\Component\Workflow\DependencyInjection\ValidateWorkflowsPass` class instead.

* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationDumperPass`
class has been deprecated and will be removed in 4.0. Use the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will have to go in a new UPGRADE-3.4.md file actually. It is too late to include this in 3.3 as we already released the beta

use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
@trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use Symfony\Component\Translation\DependencyInjection\TranslationDumperPass instead.', TranslationDumperPass::class), E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.4

@stof stof added this to the 3.4 milestone May 3, 2017
Copy link
Member

@chalasr chalasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Translator component needs symfony/dependency-injection:~3.3 as dev requirement and a conflict for symfony/dependency-injection:<3.3. Also adding a test case for passes which miss one would be great.

{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('translation.extractor')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the "collector" service id should be configurable through a constructor argument, same for the collected tag e.g. __construct($extractorServiceId = 'translation.extractor', $extractorTag = 'translation.extractor')

{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('translator.default')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here (constructor)

@@ -9,10 +9,10 @@
* file that was distributed with this source code.
*/

namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
namespace Symfony\Component\Translation\Tests\DependencyInjection;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original test case should be kept in FrameworkBundle with @group legacy and copied to the component, not moved.

{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('translation.writer')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here (constructor)

@chalasr
Copy link
Member

chalasr commented May 3, 2017

The fixed ticket would not be fixed actually, HttpKernel passes are still missing.

@lepiaf
Copy link
Contributor Author

lepiaf commented May 3, 2017

@chalasr I'm currently working in another pr to move HttpKernel passes

* Deprecated `TranslationExtractorPass`, use
`Symfony\Component\Translation\DependencyInjection\TranslationExtractorPass` instead
* Deprecated `TranslatorPass`, use
`Symfony\Component\Translation\DependencyInjection\TranslatorPass` instead
Copy link
Member

@chalasr chalasr May 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 extra spaces before Symfony

* Deprecated `TranslationDumperPass`, use
`Symfony\Component\Translation\DependencyInjection\TranslationDumperPass` instead
* Deprecated `TranslationExtractorPass`, use
`Symfony\Component\Translation\DependencyInjection\TranslationExtractorPass` instead
Copy link
Member

@chalasr chalasr May 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 extra space before Symfony

@chalasr
Copy link
Member

chalasr commented May 3, 2017

@lepiaf thanks for working on this.

@lepiaf lepiaf changed the title [FrameworkBundle][Translation] Move translation compiler pass [WIP][FrameworkBundle][Translation] Move translation compiler pass May 5, 2017
@lepiaf
Copy link
Contributor Author

lepiaf commented May 5, 2017

I did all requested changes. I will add new test for moved class.

Copy link
Member

@chalasr chalasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~3.4 can't be used as a constraint yet, that breaks tests. I would let it as is and wait for 3.3 to be stable/ 3.4 branch to be created

@@ -21,6 +21,7 @@
},
"require-dev": {
"symfony/config": "~2.8|~3.0",
"symfony/dependency-injection": "~3.3",
Copy link
Member

@chalasr chalasr May 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to add a conflict rule in order to prevent errors when using 3.3 features (these passes use ones)

$translatorServiceId = 'translator.default',
$loaderServiceId = 'translation.loader',
$loaderTag = 'translation.loader'
) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one-line signatures are preferred

* @param string $translatorServiceId
* @param string $loaderServiceId
* @param string $loaderTag
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phpdoc should be removed (same for properties, applies on the 3 passes), it doesn't give anything that an IDE couldn't guess

@lepiaf lepiaf changed the title [WIP][FrameworkBundle][Translation] Move translation compiler pass [FrameworkBundle][Translation] Move translation compiler pass May 15, 2017
@lepiaf lepiaf changed the base branch from master to 3.4 May 22, 2017 11:02
@xabbuh
Copy link
Member

xabbuh commented May 27, 2017

@lepiaf 3.3 and 3.4 branches are a thing now. Can you rebase here?

@lepiaf
Copy link
Contributor Author

lepiaf commented May 27, 2017

tests are failing but I don't know why. Is symfony/var-dumper missing in composer for frameworkbundle ?

Copy link
Member

@chalasr chalasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build failure on deps=high is normal AFAIK. 👍

@chalasr
Copy link
Member

chalasr commented Jun 21, 2017

ping deciders

@fabpot
Copy link
Member

fabpot commented Jul 6, 2017

Thank you @lepiaf.

@fabpot fabpot merged commit 74c951f into symfony:3.4 Jul 6, 2017
fabpot added a commit that referenced this pull request Jul 6, 2017
…er pass (lepiaf)

This PR was merged into the 3.4 branch.

Discussion
----------

[FrameworkBundle][Translation] Move translation compiler pass

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | part of #21284
| License       | MIT
| Doc PR        | n/a

move TranslationDumperPass, TranslationExtractorPass, TranslatorPass to Translation component.

Commits
-------

74c951f [FrameworkBundle][Translation] Move translation compiler pass
This was referenced Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants