This commit is contained in:
2025-09-03 15:06:16 +08:00
commit 39fff8c63c
96 changed files with 13215 additions and 0 deletions

21
src/store/i18n.ts Normal file
View File

@@ -0,0 +1,21 @@
import {create} from 'zustand'
import {persist, createJSONStorage} from 'zustand/middleware'
export const LANG_KEY = 'lang'
export const useI18nStore = create<LangStore>()(
persist(
(set, get) => ({
lang: 'en_US',
changeLanguage: (lang) => set({lang}),
toggleLanguage: () => set(() => {
return {
lang: get().lang.includes('zh') ? 'en_US' : 'zh_CN'
}
})
}),
{
name: 'i18n-storage',
storage: createJSONStorage(() => localStorage)
},
),
)