diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelte index 4834290..90bfe74 100644 --- a/frontend/src/routes/+layout.svelte +++ b/frontend/src/routes/+layout.svelte @@ -14,9 +14,13 @@ register('nl', () => import('../locales/nl.json')); register('sv', () => import('../locales/sv.json')); + let locales = ['en', 'es', 'fr', 'de', 'it', 'zh', 'nl', 'sv']; + if (browser) { init({ - fallbackLocale: navigator.language.split('-')[0], + fallbackLocale: locales.includes(navigator.language.split('-')[0]) + ? navigator.language.split('-')[0] + : 'en', initialLocale: data.locale }); // get the locale cookie if it exists and set it as the initial locale if it exists