feat: performance optimization (#22810)

This commit is contained in:
Wu Tianwei
2025-07-23 16:04:46 +08:00
committed by GitHub
parent cf07189bd2
commit a366de26c4
30 changed files with 138 additions and 83 deletions

View File

@@ -9,13 +9,15 @@ import { noop } from 'lodash-es'
type II18NContext = {
locale: Locale
i18n: Record<string, any>
setLocaleOnClient: (_lang: Locale, _reloadPage?: boolean) => void
setLocaleOnClient: (_lang: Locale, _reloadPage?: boolean) => Promise<void>
}
const I18NContext = createContext<II18NContext>({
locale: 'en-US',
i18n: {},
setLocaleOnClient: noop,
setLocaleOnClient: async (_lang: Locale, _reloadPage?: boolean) => {
noop()
},
})
export const useI18N = () => useContext(I18NContext)