diff --git a/webui/i18n.js b/webui/i18n.js index 0c3aff0..9619f1d 100644 --- a/webui/i18n.js +++ b/webui/i18n.js @@ -13,6 +13,7 @@ window.O2I18N = (() => { const STORAGE_KEY = "opencode2api.ui.lang"; const DEFAULT_LOCALE = "zh-CN"; + const FLAGS = { "zh-CN": "🇨🇳", en: "🇺🇸", vi: "🇻🇳" }; const SUPPORTED = ["zh-CN", "en", "vi"]; const LABELS = { "zh-CN": "简体中文", en: "English", vi: "Tiếng Việt" }; const DATE_LOCALES = { "zh-CN": "zh-CN", en: "en-US", vi: "vi-VN" }; @@ -1097,7 +1098,7 @@ window.O2I18N = (() => { const syncSelectors = () => { document.querySelectorAll("[data-lang-switch]").forEach((node) => { node.value = locale; - node.setAttribute("aria-label", t("语言", "lang.label")); + node.setAttribute("aria-label", LABELS[locale] || t("语言", "lang.label")); }); }; @@ -1135,7 +1136,8 @@ window.O2I18N = (() => { ...SUPPORTED.map((code) => { const option = document.createElement("option"); option.value = code; - option.textContent = LABELS[code]; + option.textContent = FLAGS[code]; + option.setAttribute('aria-label', LABELS[code]); return option; }), ); diff --git a/webui/styles.css b/webui/styles.css index 9d88ee8..1b27fbd 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -315,8 +315,14 @@ pre, max-width: 680px; } .lang-switch { - padding: 8px 10px; + width: auto; + min-width: 34px; + height: 38px; + padding: 0 4px; border: 1px solid var(--ink); + font-size: 18px; + line-height: 1; + text-align: center; background: transparent; color: var(--ink); font-weight: 700;