Skip to content

fix(ui): replace code identifiers in the English stat-card copy - #168

Merged
argszero merged 1 commit into
mainfrom
fix/en-stat-card-copy
Sep 11, 2026
Merged

argszero merged 1 commit into
mainfrom
fix/en-stat-card-copy

Conversation

@argszero

Copy link
Copy Markdown
Owner

Summary

The English language pack rendered four stat-card sub-labels as raw code identifiers, where the Chinese pack carries proper prose. In the UI this is directly visible as a database dump next to ordinary English copy.

key before (EN) after (EN) zh (unchanged, for reference)
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 组织管理

Rendered before/after (EN, ops view):
...Active keys 5 status=on Calls this month 900 usage_records Points in ...
...Active keys 5 enabled Calls this month 900 usage records Points in ...

(EN, admin members stats):
...Admins 1 role=admin Departments 0 departments organization
...Admins 1 admin role Departments 0 departments organization management

The last one had a second problem: the sub-label organization sat directly under the value of the adjacent Departments card, which itself reads 0 departments — so the two cards read as one broken sentence. organization management matches the sidebar tab label and separates cleanly.

Related Issue

None — the repository has no open issues. This was found by a runtime audit of the language packs and reported here.

Changes

  • ui/js/i18n.js — 4 English values rewritten to natural copy (zh pack byte-identical)
  • ui/index.html — cache-bust ?v=20260911-12-13 (5 references)
  • No key added/removed, no placeholder or structure change: 775 == 775, 0 only-in-zh, 0 only-in-en, 0 placeholder mismatches

Scope note: this PR intentionally changes English copy only. Two neighbouring items were deliberately not touched, to keep the change single-purpose and reviewable:

  • admin.usage.unit.yuan = yuan and the adjacent calls unit labels (romanization / bare units). Whether English should read yuan or CNY depends on how the admin models table presents currency (admin.models.col.in = Input $), which is a modelling question, not a translation slip. Worth a separate discussion.
  • admin.models.col.in/out = Input $ / Output $ — the backend stores a per-model currency, so a hardcoded $ may be wrong for the CNY rows.

Tests

  • cargo test — 148 passed, 0 failed
  • cargo fmt --check — clean
  • cargo clippy --all-targets -- -D warnings — clean
  • New/updated unit tests (if applicable) — not applicable: this is a language-pack value change, covered by the existing i18n parity gate

Verification evidence

i18n gate on the Node-evaluated real module: 775 == 775, 0 only-in-zh, 0 only-in-en, 0 placeholder mismatches.

A/B runtime harness, baseline (git archive HEAD ui) vs this branch, both built by the same generator, headless Chrome, measuring the .sub element of each stat card:

  • EN ops: ['platform service OK', 'all registered users', 'status=on', 'usage_records', ...]['...', 'enabled', 'usage records', ...]
  • EN admin: ['real users', 'balance + gift', 'role=admin', 'organization']['...', 'admin role', 'organization management']
  • Negative control: the four identifiers are asserted present in the baseline, so "gone" is not vacuous
  • Regression control (zh): the rendered Chinese stat cards are asserted identical before and after ⇒ the change provably touches only the English pack
  • No CJK leaked into EN in any measured pane

Checklist

  • Branch name follows the convention (fix/...)
  • Commit message uses Conventional Commits (fix(ui): ...)
  • Single responsibility, minimal change (2 files, +9/−9)

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).
@argszero
argszero merged commit 8cff75c into main Sep 11, 2026
1 check passed
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