* 切换语言 * 保存选择到 localStorage,刷新翻译,重新渲染当前页面
(code: LangCode)
| 75 | * 保存选择到 localStorage,刷新翻译,重新渲染当前页面 |
| 76 | */ |
| 77 | function switchLanguage(code: LangCode): void { |
| 78 | setLang(code); |
| 79 | refreshLang(); // 更新 i18n 模块内部的 currentLang |
| 80 | applyI18n(); // 刷新页面上的静态文字 |
| 81 | |
| 82 | // 重新渲染模式配置页(因为它的内容是通过 JS 动态生成的) |
| 83 | const modeTab = document.getElementById('tab-mode'); |
| 84 | if (modeTab && modeTab.classList.contains('active')) { |
| 85 | loadModeTab(); |
| 86 | } |
| 87 | |
| 88 | // 更新按钮文字 |
| 89 | updateButtonTexts(); |
| 90 | } |
| 91 | |
| 92 | // ==================== 主题切换 ==================== |
| 93 |
no test coverage detected