Skip to content

fix: add locale fallback for region-specific locales (e.g. en-US) - #7952

Open
awath-abdat wants to merge 1 commit into
monicahq:mainfrom
awath-abdat:fix/locale-fallback-en-us
Open

fix: add locale fallback for region-specific locales (e.g. en-US)#7952
awath-abdat wants to merge 1 commit into
monicahq:mainfrom
awath-abdat:fix/locale-fallback-en-us

Conversation

@awath-abdat

@awath-abdat awath-abdat commented Jun 23, 2026

Copy link
Copy Markdown

Summary

  • Fixes the "Add Contact" page crash when the browser locale is a region-specific variant like en-US that has no matching lang/en-US.json file
  • Extracts the locale resolution logic into a shared locale.js module used by both app.js and ssr.js
  • The resolver tries: exact locale -> swapped separator (en-US <-> en_US) -> base language (en) -> English fallback

Fixes #7910

Test plan

  • Set browser language to en-US and verify the "Add Contact" page renders correctly with all form labels
  • Verify pt-BR locale still loads correctly (existing pt_BR.json)
  • Verify standard locales (e.g. en, fr, de) continue to work
  • Run npx vite build and npx vite build --ssr to confirm both builds pass

When a browser reports a region-specific locale like en-US, the app
tries to load lang/en-US.json which does not exist, causing the page
to render without translations. The resolve function now tries the
exact locale, swapped separator (en_US), base language (en), and
falls back to English.

Fixes monicahq#7910
@CLAassistant

CLAassistant commented Jun 23, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

[Docker] "Add Contact" page crashes on en-US locale due to missing localization file

2 participants