From 302e28e31326cfff01d0c458d58675bf4bc22210 Mon Sep 17 00:00:00 2001 From: James Pine Date: Mon, 20 Apr 2026 02:52:08 -0700 Subject: [PATCH] fix(i18n): ensure language switch actually re-renders the tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `nonExplicitSupportedLngs: true` was normalizing `zh-CN` → `zh` in some code paths; since we have explicit `zh-CN` resources, swap it for `load: 'currentOnly'` which keeps the code as-is. - `react: { useSuspense: false }` — react-i18next v17 defaults Suspense on, which can silently suspend components mid-switch and look like "nothing happens" to the user. - Use `i18n.language` (the raw current code) instead of `resolvedLanguage` in the selector so the dropdown always mirrors what we just set. Co-Authored-By: Claude Opus 4.7 (1M context) --- app/src/components/ServerTab/LanguageSelect.tsx | 9 +++++++-- app/src/i18n/index.ts | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/components/ServerTab/LanguageSelect.tsx b/app/src/components/ServerTab/LanguageSelect.tsx index c47410b5..8959204f 100644 --- a/app/src/components/ServerTab/LanguageSelect.tsx +++ b/app/src/components/ServerTab/LanguageSelect.tsx @@ -10,10 +10,15 @@ import { SUPPORTED_LANGUAGES } from '@/i18n'; export function LanguageSelect() { const { i18n } = useTranslation(); - const current = SUPPORTED_LANGUAGES.find((l) => l.code === i18n.resolvedLanguage)?.code ?? 'en'; + const current = SUPPORTED_LANGUAGES.find((l) => l.code === i18n.language)?.code ?? 'en'; return ( - { + void i18n.changeLanguage(value); + }} + > diff --git a/app/src/i18n/index.ts b/app/src/i18n/index.ts index 3a987bbb..0054ea62 100644 --- a/app/src/i18n/index.ts +++ b/app/src/i18n/index.ts @@ -21,8 +21,9 @@ i18n }, fallbackLng: 'en', supportedLngs: SUPPORTED_LANGUAGES.map((l) => l.code), - nonExplicitSupportedLngs: true, + load: 'currentOnly', interpolation: { escapeValue: false }, + react: { useSuspense: false }, detection: { order: ['localStorage', 'navigator'], lookupLocalStorage: 'voicebox:lang',