]> git.r.bdr.sh - rbdr/forum/blob - src/lib/i18n.ts
Don't remember what this WIP was about
[rbdr/forum] / src / lib / i18n.ts
1 import { addMessages, getLocaleFromNavigator, init } from 'svelte-i18n';
2
3 import en from './translations/en.json';
4 import es from './translations/es.json';
5
6 addMessages('en', en);
7 addMessages('es', es);
8
9 const fallbackLocale = 'en';
10 const browserLocale: string = getLocaleFromNavigator();
11 const initialLocale = browserLocale ? browserLocale.replace(/-[A-Z]{2}$/, '') : fallbackLocale;
12
13 init({
14 fallbackLocale,
15 initialLocale
16 });