From 36227f99e5887b0d10dd5e7cd88b3c7798bf893c Mon Sep 17 00:00:00 2001 From: core Date: Mon, 9 Oct 2023 21:58:03 -0400 Subject: [PATCH] finish fixing i18n --- tfweb/src/lib/i18n/translations.ts | 62 ++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/tfweb/src/lib/i18n/translations.ts b/tfweb/src/lib/i18n/translations.ts index 1e70fb8..4371298 100644 --- a/tfweb/src/lib/i18n/translations.ts +++ b/tfweb/src/lib/i18n/translations.ts @@ -11,17 +11,57 @@ function buildLoader(locale: string, key: string, file: string) { const config: Config = ({ loaders: [ - buildLoader('en', '2fa', './locales/en/2fa.json'), - buildLoader('en', '2fasetup', './locales/en/2fasetup.json'), - buildLoader('en', 'common', './locales/en/common.json'), - buildLoader('en', 'hosts', './locales/en/hosts.json'), - buildLoader('en', 'itworks', './locales/en/itworks.json'), - buildLoader('en', 'login', './locales/en/login.json'), - buildLoader('en', 'ml', './locales/en/ml.json'), - buildLoader('en', 'networkcreate', './locales/en/networkcreate.json'), - buildLoader('en', 'roles', './locales/en/roles.json'), - buildLoader('en', 'signup', './locales/en/signup.json'), + { + locale: 'en', + key: '2fa', + loader: async () => (await import('./locales/en/2fa.json')).default + }, + { + locale: 'en', + key: '2fasetup', + loader: async () => (await import('./locales/en/2fasetup.json')).default + }, + { + locale: 'en', + key: 'common', + loader: async () => (await import('./locales/en/common.json')).default + }, + { + locale: 'en', + key: 'hosts', + loader: async () => (await import('./locales/en/hosts.json')).default + }, + { + locale: 'en', + key: 'itworks', + loader: async () => (await import('./locales/en/itworks.json')).default + }, + { + locale: 'en', + key: 'login', + loader: async () => (await import('./locales/en/login.json')).default + }, + { + locale: 'en', + key: 'ml', + loader: async () => (await import('./locales/en/ml.json')).default + }, + { + locale: 'en', + key: 'networkcreate', + loader: async () => (await import('./locales/en/networkcreate.json')).default + }, + { + locale: 'en', + key: 'roles', + loader: async () => (await import('./locales/en/roles.json')).default + }, + { + locale: 'en', + key: 'signup', + loader: async () => (await import('./locales/en/signup.json')).default + }, ] }) -export const { t, locale, locales, loading, loadTranslations } = new i18n(config); \ No newline at end of file +export const { t, locale, locales, loading, loadTranslations } = new i18n(config);