MCPcopy
hub / github.com/ys1231/MoveCertificate / switchLanguage

Function switchLanguage

webdev/src/main.ts:77–90  ·  view source on GitHub ↗

* 切换语言 * 保存选择到 localStorage,刷新翻译,重新渲染当前页面

(code: LangCode)

Source from the content-addressed store, hash-verified

75 * 保存选择到 localStorage,刷新翻译,重新渲染当前页面
76 */
77function 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

Callers 1

initLangDropdownFunction · 0.85

Calls 5

setLangFunction · 0.85
refreshLangFunction · 0.85
applyI18nFunction · 0.85
loadModeTabFunction · 0.85
updateButtonTextsFunction · 0.85

Tested by

no test coverage detected