diff options
| author | Adam Soltys <[email protected]> | 2023-12-06 20:33:45 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-12-06 20:33:45 -0800 |
| commit | 6b3ff247e4125941a611369ed9bb74a2ffca57d8 (patch) | |
| tree | 91da939350398188834e5e002bc78011a2a8e5bf /src/lib/translations/index.js | |
| parent | bb59ac3e4e7fcbf7f8a48820eab0ee21558183fc (diff) | |
| parent | d69c34cf389639eac82d24d1f1b02f038ef42399 (diff) | |
| download | coinos-ui-6b3ff247e4125941a611369ed9bb74a2ffca57d8.tar.gz coinos-ui-6b3ff247e4125941a611369ed9bb74a2ffca57d8.zip | |
Merge branch 'master' into swapee
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 +); |
