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