X-Git-Url: https://git.r.bdr.sh/rbdr/forum/blobdiff_plain/cac85db02ff00732cf75d473dc3411332f33d845..d2cd7f1b4c318ac8587ab3dc1dec4a44b6d592fe:/src/lib/i18n.ts?ds=inline diff --git a/src/lib/i18n.ts b/src/lib/i18n.ts index 2f6edb8..5f7eda1 100644 --- a/src/lib/i18n.ts +++ b/src/lib/i18n.ts @@ -6,7 +6,11 @@ import es from './translations/es.json'; addMessages('en', en); addMessages('es', es); +const fallbackLocale = 'en'; +const browserLocale: string = getLocaleFromNavigator(); +const initialLocale = browserLocale ? browserLocale.replace(/-[A-Z]{2}$/, '') : fallbackLocale; + init({ - fallbackLocale: 'en', - initialLocale: getLocaleFromNavigator().replace(/-[A-Z]{2}$/, '') + fallbackLocale, + initialLocale });