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 | 216a600224fde22ce76b367557a02094ec693886 (patch) | |
| tree | d1189bbaa39db204633523132a7d4767b952717d /src/lib/translations | |
| parent | 7d9bc1f54dfd04172e8d6d43ebc2efd6f407e833 (diff) | |
| download | coinos-ui-216a600224fde22ce76b367557a02094ec693886.tar.gz coinos-ui-216a600224fde22ce76b367557a02094ec693886.zip | |
prettier
Diffstat (limited to 'src/lib/translations')
| -rw-r--r-- | src/lib/translations/index.js | 111 | ||||
| -rw-r--r-- | src/lib/translations/lang.json | 16 |
2 files changed, 65 insertions, 62 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 +); diff --git a/src/lib/translations/lang.json b/src/lib/translations/lang.json index 0acc1de6..d18a67e3 100644 --- a/src/lib/translations/lang.json +++ b/src/lib/translations/lang.json @@ -1,10 +1,10 @@ { - "en": "English", - "fr": "Français", - "es": "Español", - "de": "Deutsch", - "pt": "Português", - "zh": "中国人", - "fa": "فارسی ", - "el": "Ελληνικά" + "en": "English", + "fr": "Français", + "es": "Español", + "de": "Deutsch", + "pt": "Português", + "zh": "中国人", + "fa": "فارسی ", + "el": "Ελληνικά" } |
