X-Git-Url: https://git.r.bdr.sh/rbdr/forum/blobdiff_plain/cac85db02ff00732cf75d473dc3411332f33d845..3260d5e90a30bbf57e3e5822aa84c23cee0411be:/src/lib/i18n.ts 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 });