Optional Simplified Chinese (zh-CN) localization for capd dashboard with English fallback
What problem would this feature solve, if any?
Following up on #336 — I saw that full dashboard i18n isn't planned right now because translating and maintaining every dashboard string across releases adds overhead.
For teams self-hosting capd whose operators primarily read Simplified Chinese, the standalone dashboard (capd/dashboard), login page, and shared stats view are currently English-only.
Describe the solution you'd like
I put together a concrete, zero-dependency implementation scoped strictly to capd/dashboard designed to reduce translation maintenance overhead:
- English source strings as automatic fallback: UI copy stays readable inline in Svelte components (
t("Instance settings")). Whenenis active—or when a string has nozh-CNentry—missing or changed translations fall back to the English source string. - Zero new dependencies: A ~120-line Svelte 5 rune helper (
capd/dashboard/src/lib/i18n.svelte.js) + a flatzh-CNdictionary (capd/dashboard/src/lib/locales/zh-cn.js), keepingenIntldate/number formatting onundefinedso existing browser regional formats are unchanged. - Explicit opt-in & persistence: English remains the default. Users can switch between
Englishand简体中文under Instance settings > Appearance > Language (as well as on the login and shared stats pages), persisted inlocalStorage(cap_locale) and synced across tabs. - Technical values preserved: Site keys, user-defined names, filter syntax (
country:US,type:redeem), header/env names, API payloads, and widgetdata-cap-langbehavior remain untouched.
Describe alternatives you've considered
External i18n libraries (such as Lingui or svelte-i18n) add dependencies, build plugins, or opaque message IDs across .svelte files. Keeping English inline as the fallback key avoids extra tooling and lets new copy work in English without requiring immediate locale updates.
Additional context
I have a ready PR tested against capd and demo-dashboard builds if you're open to reviewing this approach.