This commit is contained in:
Gabriel Gordon-Hall
2025-12-07 12:08:17 +00:00
parent 52c84f0cce
commit 77d4fcbf3f
7 changed files with 23 additions and 12 deletions

View File

@@ -73,11 +73,15 @@ i18n
.use(initReactI18next)
.init({
resources,
fallbackLng: 'en',
fallbackLng: {
zh: ['zh-Hans'], // Map generic Chinese to Simplified Chinese
default: ['en'],
},
defaultNS: 'common',
debug: import.meta.env.DEV,
supportedLngs: SUPPORTED_I18N_CODES,
load: 'languageOnly', // Load 'en' instead of 'en-US' etc.
supportedLngs: [...SUPPORTED_I18N_CODES, 'zh'], // Include 'zh' for browser detection
nonExplicitSupportedLngs: true, // Accept zh -> zh-Hans mapping
load: 'currentOnly', // Load exact language code
interpolation: {
escapeValue: false, // React already escapes

View File

@@ -14,7 +14,14 @@ export const UI_TO_I18N = {
ZH_HANS: 'zh-Hans',
} as const;
const SUPPORTED_UI_LANGUAGES = ['BROWSER', 'EN', 'JA', 'ES', 'KO', 'ZH_HANS'] as const;
const SUPPORTED_UI_LANGUAGES = [
'BROWSER',
'EN',
'JA',
'ES',
'KO',
'ZH_HANS',
] as const;
export const SUPPORTED_I18N_CODES = Object.values(UI_TO_I18N);
const FALLBACK_ENDONYMS = {