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