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>
This commit is contained in:
Developer
2026-06-12 15:09:47 +08:00
parent 5d65744618
commit 3d849bd468
23 changed files with 688 additions and 127 deletions

View File

@@ -72,7 +72,7 @@ class _StepFormState extends State<StepForm> {
children: [
// 标题
Text(
widget.isNew ? '添加步骤' : '编辑步骤',
widget.isNew ? (l10n?.addStep ?? '添加步骤') : (l10n?.editStep ?? '编辑步骤'),
style: TextStyle(
color: AppTheme.textPrimary,
fontSize: 18,
@@ -86,12 +86,12 @@ class _StepFormState extends State<StepForm> {
controller: _nameController,
decoration: InputDecoration(
labelText: l10n?.stepName ?? '步骤名称',
hintText: '例如: 混合、吸磁、吹气',
hintText: l10n?.hintStepName ?? '例如: 混合、吸磁、吹气',
border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)),
),
validator: (value) {
if (value == null || value.trim().isEmpty) {
return '请输入步骤名称';
return l10n?.enterStepName ?? '请输入步骤名称';
}
return null;
},
@@ -180,7 +180,7 @@ class _StepFormState extends State<StepForm> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'${l10n?.speed ?? '速度'}: $_speed',
'${l10n?.speed ?? '速度'}: ${l10n?.speedLevelValue(_speed) ?? '$_speed'}',
style: TextStyle(color: AppTheme.textPrimary),
),
Slider(

View File

@@ -53,7 +53,7 @@ class _StepListState extends State<StepList> {
Icon(Icons.list, color: AppTheme.primaryColor, size: 20),
const SizedBox(width: 12),
Text(
'步骤列表',
l10n?.stepList ?? '步骤列表',
style: TextStyle(
color: AppTheme.primaryColor,
fontWeight: FontWeight.w600,
@@ -61,7 +61,7 @@ class _StepListState extends State<StepList> {
),
const Spacer(),
Text(
'${widget.steps.length}',
l10n?.stepsCountLabel(widget.steps.length) ?? '${widget.steps.length}',
style: TextStyle(
color: AppTheme.textSecondary,
fontSize: 12,
@@ -114,7 +114,7 @@ class _StepListState extends State<StepList> {
children: [
Icon(Icons.add_circle_outline, size: 48, color: AppTheme.idleColor),
const SizedBox(height: 12),
Text('暂无步骤', style: TextStyle(color: AppTheme.textSecondary)),
Text(l10n?.noSteps ?? '暂无步骤', style: TextStyle(color: AppTheme.textSecondary)),
],
),
)
@@ -149,7 +149,7 @@ class _StepListState extends State<StepList> {
children: [
// 添加按钮
CommonButton(
text: '添加',
text: l10n?.add ?? '添加',
icon: Icons.add,
type: ButtonType.primary,
onPressed: widget.onAddStep,
@@ -158,7 +158,7 @@ class _StepListState extends State<StepList> {
// 删除按钮
if (_selectedIds.isNotEmpty)
CommonButton(
text: '删除',
text: l10n?.delete ?? '删除',
icon: Icons.delete,
type: ButtonType.danger,
onPressed: () => _showDeleteConfirmDialog(context),
@@ -241,8 +241,8 @@ class _StepListState extends State<StepList> {
title: Text(l10n?.confirm ?? '确认'),
content: Text(
_selectedIds.length == 1
? '确定要删除此步骤吗?'
: '确定要删除选中的 ${_selectedIds.length} 个步骤吗?',
? l10n?.deleteStepConfirmSingle ?? '确定要删除此步骤吗?'
: l10n?.deleteStepConfirmMultiple(_selectedIds.length) ?? '确定要删除选中的 ${_selectedIds.length} 个步骤吗?',
),
actions: [
TextButton(