|
3 | 3 | import { onMount, onDestroy } from 'svelte'; |
4 | 4 | import { i18n as i18nData } from './lib/i18n.js'; |
5 | 5 | import { EventsOn, EventsOff, WindowMinimise, WindowMaximise, WindowUnmaximise, WindowIsMaximised, Quit, Environment } from '../wailsjs/runtime/runtime.js'; |
6 | | - import { ListCases, ListTemplates, GetConfig, GetVersion, GetMCPStatus, StartMCPServer, StopMCPServer, GetResourceSummary, GetBalances, GetTerraformMirrorConfig, GetNotificationEnabled, GetCurrentProject, ListProjects, SwitchProject, CreateProject, GetDisableRightClick, SetDisableRightClick, CheckForUpdates } from '../wailsjs/go/main/App.js'; |
| 6 | + import { ListCases, ListTemplates, GetConfig, GetVersion, GetMCPStatus, StartMCPServer, StopMCPServer, GetResourceSummary, GetBalances, GetTerraformMirrorConfig, GetNotificationEnabled, GetCurrentProject, ListProjects, SwitchProject, CreateProject, GetDisableRightClick, SetDisableRightClick, CheckForUpdates, GetLanguage, SetLanguage } from '../wailsjs/wailsjs/go/main/App.js'; |
7 | 7 | import Console from './components/Console/Console.svelte'; |
8 | 8 | import CloudResources from './components/Resources/CloudResources.svelte'; |
9 | 9 | import Compose from './components/Compose/Compose.svelte'; |
|
52 | 52 | let projectLoading = $state(false); |
53 | 53 |
|
54 | 54 | // i18n state |
55 | | - let lang = $state(localStorage.getItem('lang') || 'zh'); |
| 55 | + let lang = $state('zh'); |
56 | 56 | const i18n = { ...i18nData }; |
57 | 57 | let t = $derived(i18n[lang]); |
58 | 58 |
|
|
64 | 64 | function toggleLang() { |
65 | 65 | lang = lang === 'zh' ? 'en' : 'zh'; |
66 | 66 | localStorage.setItem('lang', lang); |
| 67 | + SetLanguage(lang).catch(console.error); |
67 | 68 | } |
68 | 69 |
|
69 | 70 | // Project management functions |
|
180 | 181 | isLoading = true; |
181 | 182 | error = ''; |
182 | 183 | try { |
183 | | - [cases, templates, config, terraformMirror, notificationEnabled, rightClickDisabled, appVersion] = await Promise.all([ |
| 184 | + [cases, templates, config, terraformMirror, notificationEnabled, rightClickDisabled, lang, appVersion] = await Promise.all([ |
184 | 185 | ListCases(), |
185 | 186 | ListTemplates(), |
186 | 187 | GetConfig(), |
187 | 188 | GetTerraformMirrorConfig(), |
188 | 189 | GetNotificationEnabled(), |
189 | 190 | GetDisableRightClick(), |
| 191 | + GetLanguage(), |
190 | 192 | GetVersion() |
191 | 193 | ]); |
192 | 194 | rightClickDisabledSync = rightClickDisabled; |
|
0 commit comments