[6.x] Fix English CP locale showing fallback locale translations - #15000
Merged
Conversation
Skip the fallback-locale merge in JavascriptComposer::translations() when the target locale is English, since a missing English JSON-catalog key is meant to fall through to the key itself on the frontend, not inherit another language's translation. Fixes #14096
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #14096.
When
app.fallback_localeis set to a non-English locale (e.g.de) and a user selects English as their CP locale,JavascriptComposer::translations()merged the fallback locale's JSON-catalog translations (lang/{locale}.json) into the English payload. Sincelang/en.jsondoesn't exist by design (the JSON translation key IS the base English string), English had zero*.-prefixed keys to override the fallback's values with, so the fallback locale's strings (e.g. German) leaked into the English CP for sidebar items, buttons, etc. sourced from the JSON catalog.The fix skips the fallback merge entirely when the target locale is English, since a missing English JSON-catalog key is supposed to fall through to the key itself on the frontend (see
resources/js/translations/translator.js), not inherit another language's translation. Non-English locales are unaffected.This replaces #14989, which patched the symptom by adding a maintained
lang/en.jsonshadow file. That approach would need manual upkeep for every future translatable string and drift was already observed among the other locale files — this PR fixes the root cause inJavascriptComposer::translations()instead, so noen.jsonis needed at all.