Remove I18N top-level await
This commit is contained in:
parent
24a2877d82
commit
c60a2d6088
@ -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],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user