File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727 detection : {
2828 order : [ 'localStorage' , 'navigator' ] ,
2929 caches : [ 'localStorage' ] ,
30- lookupLocalStorage : 'chat2api-settings ' ,
30+ lookupLocalStorage : 'i18nextLng ' ,
3131 convertDetectedLanguage : ( lng : string ) => {
3232 if ( lng . includes ( 'zh' ) ) return 'zh-CN'
3333 if ( lng . includes ( 'en' ) ) return 'en-US'
Original file line number Diff line number Diff line change @@ -67,9 +67,14 @@ export const useSettingsStore = create<SettingsState>()(
6767 }
6868 } ,
6969 language : 'en-US' ,
70- setLanguage : ( language ) => {
70+ setLanguage : async ( language ) => {
7171 set ( { language } )
72- i18n . changeLanguage ( language )
72+ await i18n . changeLanguage ( language )
73+ try {
74+ await window . electronAPI . config . update ( { language : language } )
75+ } catch ( error ) {
76+ console . error ( 'Failed to update language:' , error )
77+ }
7378 } ,
7479 autoStart : false ,
7580 setAutoStart : async ( enabled ) => {
@@ -138,6 +143,7 @@ export const useSettingsStore = create<SettingsState>()(
138143 autoStart : config . autoStart ,
139144 autoStartProxy : config . autoStartProxy ,
140145 oauthProxyMode : config . oauthProxyMode || 'system' ,
146+ language : config . language || 'en-US' ,
141147 } )
142148 } catch ( error ) {
143149 console . error ( 'Failed to fetch config:' , error )
Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ export interface AppConfig {
102102 oauthProxyMode : 'system' | 'none'
103103 sessionConfig : SessionConfig
104104 toolPromptConfig : ToolPromptConfig
105+ language : 'zh-CN' | 'en-US'
105106}
106107
107108export type LogLevel = 'debug' | 'info' | 'warn' | 'error'
You can’t perform that action at this time.
0 commit comments