Files
Developer 3d849bd468 feat(i18n): 完成全量 UI 文本国际化,替换所有硬编码中文为 AppLocalizations 调用
- core/localization: 新增约 60 个翻译键(含参数化方法),中英双语覆盖
- shared/widgets: CommonDialog 默认参数国际化
- features/home: 完成页操作步骤指引、状态栏串口连接状态、程序列表状态标签
- features/programs: 表头状态列、表单验证提示、导入/模板操作反馈、删除确认(参数化)
- features/program_detail: 步骤列表/表单标题、删除确认、速度档位显示(参数化)
- features/device: run_state_provider 错误消息改为错误码
- features/settings: 升级页、密码面板、语言面板、U盘导入面板、串口配置面板全部替换

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-12 15:09:47 +08:00

67 lines
3.5 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.
## 1. 准备阶段:扩充翻译表
- [x] 1.1 审计每个 feature 模块,整理所有需要新增的翻译键(中文 + 英文)清单
- [x] 1.2 在 `lib/core/localization/app_localizations.dart` 中新增所有缺失的翻译键 getter中英文
- [x] 1.3 将拼接式调用(如 `importSuccess + count + programsImported`)改为参数化方法(如 `importedPrograms(int count)`
- [x] 1.4 运行 `flutter analyze` 确保 `AppLocalizations` 改动无报错
## 2. core 模块替换
- [x] 2.1 替换 `lib/core/router/app_router.dart` 中的硬编码中文(路由错误页等)
- [x] 2.2 替换 `lib/core/theme/app_theme.dart` 中的硬编码中文(若有)
- [x] 2.3 验证grep 该模块剩余中文字面量为零
## 3. shared 模块替换
- [x] 3.1 替换 `lib/shared/widgets/` 下所有通用组件的中文CommonButton、CommonCard、StatusIndicator 等)
- [x] 3.2 替换 `lib/shared/utils/constants.dart` 中面向 UI 暴露的常量(仅 UI 文本,业务常量保留)
- [x] 3.3 验证grep 该模块剩余中文字面量为零
## 4. features/home 模块替换
- [x] 4.1 替换 `lib/features/home/pages/home_page.dart`
- [x] 4.2 替换 `lib/features/home/pages/complete_page.dart`
- [x] 4.3 替换 `lib/features/home/widgets/status_bar.dart`
- [x] 4.4 替换 `lib/features/home/widgets/program_list.dart`
- [x] 4.5 替换 `lib/features/home/widgets/running_control_panel.dart`
- [x] 4.6 替换 `lib/features/home/widgets/run_status_monitor.dart`
- [x] 4.7 验证grep 该模块剩余中文字面量为零
## 5. features/programs 模块替换
- [x] 5.1 替换 `lib/features/programs/pages/programs_page.dart`
- [x] 5.2 替换 `lib/features/programs/providers/programs_provider.dart`(仅 UI 反馈消息)
- [x] 5.3 替换 `lib/features/programs/services/excel_import_service.dart`错误提示通过错误码返回UI 层翻译)
- [x] 5.4 验证grep 该模块剩余中文字面量为零models 中的字段名注释除外)
## 6. features/program_detail 模块替换
- [x] 6.1 替换 `lib/features/program_detail/` 下所有 page 与 widget 中的中文
- [x] 6.2 验证grep 该模块剩余中文字面量为零
## 7. features/device 模块替换(仅 UI 层)
- [x] 7.1 替换 `lib/features/device/` 下所有 page 与 widget 中的中文
- [x] 7.2 Service 层抛出的 Exception 改为携带错误码(保留中文日志)
- [x] 7.3 UI 层调用 Service 时捕获错误码并通过 `AppLocalizations` 转为本地化消息
- [x] 7.4 验证grep `lib/features/device/` 下 UI 部分剩余中文字面量为零
## 8. features/settings 模块替换
- [x] 8.1 替换 `lib/features/settings/` 下所有 page 与 widget 中的中文
- [x] 8.2 验证grep 该模块剩余中文字面量为零
## 9. 全量回归与验证
- [x] 9.1 全量扫描:`grep -rn "[一-鿿]" lib/ --include="*.dart"` 并人工审阅每条结果,确认仅为日志/注释/数据库种子数据
- [x] 9.2 运行 `flutter analyze`,确保零报错零警告
- [x] 9.3 运行 `flutter test`,确保现有测试全部通过
- [ ] 9.4 启动应用,在中文模式下访问首页、程序管理、程序详情、运行控制、设置、完成页所有路径
- [ ] 9.5 在设置中切换为英文,重复 9.4 的全部路径检查,确认所有 UI 文本变为英文且无遗漏
- [ ] 9.6 切回中文,确认应用正常恢复
## 10. 收尾
- [x] 10.1 更新 `CLAUDE.md`「当前实现状态」段落,记录 i18n 完整覆盖已完成
- [ ] 10.2 在 commit message 中按 feature 分组列出修改