Remove I18N top-level await

This commit is contained in:
Sam Becker 2025-05-10 11:20:00 -05:00
parent 24a2877d82
commit c60a2d6088
3 changed files with 5 additions and 7 deletions

View File

@ -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<I18N[key]>;
}
export const LANGUAGES: Record<
string,
(() => Promise<I18NDeepPartial>) | undefined
> = {
'pt-br': () => import('./languages/pt-br').then(module => module.default),
export const LANGUAGES: Record<string, I18NDeepPartial | undefined> = {
'pt-br': PT_BR,
};
export const getTextForLanguage = async (
@ -18,7 +16,7 @@ export const getTextForLanguage = async (
): Promise<I18N> => {
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],