Begin translation and finish i18n system

This commit is contained in:
Restray
2022-04-02 21:08:55 +02:00
parent a3241516cb
commit 269250ef3d
13 changed files with 142 additions and 70 deletions

View File

@@ -3,7 +3,6 @@ import lang from './lang.json';
/** @type {import('sveltekit-i18n').Config} */
const config = {
defaultLocale: 'en',
fallbackLocale: 'en',
translations: {
en: { lang },
@@ -13,16 +12,16 @@ const config = {
{
locale: 'en',
key: '',
loader: async () => (await import('../../static/locales/en.json')).default
loader: async () => (await import('./locales/en.json')).default
},
{
locale: 'fr',
key: '',
loader: async () => (await import('../../static/locales/fr.json')).default
loader: async () => (await import('./locales/fr.json')).default
}
]
};
export const { t, locale, locales, loading, loadTranslations } = new i18n(config);
export const { t, loading, locales, locale, loadTranslations } = new i18n(config);
loading.subscribe(($loading) => $loading && console.log('Loading translations...'));
loading.subscribe(($loading) => $loading);