feat(i18n): add English + Chinese localization
All checks were successful
CI / Windows build (push) Successful in 12m34s
All checks were successful
CI / Windows build (push) Successful in 12m34s
The app had zero localization ("软件多语言做了吗" — no). Add Flutter's
official gen-l10n pipeline and localize the core flow the user sees.
- pubspec: flutter_localizations + intl + generate: true
- l10n.yaml + lib/l10n/app_en.arb + app_zh.arb (37 strings)
- main.dart: localizationsDelegates + supportedLocales (follows OS locale)
- pen editor: all tool tooltips, page pill, error states localized
- home: app bar actions + empty-state buttons localized
Proven end-to-end: l10n_test pumps the same widget under Locale('en')
and Locale('zh') and asserts English vs Chinese strings resolve.
flutter analyze: 0 issues. l10n_test: 3/3 pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
116
lib/l10n/app_localizations_zh.dart
Normal file
116
lib/l10n/app_localizations_zh.dart
Normal file
@@ -0,0 +1,116 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
/// The translations for Chinese (`zh`).
|
||||
class AppLocalizationsZh extends AppLocalizations {
|
||||
AppLocalizationsZh([String locale = 'zh']) : super(locale);
|
||||
|
||||
@override
|
||||
String get appTitle => 'BadNote';
|
||||
|
||||
@override
|
||||
String get settings => '设置';
|
||||
|
||||
@override
|
||||
String get search => '搜索';
|
||||
|
||||
@override
|
||||
String get importPdf => '导入 PDF';
|
||||
|
||||
@override
|
||||
String get importPpt => '导入 PPT';
|
||||
|
||||
@override
|
||||
String get penCanvasBeta => '手写画布(测试版)';
|
||||
|
||||
@override
|
||||
String get newNote => '新建笔记';
|
||||
|
||||
@override
|
||||
String get open => '打开';
|
||||
|
||||
@override
|
||||
String get cancel => '取消';
|
||||
|
||||
@override
|
||||
String get delete => '删除';
|
||||
|
||||
@override
|
||||
String get deleteNoteTitle => '删除笔记?';
|
||||
|
||||
@override
|
||||
String get deleteNote => '删除笔记';
|
||||
|
||||
@override
|
||||
String get openInSplitView => '分屏打开';
|
||||
|
||||
@override
|
||||
String get splitViewSubtitle => 'PDF 参考 + 草稿纸';
|
||||
|
||||
@override
|
||||
String get removeDocument => '移除文档';
|
||||
|
||||
@override
|
||||
String get processingPptx => '正在处理 PPTX…';
|
||||
|
||||
@override
|
||||
String get processingPresentation => '正在处理演示文稿…';
|
||||
|
||||
@override
|
||||
String get couldNotOpenPresentation => '无法打开演示文稿。';
|
||||
|
||||
@override
|
||||
String get toolPen => '钢笔';
|
||||
|
||||
@override
|
||||
String get toolHighlighter => '荧光笔';
|
||||
|
||||
@override
|
||||
String get toolEraser => '橡皮擦';
|
||||
|
||||
@override
|
||||
String get actionUndo => '撤销';
|
||||
|
||||
@override
|
||||
String get actionRedo => '重做';
|
||||
|
||||
@override
|
||||
String get fingerDrawingOn => '手指书写:开';
|
||||
|
||||
@override
|
||||
String get fingerDrawingOff => '手指书写:关(仅手写笔)';
|
||||
|
||||
@override
|
||||
String get pages => '页面';
|
||||
|
||||
@override
|
||||
String get penSettings => '手写笔设置';
|
||||
|
||||
@override
|
||||
String get inputDiagnostic => '输入诊断(写入日志文件)';
|
||||
|
||||
@override
|
||||
String get back => '返回';
|
||||
|
||||
@override
|
||||
String get previousPage => '上一页';
|
||||
|
||||
@override
|
||||
String get nextPage => '下一页';
|
||||
|
||||
@override
|
||||
String failedToOpenPdf(String error) {
|
||||
return '打开 PDF 失败:\n$error';
|
||||
}
|
||||
|
||||
@override
|
||||
String get pdfNoPages => 'PDF 没有任何页面。';
|
||||
|
||||
@override
|
||||
String pageOfPages(int current, int total) {
|
||||
return '$current / $total';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user