fix(ui): drop two false/stale static i18n fallbacks in index.html - #200
Merged
Merged
Conversation
`ui/index.html` carries every `data-i18n` string twice: once as the element's static text (the fallback) and once in the pack (`ui/js/i18n.js`). `applyStatic()` overwrites the element with the pack value on DOMContentLoaded, so the fallback is normally invisible — but it is still a second source of truth, and two of its entries state things that are no longer true: - `ops.hours.sub`: 「按小时用量记录 · 本地时区」. The backend buckets `today_hours` by UTC (`src/routes/ops.rs:5`, `:115`) and the pack says 「服务端 UTC 时区」. Introduced already-contradictory in 09e4121 (#157). - `settings.ep.note`: 「部署后替换为你的网关域名(原型占位说明)」 — a verbatim copy of the prototype (docs/prototype/aitokenpool-console.html:705) including the 「原型占位说明」 marker. The endpoint card became config-driven in e74f7fc (#96) and the pack was updated then; only the static fallback was left behind. Both static strings are now identical to their pack entry. Data-only (HTML text), zero behaviour change: the rendered UI already showed the pack value, so no user-visible output changes. No i18n key added or removed (786 keys before and after), no JS/CSS touched, so no cache-bust. The remaining fallback divergences are deliberate older wording (which is the fallback's purpose) and are left alone; only false/stale text is a defect.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ui/index.htmlstores everydata-i18nstring twice: as the element's static text (the fallback) and in the pack (ui/js/i18n.js).applyStatic()(ui/js/i18n.js:1745) replaces the element with the pack value onDOMContentLoaded, so the static fallback is normally not displayed — but it is still a second source of truth, and two of its entries assert things that are no longer true. This PR fixes exactly those two.Related Issue
No linked issue — found during repository recon.
Changes
ops.hours.substatic text:按小时用量记录 · 本地时区→按小时用量记录 · 服务端 UTC 时区.The backend buckets
today_hoursby UTC (src/routes/ops.rs:5「按小时用量记录…UTC 小时」,:115「小时口径 = UTC(库内 time 为 datetime('now'))」) and the pack already said 「服务端 UTC 时区」 — so the fallback asserted a false fact. Introduced already-contradictory in09e4121(feat(ui): redesign settings/admin/ops views on the landed component layer #157): the本地时区static text and the UTC pack text land in the same commit.settings.ep.notestatic text:部署后替换为你的网关域名(原型占位说明)→ the pack text端点来自服务端配置 public_url;生产部署请在 config 中设为你的网关域名.The fallback was a verbatim copy of the prototype (
docs/prototype/aitokenpool-console.html:705), its 「原型占位说明」 marker included. The endpoint card became config-driven ine74f7fc(feat: configurable gateway public_url for settings endpoints (v0.6.3) #96) and the pack was updated then; only the static fallback was left behind.Both static strings are now byte-identical to their pack entry. Data-only (HTML text), zero behaviour change — the rendered UI already showed the pack value, so no user-visible output changes.
Tests
cargo test全部通过 — 188 passed(数量不变,正说明没有行为移动)cargo fmt --check通过cargo clippy --all-targets -- -D warnings干净src/i18n_pack.rs门禁的既有不变量是「键可解析」而非「文本相等」——文本相等对其余键本来就不成立(如view.wallet.sub的「提现 / 申请加额」两种措辞都成立),因此不适合作为断言。Checklist
fix/)fix(ui):)Non-goals
login.email、share.add、view.wallet.sub等):fallback 保留旧措辞本就是它的用途,只有「假/陈旧」才是缺陷。