diff options
| author | Adam Soltys <[email protected]> | 2023-12-01 20:04:13 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-12-01 20:04:13 -0800 |
| commit | e69768ba8e777fd0b2778aad73e17267870226ea (patch) | |
| tree | d1189bbaa39db204633523132a7d4767b952717d /src/lib/translations/index.js | |
| parent | 57b64c96e30da2f733c1043030bc83227855f6b1 (diff) | |
| download | coinos-ui-e69768ba8e777fd0b2778aad73e17267870226ea.tar.gz coinos-ui-e69768ba8e777fd0b2778aad73e17267870226ea.zip | |
prettier
Diffstat (limited to 'src/lib/translations/index.js')
| -rw-r--r-- | src/lib/translations/index.js | 111 |
1 files changed, 57 insertions, 54 deletions
diff --git a/src/lib/translations/index.js b/src/lib/translations/index.js index 5f4f1754..a07a6dbf 100644 --- a/src/lib/translations/index.js +++ b/src/lib/translations/index.js @@ -1,68 +1,71 @@ -import i18n from 'sveltekit-i18n'; -import lang from './lang.json'; +import i18n from "sveltekit-i18n"; +import lang from "./lang.json"; // setup loaders & translations from lang.json data function createLocaleLoader(localeCode) { - return { - locale: localeCode, - key: '', - loader: async () => (await import(`../../locales/${localeCode}.json`)).default - }; + return { + locale: localeCode, + key: "", + loader: async () => + (await import(`../../locales/${localeCode}.json`)).default, + }; } const availableLocales = Object.keys(lang); const translations = {}; for (let i = 0; i < availableLocales.length; i++) { - translations[availableLocales[i]] = { lang }; + translations[availableLocales[i]] = { lang }; } const loaders = availableLocales.map(createLocaleLoader); const config = { - initLocale: 'en', - fallbackLocale: 'en', - translations, - loaders: [ - { - locale: 'en', - key: '', - loader: async () => (await import('../../locales/en.json')).default - }, - { - locale: 'es', - key: '', - loader: async () => (await import('../../locales/es.json')).default - }, - { - locale: 'fr', - key: '', - loader: async () => (await import('../../locales/fr.json')).default - }, - { - locale: 'pt', - key: '', - loader: async () => (await import('../../locales/pt.json')).default - }, - { - locale: 'de', - key: '', - loader: async () => (await import('../../locales/de.json')).default - }, - { - locale: 'zh', - key: '', - loader: async () => (await import('../../locales/zh.json')).default - }, - { - locale: 'fa', - key: '', - loader: async () => (await import('../../locales/fa.json')).default - }, - { - locale: 'el', - key: '', - loader: async () => (await import('../../locales/el.json')).default - } - ] + initLocale: "en", + fallbackLocale: "en", + translations, + loaders: [ + { + locale: "en", + key: "", + loader: async () => (await import("../../locales/en.json")).default, + }, + { + locale: "es", + key: "", + loader: async () => (await import("../../locales/es.json")).default, + }, + { + locale: "fr", + key: "", + loader: async () => (await import("../../locales/fr.json")).default, + }, + { + locale: "pt", + key: "", + loader: async () => (await import("../../locales/pt.json")).default, + }, + { + locale: "de", + key: "", + loader: async () => (await import("../../locales/de.json")).default, + }, + { + locale: "zh", + key: "", + loader: async () => (await import("../../locales/zh.json")).default, + }, + { + locale: "fa", + key: "", + loader: async () => (await import("../../locales/fa.json")).default, + }, + { + locale: "el", + key: "", + loader: async () => (await import("../../locales/el.json")).default, + }, + ], }; -export const { t, loading, locales, locale, loadTranslations } = new i18n(config); +export const { t, loading, locales, locale, loadTranslations } = new i18n( + config +); |
