diff --git a/packages/ui/src/index.tsx b/packages/ui/src/index.tsx index 94cf0193..b708f6ec 100644 --- a/packages/ui/src/index.tsx +++ b/packages/ui/src/index.tsx @@ -18,7 +18,7 @@ const uiConfig = JSON.parse( document.getElementById('__UI_CONFIG__')?.textContent || '{}' ) as UIConfig; -initI18n({ lng: uiConfig.locale?.lng || 'en', basePath }).then(() => { +initI18n({ lng: uiConfig.locale?.lng || 'en-US', basePath }).then(() => { render( diff --git a/packages/ui/src/services/i18n.ts b/packages/ui/src/services/i18n.ts index 12de3d2a..03ba414a 100644 --- a/packages/ui/src/services/i18n.ts +++ b/packages/ui/src/services/i18n.ts @@ -16,13 +16,13 @@ export async function initI18n({ lng, basePath }: { lng: string; basePath: strin i18nextInstance.use(new HMRPlugin({ webpack: { client: true } })); (window as any).testI18n = (lng = 'cimode') => i18nextInstance.changeLanguage(lng); } - const locale = lng === 'en' ? 'en-US' : lng; - dateFnsLocale = await import(`date-fns/locale/${locale}/index.js`).catch((e) => console.error(e)); + dateFnsLocale = await import(`date-fns/locale/${lng}/index.js`).catch((e) => console.error(e)); return i18nextInstance.init({ lng, - fallbackLng: 'en', + fallbackLng: 'en-US', defaultNS: 'messages', ns: 'messages', + load: 'currentOnly', backend: { loadPath: `${basePath}static/locales/{{lng}}/{{ns}}.json`, queryParams: { v: process.env.APP_VERSION }, diff --git a/packages/ui/src/static/locales/en/messages.json b/packages/ui/src/static/locales/en-US/messages.json similarity index 100% rename from packages/ui/src/static/locales/en/messages.json rename to packages/ui/src/static/locales/en-US/messages.json