fix: installed apps preview language error (#23397)

This commit is contained in:
Wu Tianwei
2025-08-05 11:01:31 +08:00
committed by GitHub
parent 0cee57acca
commit b946378b38
4 changed files with 14 additions and 11 deletions

View File

@@ -87,11 +87,11 @@ if (!i18n.isInitialized) {
}
export const changeLanguage = async (lng?: string) => {
const resolvedLng = lng ?? 'en-US'
const resource = await loadLangResources(resolvedLng)
if (!i18n.hasResourceBundle(resolvedLng, 'translation'))
i18n.addResourceBundle(resolvedLng, 'translation', resource, true, true)
await i18n.changeLanguage(resolvedLng)
if (!lng) return
const resource = await loadLangResources(lng)
if (!i18n.hasResourceBundle(lng, 'translation'))
i18n.addResourceBundle(lng, 'translation', resource, true, true)
await i18n.changeLanguage(lng)
}
export default i18n