Skip to content

i18n: add Simplified Chinese (zh-CN) catalog - #130

Merged
X4Applegate merged 1 commit into
X4Applegate:mainfrom
chongfenglaosiji:i18n/zh-CN
Oct 10, 2026
Merged

X4Applegate merged 1 commit into
X4Applegate:mainfrom
chongfenglaosiji:i18n/zh-CN

Conversation

@chongfenglaosiji

@chongfenglaosiji chongfenglaosiji commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What & why

Adds the Simplified Chinese (zh-CN) catalog: web/i18n/zh-CN.json, covering every key currently in en.json (63 keys) — the navigation and its section titles, the top bar and its Create menu, the user menu, the command-palette search, the list-page titles for proxy hosts / redirections / advanced routes / certificates, and the language settings themselves.

Data-only change: one new file. No Go, template or JavaScript edits, as requested in #128.

Related issue

Closes #128.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor / internal (no behavior change)
  • Build / CI / tooling

Checklist

  • go build ./... compiles and go test ./... passes
  • Commits are clean (WIP squashed) and the PR is focused on one concern
  • Code matches the existing style (no new linters required)
  • User-facing change is noted in CHANGELOG.md with a version bump
  • Docs updated where relevant (README, in-app web/templates/docs.html, and/or the wiki)
  • I agree my contribution is licensed under the project's Apache License 2.0

Notes for reviewers

Verification

go test ./internal/i18n/ ./internal/server/ -run 'Translation|Catalog|Language|Locale'

Passes, including TestEveryCatalogMatchesEnglishKeysAndPlaceholders, TestEveryTranslationKeyUsedExistsInEnglish and TestASecondLanguageActuallyRenders. The full go build ./... && go test ./... also passes.

Rendered it, not just tested it. Built the image and ran it against a real Caddy; with the language set to 简体中文 the sidebar and top bar come out in Chinese (总览 / 流量 / 观测 / 配置 / 开发者, 代理主机 / 重定向 / 高级路由 / 四层代理 / 中间件配置集, 搜索资源和操作 / 创建 …), while everything not yet on keys correctly stays English. English output is unchanged.

Catalog facts

  • 63/63 keys, none missing, none invented
  • No empty values
  • No {placeholder} differences (English has none in this batch)
  • Plain LF, UTF-8 without BOM

On CHANGELOG.md: left unticked deliberately. The v2.62.0 entry already records this — "the first translation (Simplified Chinese) is coming from the community" — and the version bump is your release decision, so updating the changelog from a translation PR seemed presumptuous. Happy to add an entry if you would rather I did.

Maintaining it: happy to own zh-CN — ping me when new keys land in en.json and I will keep the catalog current.

Thanks for turning the plumbing around so quickly, and for docs/TRANSLATING.md — the _meta.name and English-fallback behaviour made this a pure data change.

Adds web/i18n/zh-CN.json covering every key currently in en.json (63
keys): the navigation and its sections, the top bar and Create menu,
the user menu, the command-palette search, the list-page titles and
the language settings themselves.

Data-only change; no Go, template or JavaScript edits.

Checked with:
  go test ./internal/i18n/ ./internal/server/ -run 'Translation|Catalog|Language|Locale'
@chongfenglaosiji
chongfenglaosiji marked this pull request as draft October 10, 2026 04:16
@chongfenglaosiji
chongfenglaosiji marked this pull request as ready for review October 10, 2026 04:40
@X4Applegate
X4Applegate merged commit 85ef2c4 into X4Applegate:main Oct 10, 2026
@X4Applegate

Copy link
Copy Markdown
Owner

Merged and released in v2.62.1 — thank you @chongfenglaosiji! 🎉

I reviewed all 63 strings (natural, accurate wording; plain text only), ran the catalog checks and the full test suite against your branch, and looked at it rendered: the navigation, section titles, search, Create menu and page headings all show in Chinese, and the rest falls back to English as designed. Anyone can now pick 简体中文 under Profile → Language, and browsers that ask for Chinese get it automatically. You're listed as the zh-CN maintainer in docs/TRANSLATING.md.

Next I'll keep moving more of the interface onto keys, a batch per release; I'll mention you here when new keys land so zh-CN.json can catch up. If your earlier extraction of ~900 strings suggests better key names or groupings, I'm happy to use it.

@chongfenglaosiji

Copy link
Copy Markdown
Contributor Author

Thank you — that was a genuinely fast turnaround, from the first issue to a merged catalog in a few hours, and the plumbing design (en.json as source of truth with English fallback, the placeholder/unknown-key tests) made this a pure data change to contribute.

I've already built the merge commit against a real Caddy and confirmed the sidebar and top bar come out in Chinese with nothing regressed in English.

I'm on board as the zh-CN maintainer: ping me whenever new keys land in en.json and I'll keep the catalog current. Thanks again.

@X4Applegate

Copy link
Copy Markdown
Owner

Small follow-up, @chongfenglaosiji: in v2.62.2 the Default language setting now takes effect before the browser language (it used to be overridden by any English browser), so I updated the English and Chinese text of settings.default_language.help to describe that. My Chinese: "向所有尚未在个人资料中选择语言的人显示。选择“跟随各访问者的浏览器”则改用每个人浏览器的语言。立即生效。" — please correct it if it reads oddly.

@X4Applegate

Copy link
Copy Markdown
Owner

@chongfenglaosiji — the next batch is out in v2.63.0: about 250 new keys in web/i18n/en.json. Until zh-CN.json has them, those strings simply show in English; nothing breaks.

Prefix What it covers
dashboard.* the whole Dashboard page
js.dashboard.*, js.health.* texts the Dashboard's script writes (health-dot tooltips, update notice)
profile.*, profile.msg.* the whole Profile page, plus its saved/error messages
settings.section.* the Settings navigation: each section's name and description
settings.* (others) the Settings heading and save buttons, and the whole General page (incl. timezone and post-apply checks)
status.* shared status words: Online, Offline, Enabled, Disabled, …

A few notes:

  • Placeholders such as {count}, {server}, {section}, {domain}, {ms} must stay as they are. The test fails if a translation drops or renames one.
  • Fragments around code. Some sentences are split around a <code>/<strong>/link that stays in the template, e.g. settings.general.strip_headers_help + …_after around strip_response_headers. Please translate each fragment so it reads naturally on either side.
  • No HTML in any value. It is shown as literal text.

The full list of new keys is the difference between en.json and zh-CN.json. A quick way to see them:

jq -r 'keys[]' web/i18n/en.json > /tmp/en; jq -r 'keys[]' web/i18n/zh-CN.json > /tmp/zh; comm -23 /tmp/en /tmp/zh

No rush, and thank you again! The next batches are the other Settings pages, then the list pages and forms.

@chongfenglaosiji

chongfenglaosiji commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks — your Chinese reads naturally and I'm happy to keep it as-is. I went through it phrase by phrase against the new English and it's accurate:

  • 向所有尚未在个人资料中选择语言的人显示 ✓ matches Shown to everyone who has not picked a language on their own profile
  • 选择“跟随各访问者的浏览器”则改用每个人浏览器的语言 ✓ the instead is carried by 则 correctly
  • 立即生效 ✓
  • Also consistent with keys already shipped: user_menu.profile → 个人资料设置, profile.language.browser → 跟随我的浏览器语言, settings.default_language.auto → 跟随各访问者的浏览器

I compared it against how established projects word the same control — Gitea's Simplified Chinese uses 「如果您希望自动检测语言,请留空」 for the equivalent "default language" helper, and 「若要使用其他用户,请…」 for the conditional. Yours sits comfortably in that style, so no correction needed.

One small suggestion while I'm here — settings.default_language.auto, whose English you also touched:

English Follow each browser (English otherwise)
Current zh-CN 跟随各访问者的浏览器(否则用英文)
Suggested 跟随各访问者的浏览器(否则显示英文)

「否则用英文」follows the English word order a little closely; Chinese UI text for a fallback normally reads 「否则显示英文」/「否则为英文」. Minor, and only worth it if you're changing nearby strings anyway — I'll fold it into my next zh-CN batch instead of asking for a separate commit, unless you'd rather I leave it.

On the next batch: I see v2.63.0 added ~250 keys. I'll work through them in a few data-only PRs (Settings › General first, then Dashboard, then Profile), and I'll ping you here as each one lands.

chongfenglaosiji added a commit to chongfenglaosiji/caddyui that referenced this pull request Oct 10, 2026
Adds the Settings › General page to the Simplified Chinese catalog: the General
options (activity retention, auto-sync, site title, favicon, color theme, global
maintenance, fallback page, globally stripped response headers), the Timezone
block, and the Default language block.

44 new keys, all of them the ones v2.63.0 added under these prefixes.
Data-only: web/i18n/zh-CN.json is the only file touched.

Also fixes the wording of settings.default_language.auto, as agreed on X4Applegate#130:
否则用英文 → 否则显示英文. 「否则用英文」followed the English word order too
closely; Chinese UI text for a fallback reads 否则显示… / 否则为….
@chongfenglaosiji chongfenglaosiji mentioned this pull request Oct 10, 2026
5 of 6 tasks
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.

[Feature]: Localization / i18n support (happy to contribute zh-CN)

2 participants