X-Git-Url: https://git.r.bdr.sh/rbdr/forum/blobdiff_plain/cac85db02ff00732cf75d473dc3411332f33d845..3d65cb04707cf3af11885995fd1110a5971d8b00:/src/lib/i18n.ts?ds=sidebyside 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 });