Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[Translation] Introduce a way to configure the enabled locales#32433
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
@javiereguiluz Can you rebase on current master? I'm wondering it we could use this new settings to automatically restrict |
I've rebased and added a test, but please tell me any other test that you think it may be necessary. Thanks! |
I tweaked a bit the behavior of this option. It now works as follows: # config/packages/translation.yamlframework:translator:# if you don't define this option or set it to null or [], all# catalogs are generated (same behavior as current versions)enabled_locales:nullenabled_locales:[]# if you define some values in this option, only those catalogs are generatedenabled_locales:['es', 'en'] |
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Thank you@javiereguiluz. |
… locales (javiereguiluz)This PR was merged into the 5.1-dev branch.Discussion----------[Translation] Introduce a way to configure the enabled locales| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#31563| License | MIT| Doc PR | -This implements the idea#31563 so we can decide if we want to add this or not. I tested it in the "Symfony Demo" app. Before: 107 catalogs created in cache/dev/translations/. After: 43 catalogs. But that's because the app is translated into lots of languages. In most cases, only 2 catalog files will be generated (vs 107 before).If this idea is approved, I'll add tests and docs. Thanks.Commits-------7658434 [Translation] Introduce a way to configure the enabled locales
…ales to build routes' default "_locale" requirement (nicolas-grekas)This PR was merged into the 5.1-dev branch.Discussion----------[FrameworkBundle] use framework.translator.enabled_locales to build routes' default "_locale" requirement| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| Deprecations? | no| Tickets | -| License | MIT| Doc PR | -No need to configure the same requirements for `_locale` in all routes any more thanks to the `framework.translator.enabled_locales` config option introduced in#32433.Commits-------5eebd37 [FrameworkBundle] use framework.translator.enabled_locales to build routes' default "_locale" requirement
This PR was merged into the 5.1 branch.Discussion----------[FrameworkBundle] Fix enabled_locales behavior| Q | A| ------------- | ---| Branch? | 5.1| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets | -| License | MIT| Doc PR | -I was experimenting with enabled_locales on my application and I noticed the cache didn't actually change. It seems the generated service definition was invalid: the file `var/cache/dev/ContainerFEQLy1x/App_KernelDevDebugContainer.php` defined `getTranslator_DefaultService` by calling `new Translator` with 7 arguments instead of 6.It seems to be due to the fact that the DI extension does not replace the right argument. With the following fix applied the behavior works as expected.However, reading the comment of Javier in#32433, it seems he tested it against Demo and it worked with the previous code. I'm not sure why,@javiereguiluz I'd be interested in knowing if I'm missing something here :) .Commits-------e2ce7f5 Fix enabled_locales behavior
This implements the idea#31563 so we can decide if we want to add this or not. I tested it in the "Symfony Demo" app. Before: 107 catalogs created in cache/dev/translations/. After: 43 catalogs. But that's because the app is translated into lots of languages. In most cases, only 2 catalog files will be generated (vs 107 before).
If this idea is approved, I'll add tests and docs. Thanks.