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:
@@ -107,7 +107,7 @@ class _ProgramDetailPageState extends ConsumerState<ProgramDetailPage> {
|
||||
if (success) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('步骤已更新'),
|
||||
content: Text(l10n?.stepUpdated ?? '步骤已更新'),
|
||||
backgroundColor: AppTheme.successColor,
|
||||
),
|
||||
);
|
||||
@@ -125,7 +125,7 @@ class _ProgramDetailPageState extends ConsumerState<ProgramDetailPage> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'请选择或添加步骤',
|
||||
l10n?.selectStepFirst ?? '请选择或添加步骤',
|
||||
style: TextStyle(
|
||||
color: AppTheme.textSecondary,
|
||||
fontSize: 16,
|
||||
@@ -164,7 +164,7 @@ class _ProgramDetailPageState extends ConsumerState<ProgramDetailPage> {
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
tooltip: l10n?.backToHome ?? '返回',
|
||||
tooltip: l10n?.back ?? '返回',
|
||||
onPressed: () => context.go('/?tab=1'),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
@@ -184,7 +184,7 @@ class _ProgramDetailPageState extends ConsumerState<ProgramDetailPage> {
|
||||
onPressed: () {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('已保存'),
|
||||
content: Text(l10n?.saved ?? '已保存'),
|
||||
backgroundColor: AppTheme.successColor,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user