2022-04-02 20:25:24 +02:00
|
|
|
import i18n from 'sveltekit-i18n';
|
|
|
|
import lang from './lang.json';
|
|
|
|
|
|
|
|
/** @type {import('sveltekit-i18n').Config} */
|
|
|
|
const config = {
|
|
|
|
fallbackLocale: 'en',
|
|
|
|
translations: {
|
|
|
|
en: { lang },
|
|
|
|
fr: { lang }
|
|
|
|
},
|
|
|
|
loaders: [
|
|
|
|
{
|
|
|
|
locale: 'en',
|
|
|
|
key: '',
|
2022-04-02 21:08:55 +02:00
|
|
|
loader: async () => (await import('./locales/en.json')).default
|
2022-04-02 20:25:24 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
locale: 'fr',
|
|
|
|
key: '',
|
2022-04-02 21:08:55 +02:00
|
|
|
loader: async () => (await import('./locales/fr.json')).default
|
2022-04-02 20:25:24 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
2022-04-02 21:08:55 +02:00
|
|
|
export const { t, loading, locales, locale, loadTranslations } = new i18n(config);
|
2022-04-02 20:25:24 +02:00
|
|
|
|
2022-04-02 21:08:55 +02:00
|
|
|
loading.subscribe(($loading) => $loading);
|