feat(app): i18n-init registriert messages und syncs mit activeLocale

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jörg Lohrer 2026-04-21 13:33:19 +02:00
parent 8f513495e3
commit 22997138f9
1 changed files with 23 additions and 0 deletions

23
app/src/lib/i18n/index.ts Normal file
View File

@ -0,0 +1,23 @@
import { addMessages, init, locale, _ } from 'svelte-i18n';
import de from './messages/de.json';
import en from './messages/en.json';
import { activeLocale, SUPPORTED_LOCALES } from './activeLocale';
let initialized = false;
export function initI18n(): void {
if (initialized) return;
initialized = true;
addMessages('de', de);
addMessages('en', en);
init({
fallbackLocale: 'de',
initialLocale: 'de'
});
activeLocale.bootstrap();
activeLocale.subscribe((l) => {
locale.set(l);
});
}
export { _ as t, locale, activeLocale, SUPPORTED_LOCALES };