adds i18n

This commit is contained in:
Christian Beutel
2024-02-29 23:26:18 +01:00
parent 528b443aa7
commit 5e19a4e8bb
45 changed files with 1520 additions and 638 deletions

14
web/src/lib/i18n/index.ts Normal file
View File

@@ -0,0 +1,14 @@
import { browser } from '$app/environment'
import { currentUser } from '$lib/stores/user_store'
import { init, register } from 'svelte-i18n'
import { get } from 'svelte/store'
const defaultLocale = 'en'
register('en', () => import('./locales/en.json'))
register('de', () => import('./locales/de.json'))
init({
fallbackLocale: defaultLocale,
initialLocale: browser ? get(currentUser)?.language ?? window.navigator.language : defaultLocale,
})