Skip to content

[6.x] Fix English CP locale showing fallback locale translations - #15000

Merged
jasonvarga merged 1 commit into
6.xfrom
fix-javascriptcomposer-translation-fallback
Jul 13, 2026
Merged

[6.x] Fix English CP locale showing fallback locale translations#15000
jasonvarga merged 1 commit into
6.xfrom
fix-javascriptcomposer-translation-fallback

Conversation

@jasonvarga

Copy link
Copy Markdown
Member

Fixes #14096.

When app.fallback_locale is 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. Since lang/en.json doesn'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.json shadow 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 in JavascriptComposer::translations() instead, so no en.json is needed at all.

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
@jasonvarga
jasonvarga merged commit df7dbbe into 6.x Jul 13, 2026
23 checks passed
@jasonvarga
jasonvarga deleted the fix-javascriptcomposer-translation-fallback branch July 13, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing translations for English result in unexpected localization.

1 participant