From 14d1d75eff99862af138a5d1f1c48ec44629519e Mon Sep 17 00:00:00 2001 From: AkiChase <1003019131@qq.com> Date: Sat, 11 May 2024 16:53:37 +0800 Subject: [PATCH] fix(i18n): build error --- src/i18n/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/i18n/index.ts b/src/i18n/index.ts index 1b712f9..fc406d1 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -5,10 +5,8 @@ import enUS from "./en-US.json"; import zhCN from "./zh-CN.json"; const localStore = new Store("store.bin"); -const language = (await localStore.get("language")) ?? "en-US"; const i18n = createI18n({ - locale: language, allowComposition: true, messages: { "en-US": enUS, @@ -16,4 +14,8 @@ const i18n = createI18n({ }, }); +localStore.get<"en-US" | "zh-CN">("language").then((language) => { + i18n.global.locale = language ?? "en-US"; +}); + export default i18n;