Skip to content

Commit

Permalink
fix: update default value to fix refresh i18n bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yzh990918 committed May 23, 2023
1 parent 42d431d commit 30ee7ab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hooks/useI18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const buildI18nContext = (locale: Accessor<TranslatePair>): I18nContext =
export function useI18n() {
let defaultLocale = providerSettingsMap.get()?.general?.locale ?? 'en'
providerSettingsMap.listen((value, changedKey) => {
const general = value[changedKey] as unknown as GeneralSettings
const general = value[changedKey ?? 'general'] as unknown as GeneralSettings
defaultLocale = general?.locale
defaultLocale && setCurrentLocale(locales[defaultLocale as string])
})
Expand Down

0 comments on commit 30ee7ab

Please sign in to comment.