X-Git-Url: https://git.r.bdr.sh/rbdr/forum/blobdiff_plain/cac85db02ff00732cf75d473dc3411332f33d845..1b6766772750f43f6963105307ca64ad240750a2:/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 });