Skip to content

feat(i18n): Simplified Chinese locale across the dashboard - #200

Closed
HartleyLau wants to merge 1 commit into
MiaAI-Lab:mainfrom
HartleyLau:pr/i18n-zh-CN
Closed

HartleyLau wants to merge 1 commit into
MiaAI-Lab:mainfrom
HartleyLau:pr/i18n-zh-CN

Conversation

@HartleyLau

Copy link
Copy Markdown

Summary

Adds a complete Simplified Chinese (zh-CN) translation of the dashboard UI via i18next, with English kept as the fallback locale.

What's included

  • i18n infrastructure (src/i18n): synchronous i18next init (no Suspense flash), language persisted per browser, a sparkdash:language event for cross-component switches, and a module-scope t export for components outside the hook lifecycle
  • Every user-facing surface translated: sidebar, overview, spark detail panels (GPU/CPU/LLM/network/storage/RoCE), Tokens, Energy (incl. monthly history), Activity (incl. severity labels, type badges, category filters), Showcase, all four benchmark pages (Decode/Prefill/Quality forms, result tables, legends, history, Tool Eval simple + advanced forms), settings dialog (all option help texts), add-model / confirm / Hermes dialogs, mobile tab bar, open-access chip
  • Tool Eval advanced form: field labels/help come from the server option spec, so the front end maps each spec field to a te.* translation key with the server string as defaultValue fallback — new server-side options degrade gracefully to English
  • scripts/i18n-translate.mjs: an optional helper that translates missing zh-CN keys through any OpenAI-compatible endpoint (developed against LM Studio + Hunyuan-MT), preserving interpolation placeholders; --dry previews

Notes

  • en.ts remains the key source of truth; missing or future keys render in English automatically
  • Proper nouns (Spark, Hermes, GSM8K, MMLU, llama-benchy, ...) are never translated
  • All interpolated strings keep their placeholders verbatim
  • 112 files changed, ~4.5k insertions; UI-only, no server behavior changes

Screenshots

Overview / Tool Eval (simple) / Tool Eval (advanced) all render fully in zh-CN with the language switch in Settings.


摘要

通过 i18next 为仪表盘全部界面添加简体中文翻译,英文作为回退语言。覆盖侧栏、总览、节点详情、Token 统计、能耗、活动、演示页、四个基准测试页(含工具评测的简单与高级表单)、设置弹窗与各类对话框;scripts/i18n-translate.mjs 为可选的机翻辅助脚本。专有名词(Spark、Hermes、GSM8K 等)保持原文。

Add an i18next-based zh-CN translation of the whole dashboard UI: sidebar,
overview, spark detail panels, Tokens/Energy/Activity pages, showcase,
all four benchmark pages (forms, tables, legends, empty states), the
tool-eval simple and advanced forms (via a te.* group mirroring the
server option spec), settings dialog with all help texts, add-model and
confirm dialogs, and the mobile tab bar.

- src/i18n: i18next setup (synchronous init, language persisted in
  localStorage, sparkdash:language event), en.ts as the key source of
  truth, zh-CN.ts, plus a module-scope t export for components outside
  the hook lifecycle
- Wire t() through every user-facing surface; interpolation
  placeholders preserved; Spark/Hermes/GSM8K/MMLU etc. kept as proper
  nouns
- scripts/i18n-translate.mjs: optional helper that translates missing
  zh-CN keys via any OpenAI-compatible endpoint (LM Studio /
  Hunyuan-MT), preserving placeholders; run with --dry to preview

English strings remain the fallback: en.ts stays the reference, and any
missing or future key renders in English automatically.
@MiaAI-Lab

Copy link
Copy Markdown
Owner

Thanks for the translation work. It cannot be merged as it stands: src/i18n/index.ts:1-2, SettingsDialog.tsx:3 and OverviewPage.tsx:3 import i18next and react-i18next, which are not in package.json or the lockfile, so a clean install does not build (tsc reports missing modules, 36 vitest files fail), and src/i18n/locales/en.ts has duplicate keys and the zh-CN literals do not type-check against it. Adding a dependency is a maintainer decision, and this is a separate, competing approach to #194 at 112 files, so the i18n direction should be settled once (loader, dependencies, split) before a foundation PR is reviewed. Smaller points: scripts/i18n-translate.mjs:24 defaults to a private LAN address and should have no default; src/shared/llmIdle.ts is touched without an i18n reason. Leaving it open waiting on the author and that decision.

(Review notes prepared with Claude Code on behalf of the maintainer.)

@MiaAI-Lab

Copy link
Copy Markdown
Owner

Maintainer note on direction: there are now two competing zh-CN approaches (#194 and this PR), and both rely on new i18n dependencies, which we have not decided to add. We would like to settle the i18n approach once (which loader and dependencies, how catalogs are split, how new strings are kept translated) and then review one small foundation PR before any locale catalogs. Until then neither can be merged; please do not spend more effort rebasing. We will post the decision on #194.

(Review notes prepared with Claude Code on behalf of the maintainer.)

@MiaAI-Lab

Copy link
Copy Markdown
Owner

Status check at 865e3e1: nothing has changed on the blockers noted on 2026-10-12. It imports i18next and react-i18next without declaring them in package.json (a clean install does not build), and the i18n approach shared with #194 (loader, dependencies, catalog split) is still a maintainer decision. It now also conflicts with main in the Overview, Settings, GpuPanel and token-totals components after today's changes. Please do not rebase until the decision is posted. Leaving it open.

(Review notes prepared with Claude Code on behalf of the maintainer.)

@MiaAI-Lab

Copy link
Copy Markdown
Owner

Maintainer decision on the i18n direction (applies to #194 and #200): one loader, i18next with react-i18next, and no ICU plugin or intl-messageformat for now (plain interpolation and plurals only). Dependency versions must be pinned and at least two weeks old, and the lockfile must be in the PR. Catalogs are split per page or namespace, with English as the source of truth and the fallback, and a check in npm test that fails when a key is missing from the source catalog. We will review one small foundation PR first (init, language switch, English catalog, one page translated), then the zh-CN catalogs in follow-ups of reviewable size; the server-side message recogniser in #194 is out of scope for the foundation. Please do not rebase these large branches; reopen as a foundation PR when ready.

(Review notes prepared with Claude Code on behalf of the maintainer.)

@MiaAI-Lab

Copy link
Copy Markdown
Owner

Status at 865e3e1: unchanged, and it now conflicts with main in 14 files (Overview, Settings, GpuPanel and the bench components). Under the 2026-10-15 decision the shape is a small foundation PR first, which is #226, then zh-CN catalogs in follow-ups of reviewable size; this 112-file branch, with its i18n imports not declared in package.json, will not be merged as it stands. Please do not rebase this one; once the foundation lands, the catalogs can be re-submitted per page on top of it. Leaving it open for your reply.

(Review notes prepared with Claude Code on behalf of the maintainer.)

@MiaAI-Lab

Copy link
Copy Markdown
Owner

Status at 865e3e1: unchanged, and it now conflicts with main in 14 files including SettingsDialog.tsx, OverviewPage.tsx, SparkCard.tsx, GpuPanel.tsx and LlmPanel.tsx. Under the 2026-10-15 decision the route is the foundation PR #226 and then zh-CN catalogs in follow-ups of reviewable size; this 112-file branch will not be merged as it stands, and rebasing it is not useful. Once #226 lands the catalogs can be re-submitted per page on top of it. Leaving it open for your reply.

(Review notes prepared with Claude Code on behalf of the maintainer.)

@MiaAI-Lab

Copy link
Copy Markdown
Owner

Status at 865e3e1: unchanged, and it conflicts with main (448944c) in 14+ files including SettingsDialog.tsx, OverviewPage.tsx, SparkCard.tsx and GpuPanel.tsx; its i18n imports are still not declared in package.json. Under the 2026-10-15 decision the route is the foundation PR #226 and then zh-CN catalogs in follow-ups of reviewable size, so this 112-file branch will not be merged as it stands. Once #226 lands, please re-submit the catalogs per page on top of it. Leaving it open for your reply.

(Review notes prepared with Claude Code on behalf of the maintainer.)

@MiaAI-Lab

Copy link
Copy Markdown
Owner

Rechecked 865e3e1 against main 00151b5; this branch has 20 merge conflicts. src/i18n/index.ts:1-2 imports i18next and react-i18next, but package.json:43-65 declares neither, so installation is not reproducible. The recorded direction remains the foundation in #226 followed by page-sized catalog changes. Leaving this open for the author's follow-up. (Review notes prepared with Claude Code on behalf of the maintainer.)

@MiaAI-Lab

Copy link
Copy Markdown
Owner

This branch has 21 conflicting files against current main. Its i18n entry imports i18next and react-i18next (src/i18n/index.ts:1), while package.json:37 does not declare them, so installation is not reproducible. The recorded direction remains the foundation in #226 followed by page-sized catalog changes, with dependency acceptance requiring a maintainer decision. Leaving this open for the author's follow-up. (Review notes prepared with Claude Code on behalf of the maintainer.)

@MiaAI-Lab

Copy link
Copy Markdown
Owner

Update: the foundation PR #226 is now on main as 0ae456c (src/i18n/, src/locales/{en,zh-CN}/settings.json, npm run i18n:check in npm test). This 112-file branch still conflicts with main and is not mergeable as it stands. Please re-submit the zh-CN catalogs per page on top of that foundation, starting with a reviewable page-sized batch; the catalog checker will flag missing or extra keys. Leaving this open for the author. (Review notes prepared with Claude Code on behalf of the maintainer.)

@HartleyLau HartleyLau closed this Oct 25, 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.

2 participants