diff options
| author | Kirill Tregubov <[email protected]> | 2026-03-06 06:47:39 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-06 05:47:39 -0600 |
| commit | f64bb91257c6381e6c2fbd099ca36ef726c46704 (patch) | |
| tree | 33583b1b3c2abe9a80cc2bfc9b5e9f2a49f91b39 | |
| parent | eb9eb5e3349a76489f4779aefd78cffd3a42d262 (diff) | |
| download | opencode-f64bb91257c6381e6c2fbd099ca36ef726c46704.tar.gz opencode-f64bb91257c6381e6c2fbd099ca36ef726c46704.zip | |
fix(app): add english to locale matchers (#16280)
| -rw-r--r-- | packages/app/src/context/language.tsx | 2 | ||||
| -rw-r--r-- | packages/desktop-electron/src/renderer/i18n/index.ts | 1 | ||||
| -rw-r--r-- | packages/desktop/src/i18n/index.ts | 1 |
3 files changed, 4 insertions, 0 deletions
diff --git a/packages/app/src/context/language.tsx b/packages/app/src/context/language.tsx index be1a1769b..b1edd541c 100644 --- a/packages/app/src/context/language.tsx +++ b/packages/app/src/context/language.tsx @@ -146,6 +146,7 @@ const DICT: Record<Locale, Dictionary> = { } const localeMatchers: Array<{ locale: Locale; match: (language: string) => boolean }> = [ + { locale: "en", match: (language) => language.startsWith("en") }, { locale: "zht", match: (language) => language.startsWith("zh") && language.includes("hant") }, { locale: "zh", match: (language) => language.startsWith("zh") }, { locale: "ko", match: (language) => language.startsWith("ko") }, @@ -217,6 +218,7 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont ) const locale = createMemo<Locale>(() => normalizeLocale(store.locale)) + console.log("locale", locale()) const intl = createMemo(() => INTL[locale()]) const dict = createMemo<Dictionary>(() => DICT[locale()]) diff --git a/packages/desktop-electron/src/renderer/i18n/index.ts b/packages/desktop-electron/src/renderer/i18n/index.ts index 81158ad24..be87f94f9 100644 --- a/packages/desktop-electron/src/renderer/i18n/index.ts +++ b/packages/desktop-electron/src/renderer/i18n/index.ts @@ -76,6 +76,7 @@ function detectLocale(): Locale { const languages = navigator.languages?.length ? navigator.languages : [navigator.language] for (const language of languages) { if (!language) continue + if (language.toLowerCase().startsWith("en")) return "en" if (language.toLowerCase().startsWith("zh")) { if (language.toLowerCase().includes("hant")) return "zht" return "zh" diff --git a/packages/desktop/src/i18n/index.ts b/packages/desktop/src/i18n/index.ts index 7b1ebfe69..e1c1e63d9 100644 --- a/packages/desktop/src/i18n/index.ts +++ b/packages/desktop/src/i18n/index.ts @@ -77,6 +77,7 @@ function detectLocale(): Locale { const languages = navigator.languages?.length ? navigator.languages : [navigator.language] for (const language of languages) { if (!language) continue + if (language.toLowerCase().startsWith("en")) return "en" if (language.toLowerCase().startsWith("zh")) { if (language.toLowerCase().includes("hant")) return "zht" return "zh" |
