From 2746f5068548967b0dffe06b8076610379b8fed1 Mon Sep 17 00:00:00 2001 From: Furrium Network Date: Tue, 11 Aug 2026 10:34:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=BA=86=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/theme.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/theme.js b/js/theme.js index 48c9209..69c61c9 100644 --- a/js/theme.js +++ b/js/theme.js @@ -24,13 +24,17 @@ function updateThemeUI(theme) { const icon = document.getElementById('themeIcon'); const label = document.getElementById('themeLabel'); if (!icon) return; + + // 确保 t 函数存在,否则用默认文字 + const translate = typeof t === 'function' ? t : function(key) { return key; }; + if (theme === 'dark') { icon.innerHTML = ``; - if (label) label.textContent = '☀️ 亮色模式'; + if (label) label.textContent = translate('亮色模式'); } else { icon.innerHTML = ``; - if (label) label.textContent = '🌙 暗色模式'; + if (label) label.textContent = translate('暗色模式'); } }