-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Use default_locale as default value for translator.fallbacks #32106
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
Conversation
->beforeNormalization()->ifString()->then(function ($v) { return [$v]; })->end() | ||
->prototype('scalar')->end() | ||
->defaultValue(['en']) | ||
->defaultValue([]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this a BC break?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not if default_local was set to the same value, right? Should always be the case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. For a German site I would set default_locale
to de
but keep the fallback set to en
if my team writes English messages and translations are provided later by a separate team.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an edge case that can be fixed very easily, and deserves to be explicit IMHO. The current behavior create a WTF situation where you change the default_locale, but it's not taken into account by Symfony itself without having to change another setting.
Thank you @dunglas. |
…for translator.fallbacks (dunglas) This PR was merged into the 4.4 branch. Discussion ---------- [FrameworkBundle] Use default_locale as default value for translator.fallbacks | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | n/a | License | MIT | Doc PR | n/a Simplify translator's config: Before: ```yaml default_locale: fr translator: default_path: '%kernel.project_dir%/translations' fallbacks: - fr ``` After: ```yaml default_locale: fr translator: default_path: '%kernel.project_dir%/translations' ``` Commits ------- e0ef359 [FrameworkBundle] Use default_locale as default value for translator.fallbacks
Simplify translator's config:
Before:
After: