-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Set only desired locales #31563
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
Comments
I think we should explore this idea. It's only a guess ... but the performance improvement should be noticeable because Symfony would track/parse fewer files and would created fewer catalog files. |
I am having the same necessity. Is there any progress on this? What would be a workaround, for the moment, in order to limit the list of available locales? @proArtex did you find any way to filter the usable locales? |
For the moment I solved with a custom LanguageType/ChoiceType that gets the whole list of locales and filters them with a list of languages enabled on the app. |
… 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
Description
There is no option to set locales that will be used in an app. FrameworkExtension is currently collect all the locales from different bundles (registerTranslatorConfiguration) and then it goes to Translator cache warmer. So I have many extra translations warmed up, but I want to use just a few. They are basically useless and take warmup time.
Example
So
translation.yaml
might containavailable_locales
directive:and registerTranslatorConfiguration() function might restrict Finder to that locales.
The text was updated successfully, but these errors were encountered: