Skip to content

feat(ui): i18n clean-up — remove zh/en mixed-language annotations (v1.21.1) - #87

Merged
argszero merged 1 commit into
mainfrom
feat/i18n-clean
Aug 18, 2026
Merged

argszero merged 1 commit into
mainfrom
feat/i18n-clean

Conversation

@argszero

Copy link
Copy Markdown
Owner

Summary

Host feedback (rant 2026-08-18T21:40:10, project: aitokenpool): after switching language the pages still show mixed-language strings like 「仪表盘 Dashboard」.

Root causes identified in the rant:

  1. 134 zh-pack values carried English annotation suffixes (e.g. "nav.dashboard": "仪表盘 Dashboard") — the default Chinese UI was mixed-language, and en mode also fell back to mixed zh;
  2. 55 static <span class="en"> bilingual annotations in index.html — still displayed in en mode (CSS .en had no language-hiding logic).

Changes

  • ui/js/i18n.js: stripped 86 English annotation suffixes from the zh pack (nav / view titles / dashboard stats / buttons / admin-ops stats) — values are now pure Chinese. Kept proper nouns (API / Key / Plan / tokens / CSV / OpenAI / Cursor …), keyboard shortcuts (Ctrl+C / Esc / Shift) and placeholders per the rant's allowance (「仅剩固有名词如 API/Key/Plan 等专有名词」). Also translated one leftover Chinese string in the en pack (admin.raise.sub).
  • ui/index.html: removed all 55 static <span class="en"> bilingual annotations (semantics are fully covered by the language packs via data-i18n).
  • ui/css/style.css: removed the now-unused .en rule.
  • ui/README.md: documented the single-language i18n convention under v1.21.1.

Related Issue

Host rant 2026-08-18T21:40:10.553558 (i18n 修复 — 去中英混排). No GitHub issue number.

Rant verbatim (acceptance criteria):

  • 默认中文界面不再出现「仪表盘 Dashboard」式混排(纯中文);
  • 切换 English → 全站纯英文;切换回中文 → 纯中文;
  • 无 JS 报错;分支 feat/i18n-clean,提交 PR 自 merge,UI 版本 v1.21.1

Tests

  • cargo test 全部通过(102/102)
  • cargo fmt --check 通过
  • cargo clippy --all-targets -- -D warnings 通过
  • node --check on i18n.js / app.js / api.js
  • grep 检查:index.html 无 class="en" 残留;zh 包已无「仪表盘 Dashboard」式英文注释后缀

Checklist

  • 分支命名符合约定(feat/i18n-clean)
  • Commit message 使用 Conventional Commits 格式
  • 单一职责,改动最小化

….21.1)

Host feedback (rant 2026-08-18T21:40:10): pages still show mixed
'仪表盘 Dashboard' style strings after switching language.

- zh pack: strip 86 English annotation suffixes (nav/view/dash/stats/buttons),
  values are now pure Chinese (proper nouns like API/Key/Plan/tokens and
  shortcuts Ctrl+C/Esc kept per rant allowance)
- en pack: translate leftover Chinese admin.raise.sub
- index.html: remove all 55 static <span class="en"> bilingual annotations
- style.css: remove the now-unused .en rule
- ui/README.md: document the single-language i18n convention (v1.21.1)
@argszero
argszero merged commit 6ed3c7e into main Aug 18, 2026
1 check passed
argszero added a commit that referenced this pull request Sep 11, 2026
The English pack rendered four stat-card sub-labels as raw code
identifiers where the Chinese pack has proper prose:

  ops.stats.keys.sub.on       status=on       -> enabled
  ops.stats.calls.sub         usage_records   -> usage records
  admin.emp.stats.admins.sub  role=admin      -> admin role
  admin.emp.stats.deps.sub    organization    -> organization management

These were introduced with the language packs (#86) and kept on the
English side by the later i18n clean-up (#87), which stripped the
English annotation suffixes from the zh pack but left these values as
they were. `organization` also collided visually with the value of the
adjacent Departments card ("0 departments" + "organization").

Only English values change; the zh pack is byte-identical, so no key,
placeholder or parity change is involved (775 == 775).

Co-authored-by: argszero <argszero@argszerodeMac-mini.local>
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.

1 participant