Files
web-Iot/i18n_progress_20260812.md
2026-08-14 09:02:52 +08:00

26 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 中英文切换功能完善 — 进度记录 (2026-08-12)
## 目标
完善 `D:\code\机器人智慧服务系统` 的中英文(i18next)切换:补充 en/zh 词条,并消除页面上硬编码的中文。
## 已完成(已验证)
1. **补充 en 缺失的 3 个词条**(对比 zh=828 / en=825 后定位):
- `common.completed` → 'Completed'
- `home.underMaintenance` → 'Under Maintenance'
- `roles.abnormal` → 'Abnormal'
- 验证:en 现 828 词条,3 个 key 均存在。
2. **router/index.tsx 菜单硬编码中文 → t()**:
- `通知策略页面` → `<NoticePolicyPlaceholder/>` 用 `t('router.noticePolicy')`
- `数据与安全页面` → `<DataSafetyPlaceholder/>` 用 `t('router.dataSafety')`
- `模块开发中`(catch-all) → `<ModuleDeveloping/>` 用 `t('router.moduleDeveloping')`
- 因为 `routes` 是模块级静态对象,不能用 hook,故包装成使用 `useTranslation` 的小组件(可响应语言切换)。
## 关键发现(影响整体方案)
- **~1070 个被代码引用的 t() key 在 zh 与 en 中都不存在**(例如 `devices.tlStartCleaning`、`timelineStatusStart`、`alarmNo`、`mockDeviceSensor`、`paramLeftForwardGain` 等)。这些界面当前**直接显示原始 key 字符串**(中英文模式下都如此)。
- 中文源文本已不在代码中(替换成 t() 时未回填 locale),因此这 ~1070 个 key 的「中文」需要重新拟定。
- 页面中另有**硬编码中文**:69 个文件、约 1403 行(已统计到按文件分布)。这些中文仍在代码里,可安全提取并补到 locale。
## 待办 / 待决定
- 大量工作需明确推进方式(见对话中的问题)。
- 临时脚本待清理:tmp_compare.cjs、tmp_findcjk.cjs、tmp_analyze2.cjs、tmp_dbg.cjs、tmp_test.cjs、tmp_verify.cjs、tmp_perfile.cjs。