feat(portal): i18n 接线 1/2 — 运营门户 + 共享基建#306
Conversation
- I18nProvider: sync document.documentElement.lang to i18n.language (dynamic <html lang>, addressing #305 review suggestion 1) - Layout: LanguageSwitcher in desktop nav + mobile menu - Wire app/operator/deploy/** (wizard) and app/operator/manage/** to useTranslation - locales: +operatorDeploy, +operatorManage namespaces (478 keys, en/zh in parity) Verified: type-check 0, i18n:check pass (478 keys), lint clean, next build pass.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
clestons
left a comment
There was a problem hiding this comment.
Review: feat(portal): i18n 接线 1/2 — 运营门户 + 共享基建
Verdict: APPROVE — 2-round (pure i18n wiring, no business logic / auth / contracts). No blocking findings.
What was verified
useTxStep.ts — humanizeError now accepts t: Translate and all error strings route through locale keys. useCallback dep updated to [t]: when language switches, run is recreated so in-flight toast messages use the new language. ✅
Step components (Step1–StepComplete) — Mechanical string-to-t() replacement throughout. Checked:
-
Step2ResourceCheckcallback dep updated to[address, mode, update, t]✅ -
Step1ConnectSelectbullet refactor from array literals to[1,2,3,4].map(n => t(${m.ns}.bullet${n}))— locale definesbullet1–bullet4for bothaoaandaoaPlus✅ -
Step3RegisterCommunitysplit-text pattern (explainerPrefix+<code>+explainerSuffix) renders correctly in both EN and ZH ✅
xpnts/page.tsx — const t = xPNTsTokenActions(...) renamed to const tokenRead / const tokenWrite to avoid shadowing the translation t. Incidentally fixes a latent variable-shadow bug. ✅
I18nProvider.tsx — dynamic <html lang> — useEffect correctly:
- Only touches
document.documentElementon the client ✅ i18n.off("languageChanged", syncHtmlLang)references the same function reference (no listener leak) ✅i18n.resolvedLanguage || i18n.languagecovers early-load before detection completes ✅lng?.startsWith("zh")handleszh-CN/zh-TWvariants ✅
Locale keys — All interpolation variables ({{mode}}, {{amount}}, {{label}}, {{wallet}}, {{owner}}, {{balance}}, {{token}}) verified present in both EN and ZH. EN/ZH structures are symmetric; CI i18n:check guards future drift.
Suggestion (non-blocking)
components/Layout.tsx:1882 — Mobile nav LanguageSwitcher wrapper has a hardcoded <span>Language</span>. Fine to translate in the next incremental pass when the nav strings are collected.
目标
i18n 文案接线增量(1/2)。把运营门户页接入 i18next,并补齐共享基建。
改动
I18nProvider动态同步<html lang>(feat(portal): Track D — i18next 中英双语基建 #305 建议1);Layout桌面+移动端加LanguageSwitcherapp/operator/deploy/**(准入向导)、app/operator/manage/**(xPNTs/AOA/AOA+ 运营)全量文案 →useTranslationoperatorDeploy/operatorManage命名空间;en/zh 各 478 key 完全一致说明
i18n:check通过(478 key 一致)、lint 干净、next build 通过