Skip to content

fix: add missing English check in detectLocale()#12064

Open
andybergon wants to merge 1 commit intoanomalyco:devfrom
andybergon:fix/detect-locale-missing-english
Open

fix: add missing English check in detectLocale()#12064
andybergon wants to merge 1 commit intoanomalyco:devfrom
andybergon:fix/detect-locale-missing-english

Conversation

@andybergon
Copy link

Summary

  • Add en check to detectLocale() in the web app and desktop app
  • Without this, English entries in the browser's language list are silently skipped, and the first non-English supported language is selected instead

Problem

detectLocale() iterates through navigator.languages and checks for zh, ko, de, es, fr, etc. — but not en. The return "en" default at the end only triggers if no supported language is found. If a user has [en-IE, en-US, en-GB, en, it, es], all English entries fall through and es (Spanish, the least preferred) is selected.

Fix

Add if (language.toLowerCase().startsWith("en")) return "en" as the first check in the loop, in both affected files:

  • packages/app/src/context/language.tsx (web app)
  • packages/desktop/src/i18n/index.ts (desktop app)

The enterprise package (packages/enterprise/src/entry-server.tsx and app.tsx) already checks for en explicitly and is not affected.

Fixes #12063

The detectLocale() function checks for zh, ko, de, es, fr, da, ja, pl,
ru, ar, no, pt, and th — but not en. English entries in the browser's
language list are silently skipped, causing the first non-English
supported language to be selected instead.

For example, with browser languages [en-IE, en-US, en-GB, en, it, es],
all English entries fall through and Spanish (the least preferred) is
picked.

Fixes anomalyco#12063

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@andybergon
Copy link
Author

andybergon commented Feb 4, 2026

Note: this may be a duplicate of #9998 which addresses the same root cause. However, #9998 only fixes packages/app/src/context/language.tsx (web app) — this PR also fixes packages/desktop/src/i18n/index.ts (desktop app) which has the same bug.

@highb
Copy link

highb commented Feb 13, 2026

I encountered this bug, would love to see a fix.

@andybergon
Copy link
Author

hey @rekram1-node, just bumping this. CI is green and there's some interest from others hitting this bug. also noting that #9998 fixes the same root cause but only for the web app, while this one covers the desktop path too. happy to adjust anything if needed!

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.

Web/Desktop: detectLocale() skips English, picks wrong language

2 participants