[PR #12064] fix: add missing English check in detectLocale() #14051

Open
opened 2026-02-16 18:18:52 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/12064

State: open
Merged: No


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

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12064 **State:** open **Merged:** No --- ## 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
yindo added the pull-request label 2026-02-16 18:18:52 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14051