From c60a2d6088b0fa50cf50d6679828dd56ce90148e Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Sat, 10 May 2025 11:20:00 -0500 Subject: [PATCH] Remove I18N top-level await --- src/i18n/index.ts | 12 +++++------- src/i18n/{languages => locales}/pt-br.ts | 0 src/i18n/{languages => locales}/us-en.ts | 0 3 files changed, 5 insertions(+), 7 deletions(-) rename src/i18n/{languages => locales}/pt-br.ts (100%) rename src/i18n/{languages => locales}/us-en.ts (100%) diff --git a/src/i18n/index.ts b/src/i18n/index.ts index 739e4757..f761c341 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -1,4 +1,5 @@ -import US_EN from './languages/us-en'; +import US_EN from './locales/us-en'; +import PT_BR from './locales/pt-br'; export type I18N = typeof US_EN; @@ -6,11 +7,8 @@ export type I18NDeepPartial = { [key in keyof I18N]?: Partial; } -export const LANGUAGES: Record< - string, - (() => Promise) | undefined -> = { - 'pt-br': () => import('./languages/pt-br').then(module => module.default), +export const LANGUAGES: Record = { + 'pt-br': PT_BR, }; export const getTextForLanguage = async ( @@ -18,7 +16,7 @@ export const getTextForLanguage = async ( ): Promise => { const text = US_EN; - Object.entries(await LANGUAGES[language.toLocaleLowerCase()]?.() ?? {}) + Object.entries(await LANGUAGES[language.toLocaleLowerCase()] ?? {}) .forEach(([key, value]) => { text[key as keyof I18N] = { ...text[key as keyof I18N], diff --git a/src/i18n/languages/pt-br.ts b/src/i18n/locales/pt-br.ts similarity index 100% rename from src/i18n/languages/pt-br.ts rename to src/i18n/locales/pt-br.ts diff --git a/src/i18n/languages/us-en.ts b/src/i18n/locales/us-en.ts similarity index 100% rename from src/i18n/languages/us-en.ts rename to src/i18n/locales/us-en.ts