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
commit b946378b38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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