Skip to content

feat: add Italian localization for the WebUI - #144

Merged
jasonxu114514 merged 3 commits into
jasonxu114514:mainfrom
croccio:feature/italian-language
Oct 22, 2026
Merged

jasonxu114514 merged 3 commits into
jasonxu114514:mainfrom
croccio:feature/italian-language

Conversation

@croccio

@croccio croccio commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

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.

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.
Copilot AI balanced review requested due to automatic review settings October 21, 2026 08:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@jasonxu114514 jasonxu114514 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 no data-i18n.
  • webui/index.html:493,495,502 — api-keys create card title/caption and the 名称 label are unwired, even though apikeys.create.title|caption|name exist 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) vs config.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) and diagnostics.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 vi localized: 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), and Route at :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.

croccio added a commit to croccio/opencode2api that referenced this pull request Oct 22, 2026
@croccio
croccio force-pushed the feature/italian-language branch from 1904f1c to fee0956 Compare October 22, 2026 11:57
@jasonxu114514
jasonxu114514 merged commit 56a789d into jasonxu114514:main Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants