Starting translations work

This commit is contained in:
Gabriel Engel
2022-11-09 19:27:03 -03:00
parent 8994dde8f0
commit 733de60f7c
9 changed files with 1160 additions and 14 deletions

View File

@@ -1,11 +1,18 @@
import i18n from 'sveltekit-i18n';
import { derived, writable } from "svelte/store";
import lang from './lang.json';
export let currentLocale = writable("en");
export let debugTranslation = writable(false);
/** @type {import('sveltekit-i18n').Config} */
export const config = {
fallbackLocale: 'en',
translations: {
en: { lang },
es: { lang },
pt: { lang },
ko: { lang },
fr: { lang }
},
loaders: [
@@ -14,12 +21,27 @@ export const config = {
key: '',
loader: async () => (await import('./locales/en.json')).default
},
{
locale: 'es',
key: '',
loader: async () => (await import('./locales/es.json')).default
},
{
locale: 'pt',
key: '',
loader: async () => (await import('./locales/pt.json')).default
},
{
locale: 'fr',
key: '',
loader: async () => (await import('./locales/fr.json')).default
},
{
locale: 'ko',
key: '',
loader: async () => (await import('./locales/ko.json')).default
}
]
};
export const { t, locales, locale, loadTranslations } = new i18n(config);
export const { t, locales, locale, loadTranslations } = new i18n(config);