mirror of
https://github.com/EasyTier/EasyTier.git
synced 2024-11-16 03:32:43 +08:00
🐞 fix: 可能使用不存在的语言
This commit is contained in:
parent
e7092bfcf6
commit
893fba4adf
|
@ -35,7 +35,14 @@ export async function loadLanguageAsync(lang: string): Promise<Locale> {
|
|||
return setI18nLanguage(lang)
|
||||
|
||||
// If the language hasn't been loaded yet
|
||||
const messages = await localesMap[lang]()
|
||||
let messages;
|
||||
|
||||
try {
|
||||
messages = await localesMap[lang]()
|
||||
} catch {
|
||||
messages = await localesMap['en']()
|
||||
}
|
||||
|
||||
i18n.global.setLocaleMessage(lang, messages.default)
|
||||
loadedLanguages.push(lang)
|
||||
return setI18nLanguage(lang)
|
||||
|
|
Loading…
Reference in New Issue
Block a user