Skip to content

Commit

Permalink
fix: align en locale lang to be full specified (en-US)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmosh committed Nov 29, 2023
1 parent e06f3b5 commit 3014f47
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/ui/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<BrowserRouter basename={basePath}>
<UIConfigContext.Provider value={uiConfig}>
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/src/services/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down

0 comments on commit 3014f47

Please sign in to comment.