Skip to content

feat(portal): i18n 接线 1/2 — 运营门户 + 共享基建#306

Merged
jhfnetboy merged 1 commit into
masterfrom
feat/portal-i18n-wire-operator
Jun 14, 2026
Merged

feat(portal): i18n 接线 1/2 — 运营门户 + 共享基建#306
jhfnetboy merged 1 commit into
masterfrom
feat/portal-i18n-wire-operator

Conversation

@jhfnetboy

Copy link
Copy Markdown
Member

目标

i18n 文案接线增量(1/2)。把运营门户页接入 i18next,并补齐共享基建。

改动

  • 共享基建:I18nProvider 动态同步 <html lang>(feat(portal): Track D — i18next 中英双语基建 #305 建议1);Layout 桌面+移动端加 LanguageSwitcher
  • 接线:app/operator/deploy/**(准入向导)、app/operator/manage/**(xPNTs/AOA/AOA+ 运营)全量文案 → useTranslation
  • locales:新增 operatorDeploy / operatorManage 命名空间;en/zh 各 478 key 完全一致

说明

  • 纯客户端;地址/txHash/数字示例/单位符号等技术串不接线
  • 验证:type-check 0、i18n:check 通过(478 key 一致)、lint 干净、next build 通过
  • 2/2 增量(Feature/aastar management portal #269 门户页 role/community/admin/sale)随后 stacked PR

- 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.
@jhfnetboy jhfnetboy requested a review from fanhousanbu as a code owner June 14, 2026 05:06
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@clestons clestons left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.tshumanizeError 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:

  • Step2ResourceCheck callback dep updated to [address, mode, update, t]
  • Step1ConnectSelect bullet refactor from array literals to [1,2,3,4].map(n => t(${m.ns}.bullet${n})) — locale defines bullet1bullet4 for both aoa and aoaPlus
  • Step3RegisterCommunity split-text pattern (explainerPrefix + <code> + explainerSuffix) renders correctly in both EN and ZH ✅

xpnts/page.tsxconst 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.documentElement on the client ✅
  • i18n.off("languageChanged", syncHtmlLang) references the same function reference (no listener leak) ✅
  • i18n.resolvedLanguage || i18n.language covers early-load before detection completes ✅
  • lng?.startsWith("zh") handles zh-CN / zh-TW variants ✅

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.

@jhfnetboy jhfnetboy merged commit 2065b1a into master Jun 14, 2026
11 of 14 checks passed
@jhfnetboy jhfnetboy deleted the feat/portal-i18n-wire-operator branch June 14, 2026 06:49
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants