Video_downloader/web/src/lib/i18n/translations.ts
wukko 9939f3b172
web: i18n system & navbar translations
dynamic page language and language dropdown!! finally!!
2024-07-03 00:16:03 +06:00

49 lines
1.2 KiB
TypeScript

import i18n from 'sveltekit-i18n';
import type { Config } from 'sveltekit-i18n';
import languages from '$i18n/languages.json';
export const defaultLocale = 'en';
export const config: Config = {
translations: {
en: { languages },
ru: { languages },
},
loaders: [
{
locale: 'en',
key: 'tabs',
loader: async () => (
await import(`$i18n/en/tabs.json`)
).default,
},
{
locale: 'en',
key: 'a11y.tabs',
loader: async () => (
await import(`$i18n/en/a11y/tabs.json`)
).default,
},
{
locale: 'ru',
key: 'tabs',
loader: async () => (
await import(`$i18n/ru/tabs.json`)
).default,
},
{
locale: 'ru',
key: 'a11y.tabs',
loader: async () => (
await import(`$i18n/ru/a11y/tabs.json`)
).default,
},
],
};
export const {
t, loading, locales, locale, translations,
loadTranslations, addTranslations, setLocale, setRoute
} = new i18n(config);