fix(ui): Remove dynamic import for i18n in settings store
This commit is contained in:
parent
6e36ff41e1
commit
0216325e0f
1 changed files with 4 additions and 5 deletions
|
|
@ -3,6 +3,7 @@ import { persist, createJSONStorage } from 'zustand/middleware'
|
||||||
import { createSelectors } from '@/lib/utils'
|
import { createSelectors } from '@/lib/utils'
|
||||||
import { defaultQueryLabel } from '@/lib/constants'
|
import { defaultQueryLabel } from '@/lib/constants'
|
||||||
import { Message, QueryRequest } from '@/api/lightrag'
|
import { Message, QueryRequest } from '@/api/lightrag'
|
||||||
|
import i18n from '@/i18n'
|
||||||
|
|
||||||
type Theme = 'dark' | 'light' | 'system'
|
type Theme = 'dark' | 'light' | 'system'
|
||||||
type Language = 'en' | 'zh' | 'fr' | 'ar' | 'zh_TW'
|
type Language = 'en' | 'zh' | 'fr' | 'ar' | 'zh_TW'
|
||||||
|
|
@ -142,11 +143,9 @@ const useSettingsStoreBase = create<SettingsState>()(
|
||||||
setLanguage: (language: Language) => {
|
setLanguage: (language: Language) => {
|
||||||
set({ language })
|
set({ language })
|
||||||
// Update i18n after state is updated
|
// Update i18n after state is updated
|
||||||
import('i18next').then(({ default: i18n }) => {
|
if (i18n.language !== language) {
|
||||||
if (i18n.language !== language) {
|
i18n.changeLanguage(language)
|
||||||
i18n.changeLanguage(language)
|
}
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setGraphLayoutMaxIterations: (iterations: number) =>
|
setGraphLayoutMaxIterations: (iterations: number) =>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue