Repository navigation
feat: add Italian localization for the WebUI - #144
Conversation
Extend the WebUI internationalization module with Italian (it) support, including locale metadata (flag, label, date formats) and comprehensive translation strings covering the operator manual, dashboard, configuration center, diagnostics, quotas, and logs.
jasonxu114514
left a comment
There was a problem hiding this comment.
Review: Italian (it) localization
Reviewed 22d584f against 0bb23c7. Approve with nits — no regression, no key/structure defects. One real gap (browserLocale) plus stale docs; neither blocks merge.
Verified locally
Built this branch, ran the real server (go build ./cmd/opencode2api, WebUI on 127.0.0.1:18081), logged in, and walked every page and tab in Italian.
| Check | Result |
|---|---|
Key parity vs en |
476 / 476 / 476 (en/vi/it), 0 missing, 0 extra, key order identical |
| Duplicate keys | none in any locale block |
{0}/{1}/{2} placeholders |
0 value diffs and 0 order diffs vs en |
Leading/trailing whitespace, · separators |
0 diffs (" · in cooldown fino a {0}", "limite raggiunto · " preserved) |
<code> multiset |
identical to en; no stray <, >, &, so apply()'s innerHTML path is safe |
CJK left in it |
none |
node --input-type=module --check (the CI step) |
passes for all webui/js/** |
| Live UI | all 8 pages + every tab render Italian; no clipping/overflow at 1440 px or 390 px |
t() / apply() |
all 476 keys resolve; re-render matches the dictionary byte-for-byte |
| Date formatting | it-IT → 21 ottobre 2026 alle ore 20:34 |
| Switch round-trip | en → it → zh-CN → it restores originals, persists to localStorage, updates <html lang> |
Only 4 lines outside the new block changed (FLAGS, SUPPORTED, LABELS, DATE_LOCALES), so existing locales are untouched — confirmed in the round-trip test.
The 21 strings identical to English are justified loanwords (Password, Playground, Tier, Endpoint, Input/Output, HTTP).
CI note: the workflow run on this branch is
action_required(first-time contributor, awaiting approval), so GitHub hasn't validated it yet. I ran the workflow's own WebUI syntax step locally instead.
P2 — Italian browsers never auto-select Italian
webui/js/i18n.js:1766-1775 — SUPPORTED, LABELS, FLAGS and DATE_LOCALES all got it, but the detection chain still stops at zh/vi/en. A visitor whose browser is Italian and who has no stored preference lands on the zh-CN default:
// real server, storage cleared
navigator.language === "it-IT"
→ document.documentElement.lang === "zh-CN"
→ document.title === "opencode2api 控制台"Fix:
if (normalized.startsWith("zh")) return "zh-CN";
if (normalized.startsWith("vi")) return "vi";
if (normalized.startsWith("en")) return "en";
+ if (normalized.startsWith("it")) return "it";Root cause is documented procedure, not carelessness: README.md:419 tells contributors to register a language in SUPPORTED, LABELS and DATE_LOCALES — it omits both FLAGS (which this PR added) and browserLocale (which it missed). Worth amending that sentence in the same change, or collapsing the five parallel maps into one LOCALES registry so a new language can't be half-registered.
P3 — docs still list three languages
README.md:412, README.zh-CN.md:407, README.vi.md:402 (and the intro at README.vi.md:23) say the WebUI ships 简体中文 / English / Tiếng Việt. Add Italiano.
P3 — pre-existing Chinese leaks (not caused by this PR)
Identical under en and vi, so out of scope here, but Italian users will still see Chinese:
webui/index.html:18— skip link跳到主要内容has nodata-i18n.webui/index.html:493,495,502— api-keys create card title/caption and the名称label are unwired, even thoughapikeys.create.title|caption|nameexist in the dictionary and are now translated into Italian (dead keys).internal/admin/api_keys.go:41— legacy key names are generated server-side as已有 Key %d, so they can't be translated client-side.
Worth a follow-up issue rather than blocking this PR.
P3 — terminology consistency inside it
- Effort vs Sforzo:
config.reasoning.title= "Sforzo di ragionamento" (:1374) vsconfig.reasoning.default= "Effort predefinito" (:1377),availability.col.effort= "Effort di ragionamento verificato" (:1213),config.reasoning.auto= "…effort massimo…" (:1379),availability.desc= "Con effort impostato su auto…". Pick one term for the whole file. - "Coda chiave" for "Key tail" (:1234, :1342, :1465) — coda reads as "queue" in an ops console; "Ultimi caratteri" or "Suffisso chiave" is unambiguous. Same wording in
diagnostics.requests.caption(:1333) anddiagnostics.attempts.caption. - "Salute" for "Health" (:1229) — "Stato" or "Integrità";
config.proxy.caption's "salta il cooldown e l'eviction di salute" is hard to parse. - Left in English where
vilocalized:common.on/common.off"On"/"Off" (:1503-1504; vi uses Bật/Tắt),config.tab.logging"Logging" (vi Nhật ký),overview.proxy.col.binding"Binding" (vi Ràng buộc), andRouteat :1328, :1547, :1569 while the rest of the file says "Instradamento". - Agreement:
diagnostics.requests.caption— "La coda della chiave o il canale anonimo effettivamente usato" → usati;rotation.reason.conversionError"Parse o conversione…" → "Analisi o conversione…".
None of these is a functional defect; they're the polish that separates a good translation from a shipped one.
…, wire API-key card, polish Italian copy
…, wire API-key card, polish Italian copy
1904f1c to
fee0956
Compare
Extend the WebUI internationalization module with Italian (it) support, including locale metadata (flag, label, date formats) and comprehensive translation strings covering the operator manual, dashboard, configuration center, diagnostics, quotas, and logs.