jianboy 1 year ago
parent
commit
f68510fac1

+ 75 - 0
lib/l10n/app_en.arb

@@ -0,0 +1,75 @@
+{
+  "appTitle": "Chinese Chess",
+
+  "menu": "Menu",
+  "openMenu": "Open Menu",
+  "flipBoard": "Flip Board",
+  "copyCode": "Copy Chess Code",
+  "parseCode": "Parse Chess Code",
+  "editCode": "Edit Chess",
+  "newGame": "New Game",
+  "loadManual": "Load Chess Manual",
+  "saveManual": "Save Chess Manual",
+  "setting": "Setting",
+  "featureNotAvailable": "Feature is not available",
+
+  "modeRobot": "Robot Mode",
+  "modeOnline": "Online Mode",
+  "modeFree": "Free Mode",
+
+  "clearAll": "Clear All",
+  "save": "Apply",
+
+  "trusteeshipToRobots": "Trusteeship to Robots",
+  "cancelRobots": "Cancel Trusteeship",
+  "thinking": "Thinking...",
+  "currentInfo": "Current",
+  "manual": "Manual",
+  "theEvent": "Event: ",
+  "theSite": "Site: ",
+  "theDate": "Date: ",
+  "theRound": "Round: ",
+  "theRed": "Red: ",
+  "theBlack": "Black: ",
+
+  "stepStart": "==Start==",
+
+  "exitNow": "Exit Now ?",
+  "dontExit": "Wait a moment",
+  "yesExit": "Yes exit",
+  "clickAgainToExit": "Click again to Exit",
+
+  "apply": "Apply",
+  "situationCode": "Chess Code",
+  "invalidCode": "Invalid Chess Code",
+  "copySuccess": "Copy Success",
+  "saveSuccess": "Save Success",
+  "selectDirectorySave": "Select a Directory to Save",
+  "saveFilename": "Filename to Save",
+  "selectPgnFile": "Select .PGN file",
+
+  "recommendMove": "Recommend Move",
+  "remark": "Remark",
+  "noRemark": "No remark",
+
+  "check": "Check",
+  "checkmate": "Checkmate",
+  "longRecheckLoose": "The same move 3 round to Lose",
+  "noEatToDraw": "60 round with no eat to Draw",
+  "trapped": "Checkmate",
+  "redLoose": "Loose",
+  "redWin": "Win",
+  "redDraw": "Draw",
+
+  "requestDraw": "Asked for a draw",
+  "agreeToDraw": "Agree to draw",
+  "requestRetract": "Asked for a Retract",
+  "agreeRetract": "Agree to retract",
+  "disagreeRetract": "Disagree to retract",
+  "cantSendCheck": "You can't send Check",
+  "plsParryCheck": "Please parry the Check",
+  "oneMoreGame": "New Game",
+  "letMeSee": "Not now",
+
+  "settingTitle": "Settings"
+}

+ 75 - 0
lib/l10n/app_zh.arb

@@ -0,0 +1,75 @@
+{
+  "appTitle": "中国象棋",
+
+  "menu": "菜单",
+  "openMenu": "打开菜单",
+  "flipBoard": "翻转棋盘",
+  "copyCode": "复制局面代码",
+  "parseCode": "粘贴局面代码",
+  "editCode": "编辑局面",
+  "newGame": "新对局",
+  "loadManual": "加载棋谱",
+  "saveManual": "保存棋谱",
+  "setting": "设置",
+  "featureNotAvailable": "功能暂未实现",
+
+  "modeRobot": "人机模式",
+  "modeOnline": "联网模式",
+  "modeFree": "自由模式",
+
+  "clearAll": "清除全部",
+  "save": "确定",
+
+  "trusteeshipToRobots": "托管给机器人",
+  "cancelRobots": "取消托管",
+  "thinking": "思考中...",
+  "currentInfo": "当前信息",
+  "manual": "棋局信息",
+  "theEvent": "赛事:",
+  "theSite": "地点:",
+  "theDate": "日期:",
+  "theRound": "轮次:",
+  "theRed": "红方:",
+  "theBlack": "黑方:",
+
+  "stepStart": "==开始==",
+
+  "exitNow": "确定退出?",
+  "dontExit": "暂不退出",
+  "yesExit": "立即退出",
+  "clickAgainToExit": "再次点击退出",
+
+  "apply": "应用",
+  "situationCode": "局面代码",
+  "invalidCode": "无效代码",
+  "copySuccess": "复制成功",
+  "saveSuccess": "保存成功",
+  "selectDirectorySave": "选择保存位置",
+  "saveFilename": "保存文件名",
+  "selectPgnFile": "选择棋谱文件",
+
+  "recommendMove": "推荐招法",
+  "remark": "注解",
+  "noRemark": "暂无注解",
+
+  "check": "将军",
+  "checkmate": "绝杀",
+  "longRecheckLoose": "不变招长将作负",
+  "noEatToDraw": "60回合无吃子判和",
+  "trapped": "困毙",
+  "redLoose": "先负",
+  "redWin": "先负",
+  "redDraw": "先和",
+
+  "requestDraw": "对方请求和棋",
+  "agreeToDraw": "同意和棋",
+  "requestRetract": "对方请求悔棋",
+  "agreeRetract": "同意悔棋",
+  "disagreeRetract": "拒绝悔棋",
+  "cantSendCheck": "不能送将",
+  "plsParryCheck": "请应将",
+  "oneMoreGame": "再来一局",
+  "letMeSee": "再看看",
+
+  "settingTitle": "系统设置"
+}

+ 499 - 0
lib/l10n/generated/app_localizations.dart

@@ -0,0 +1,499 @@
+import 'dart:async';
+
+import 'package:flutter/foundation.dart';
+import 'package:flutter/widgets.dart';
+import 'package:flutter_localizations/flutter_localizations.dart';
+import 'package:intl/intl.dart' as intl;
+
+import 'app_localizations_en.dart';
+import 'app_localizations_zh.dart';
+
+/// Callers can lookup localized strings with an instance of AppLocalizations
+/// returned by `AppLocalizations.of(context)`.
+///
+/// Applications need to include `AppLocalizations.delegate()` in their app's
+/// `localizationDelegates` list, and the locales they support in the app's
+/// `supportedLocales` list. For example:
+///
+/// ```dart
+/// import 'generated/app_localizations.dart';
+///
+/// return MaterialApp(
+///   localizationsDelegates: AppLocalizations.localizationsDelegates,
+///   supportedLocales: AppLocalizations.supportedLocales,
+///   home: MyApplicationHome(),
+/// );
+/// ```
+///
+/// ## Update pubspec.yaml
+///
+/// Please make sure to update your pubspec.yaml to include the following
+/// packages:
+///
+/// ```yaml
+/// dependencies:
+///   # Internationalization support.
+///   flutter_localizations:
+///     sdk: flutter
+///   intl: any # Use the pinned version from flutter_localizations
+///
+///   # Rest of dependencies
+/// ```
+///
+/// ## iOS Applications
+///
+/// iOS applications define key application metadata, including supported
+/// locales, in an Info.plist file that is built into the application bundle.
+/// To configure the locales supported by your app, you’ll need to edit this
+/// file.
+///
+/// First, open your project’s ios/Runner.xcworkspace Xcode workspace file.
+/// Then, in the Project Navigator, open the Info.plist file under the Runner
+/// project’s Runner folder.
+///
+/// Next, select the Information Property List item, select Add Item from the
+/// Editor menu, then select Localizations from the pop-up menu.
+///
+/// Select and expand the newly-created Localizations item then, for each
+/// locale your application supports, add a new item and select the locale
+/// you wish to add from the pop-up menu in the Value field. This list should
+/// be consistent with the languages listed in the AppLocalizations.supportedLocales
+/// property.
+abstract class AppLocalizations {
+  AppLocalizations(String locale) : localeName = intl.Intl.canonicalizedLocale(locale.toString());
+
+  final String localeName;
+
+  static AppLocalizations? of(BuildContext context) {
+    return Localizations.of<AppLocalizations>(context, AppLocalizations);
+  }
+
+  static const LocalizationsDelegate<AppLocalizations> delegate = _AppLocalizationsDelegate();
+
+  /// A list of this localizations delegate along with the default localizations
+  /// delegates.
+  ///
+  /// Returns a list of localizations delegates containing this delegate along with
+  /// GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate,
+  /// and GlobalWidgetsLocalizations.delegate.
+  ///
+  /// Additional delegates can be added by appending to this list in
+  /// MaterialApp. This list does not have to be used at all if a custom list
+  /// of delegates is preferred or required.
+  static const List<LocalizationsDelegate<dynamic>> localizationsDelegates = <LocalizationsDelegate<dynamic>>[
+    delegate,
+    GlobalMaterialLocalizations.delegate,
+    GlobalCupertinoLocalizations.delegate,
+    GlobalWidgetsLocalizations.delegate,
+  ];
+
+  /// A list of this localizations delegate's supported locales.
+  static const List<Locale> supportedLocales = <Locale>[
+    Locale('en'),
+    Locale('zh')
+  ];
+
+  /// No description provided for @appTitle.
+  ///
+  /// In en, this message translates to:
+  /// **'Chinese Chess'**
+  String get appTitle;
+
+  /// No description provided for @menu.
+  ///
+  /// In en, this message translates to:
+  /// **'Menu'**
+  String get menu;
+
+  /// No description provided for @openMenu.
+  ///
+  /// In en, this message translates to:
+  /// **'Open Menu'**
+  String get openMenu;
+
+  /// No description provided for @flipBoard.
+  ///
+  /// In en, this message translates to:
+  /// **'Flip Board'**
+  String get flipBoard;
+
+  /// No description provided for @copyCode.
+  ///
+  /// In en, this message translates to:
+  /// **'Copy Chess Code'**
+  String get copyCode;
+
+  /// No description provided for @parseCode.
+  ///
+  /// In en, this message translates to:
+  /// **'Parse Chess Code'**
+  String get parseCode;
+
+  /// No description provided for @editCode.
+  ///
+  /// In en, this message translates to:
+  /// **'Edit Chess'**
+  String get editCode;
+
+  /// No description provided for @newGame.
+  ///
+  /// In en, this message translates to:
+  /// **'New Game'**
+  String get newGame;
+
+  /// No description provided for @loadManual.
+  ///
+  /// In en, this message translates to:
+  /// **'Load Chess Manual'**
+  String get loadManual;
+
+  /// No description provided for @saveManual.
+  ///
+  /// In en, this message translates to:
+  /// **'Save Chess Manual'**
+  String get saveManual;
+
+  /// No description provided for @setting.
+  ///
+  /// In en, this message translates to:
+  /// **'Setting'**
+  String get setting;
+
+  /// No description provided for @featureNotAvailable.
+  ///
+  /// In en, this message translates to:
+  /// **'Feature is not available'**
+  String get featureNotAvailable;
+
+  /// No description provided for @modeRobot.
+  ///
+  /// In en, this message translates to:
+  /// **'Robot Mode'**
+  String get modeRobot;
+
+  /// No description provided for @modeOnline.
+  ///
+  /// In en, this message translates to:
+  /// **'Online Mode'**
+  String get modeOnline;
+
+  /// No description provided for @modeFree.
+  ///
+  /// In en, this message translates to:
+  /// **'Free Mode'**
+  String get modeFree;
+
+  /// No description provided for @clearAll.
+  ///
+  /// In en, this message translates to:
+  /// **'Clear All'**
+  String get clearAll;
+
+  /// No description provided for @save.
+  ///
+  /// In en, this message translates to:
+  /// **'Apply'**
+  String get save;
+
+  /// No description provided for @trusteeshipToRobots.
+  ///
+  /// In en, this message translates to:
+  /// **'Trusteeship to Robots'**
+  String get trusteeshipToRobots;
+
+  /// No description provided for @cancelRobots.
+  ///
+  /// In en, this message translates to:
+  /// **'Cancel Trusteeship'**
+  String get cancelRobots;
+
+  /// No description provided for @thinking.
+  ///
+  /// In en, this message translates to:
+  /// **'Thinking...'**
+  String get thinking;
+
+  /// No description provided for @currentInfo.
+  ///
+  /// In en, this message translates to:
+  /// **'Current'**
+  String get currentInfo;
+
+  /// No description provided for @manual.
+  ///
+  /// In en, this message translates to:
+  /// **'Manual'**
+  String get manual;
+
+  /// No description provided for @theEvent.
+  ///
+  /// In en, this message translates to:
+  /// **'Event: '**
+  String get theEvent;
+
+  /// No description provided for @theSite.
+  ///
+  /// In en, this message translates to:
+  /// **'Site: '**
+  String get theSite;
+
+  /// No description provided for @theDate.
+  ///
+  /// In en, this message translates to:
+  /// **'Date: '**
+  String get theDate;
+
+  /// No description provided for @theRound.
+  ///
+  /// In en, this message translates to:
+  /// **'Round: '**
+  String get theRound;
+
+  /// No description provided for @theRed.
+  ///
+  /// In en, this message translates to:
+  /// **'Red: '**
+  String get theRed;
+
+  /// No description provided for @theBlack.
+  ///
+  /// In en, this message translates to:
+  /// **'Black: '**
+  String get theBlack;
+
+  /// No description provided for @stepStart.
+  ///
+  /// In en, this message translates to:
+  /// **'==Start=='**
+  String get stepStart;
+
+  /// No description provided for @exitNow.
+  ///
+  /// In en, this message translates to:
+  /// **'Exit Now ?'**
+  String get exitNow;
+
+  /// No description provided for @dontExit.
+  ///
+  /// In en, this message translates to:
+  /// **'Wait a moment'**
+  String get dontExit;
+
+  /// No description provided for @yesExit.
+  ///
+  /// In en, this message translates to:
+  /// **'Yes exit'**
+  String get yesExit;
+
+  /// No description provided for @clickAgainToExit.
+  ///
+  /// In en, this message translates to:
+  /// **'Click again to Exit'**
+  String get clickAgainToExit;
+
+  /// No description provided for @apply.
+  ///
+  /// In en, this message translates to:
+  /// **'Apply'**
+  String get apply;
+
+  /// No description provided for @situationCode.
+  ///
+  /// In en, this message translates to:
+  /// **'Chess Code'**
+  String get situationCode;
+
+  /// No description provided for @invalidCode.
+  ///
+  /// In en, this message translates to:
+  /// **'Invalid Chess Code'**
+  String get invalidCode;
+
+  /// No description provided for @copySuccess.
+  ///
+  /// In en, this message translates to:
+  /// **'Copy Success'**
+  String get copySuccess;
+
+  /// No description provided for @saveSuccess.
+  ///
+  /// In en, this message translates to:
+  /// **'Save Success'**
+  String get saveSuccess;
+
+  /// No description provided for @selectDirectorySave.
+  ///
+  /// In en, this message translates to:
+  /// **'Select a Directory to Save'**
+  String get selectDirectorySave;
+
+  /// No description provided for @saveFilename.
+  ///
+  /// In en, this message translates to:
+  /// **'Filename to Save'**
+  String get saveFilename;
+
+  /// No description provided for @selectPgnFile.
+  ///
+  /// In en, this message translates to:
+  /// **'Select .PGN file'**
+  String get selectPgnFile;
+
+  /// No description provided for @recommendMove.
+  ///
+  /// In en, this message translates to:
+  /// **'Recommend Move'**
+  String get recommendMove;
+
+  /// No description provided for @remark.
+  ///
+  /// In en, this message translates to:
+  /// **'Remark'**
+  String get remark;
+
+  /// No description provided for @noRemark.
+  ///
+  /// In en, this message translates to:
+  /// **'No remark'**
+  String get noRemark;
+
+  /// No description provided for @check.
+  ///
+  /// In en, this message translates to:
+  /// **'Check'**
+  String get check;
+
+  /// No description provided for @checkmate.
+  ///
+  /// In en, this message translates to:
+  /// **'Checkmate'**
+  String get checkmate;
+
+  /// No description provided for @longRecheckLoose.
+  ///
+  /// In en, this message translates to:
+  /// **'The same move 3 round to Lose'**
+  String get longRecheckLoose;
+
+  /// No description provided for @noEatToDraw.
+  ///
+  /// In en, this message translates to:
+  /// **'60 round with no eat to Draw'**
+  String get noEatToDraw;
+
+  /// No description provided for @trapped.
+  ///
+  /// In en, this message translates to:
+  /// **'Checkmate'**
+  String get trapped;
+
+  /// No description provided for @redLoose.
+  ///
+  /// In en, this message translates to:
+  /// **'Loose'**
+  String get redLoose;
+
+  /// No description provided for @redWin.
+  ///
+  /// In en, this message translates to:
+  /// **'Win'**
+  String get redWin;
+
+  /// No description provided for @redDraw.
+  ///
+  /// In en, this message translates to:
+  /// **'Draw'**
+  String get redDraw;
+
+  /// No description provided for @requestDraw.
+  ///
+  /// In en, this message translates to:
+  /// **'Asked for a draw'**
+  String get requestDraw;
+
+  /// No description provided for @agreeToDraw.
+  ///
+  /// In en, this message translates to:
+  /// **'Agree to draw'**
+  String get agreeToDraw;
+
+  /// No description provided for @requestRetract.
+  ///
+  /// In en, this message translates to:
+  /// **'Asked for a Retract'**
+  String get requestRetract;
+
+  /// No description provided for @agreeRetract.
+  ///
+  /// In en, this message translates to:
+  /// **'Agree to retract'**
+  String get agreeRetract;
+
+  /// No description provided for @disagreeRetract.
+  ///
+  /// In en, this message translates to:
+  /// **'Disagree to retract'**
+  String get disagreeRetract;
+
+  /// No description provided for @cantSendCheck.
+  ///
+  /// In en, this message translates to:
+  /// **'You can\'t send Check'**
+  String get cantSendCheck;
+
+  /// No description provided for @plsParryCheck.
+  ///
+  /// In en, this message translates to:
+  /// **'Please parry the Check'**
+  String get plsParryCheck;
+
+  /// No description provided for @oneMoreGame.
+  ///
+  /// In en, this message translates to:
+  /// **'New Game'**
+  String get oneMoreGame;
+
+  /// No description provided for @letMeSee.
+  ///
+  /// In en, this message translates to:
+  /// **'Not now'**
+  String get letMeSee;
+
+  /// No description provided for @settingTitle.
+  ///
+  /// In en, this message translates to:
+  /// **'Settings'**
+  String get settingTitle;
+}
+
+class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
+  const _AppLocalizationsDelegate();
+
+  @override
+  Future<AppLocalizations> load(Locale locale) {
+    return SynchronousFuture<AppLocalizations>(lookupAppLocalizations(locale));
+  }
+
+  @override
+  bool isSupported(Locale locale) => <String>['en', 'zh'].contains(locale.languageCode);
+
+  @override
+  bool shouldReload(_AppLocalizationsDelegate old) => false;
+}
+
+AppLocalizations lookupAppLocalizations(Locale locale) {
+
+
+  // Lookup logic when only language code is specified.
+  switch (locale.languageCode) {
+    case 'en': return AppLocalizationsEn();
+    case 'zh': return AppLocalizationsZh();
+  }
+
+  throw FlutterError(
+    'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
+    'an issue with the localizations generation tool. Please file an issue '
+    'on GitHub with a reproducible sample app and the gen-l10n configuration '
+    'that was used.'
+  );
+}

+ 192 - 0
lib/l10n/generated/app_localizations_en.dart

@@ -0,0 +1,192 @@
+import 'app_localizations.dart';
+
+/// The translations for English (`en`).
+class AppLocalizationsEn extends AppLocalizations {
+  AppLocalizationsEn([String locale = 'en']) : super(locale);
+
+  @override
+  String get appTitle => 'Chinese Chess';
+
+  @override
+  String get menu => 'Menu';
+
+  @override
+  String get openMenu => 'Open Menu';
+
+  @override
+  String get flipBoard => 'Flip Board';
+
+  @override
+  String get copyCode => 'Copy Chess Code';
+
+  @override
+  String get parseCode => 'Parse Chess Code';
+
+  @override
+  String get editCode => 'Edit Chess';
+
+  @override
+  String get newGame => 'New Game';
+
+  @override
+  String get loadManual => 'Load Chess Manual';
+
+  @override
+  String get saveManual => 'Save Chess Manual';
+
+  @override
+  String get setting => 'Setting';
+
+  @override
+  String get featureNotAvailable => 'Feature is not available';
+
+  @override
+  String get modeRobot => 'Robot Mode';
+
+  @override
+  String get modeOnline => 'Online Mode';
+
+  @override
+  String get modeFree => 'Free Mode';
+
+  @override
+  String get clearAll => 'Clear All';
+
+  @override
+  String get save => 'Apply';
+
+  @override
+  String get trusteeshipToRobots => 'Trusteeship to Robots';
+
+  @override
+  String get cancelRobots => 'Cancel Trusteeship';
+
+  @override
+  String get thinking => 'Thinking...';
+
+  @override
+  String get currentInfo => 'Current';
+
+  @override
+  String get manual => 'Manual';
+
+  @override
+  String get theEvent => 'Event: ';
+
+  @override
+  String get theSite => 'Site: ';
+
+  @override
+  String get theDate => 'Date: ';
+
+  @override
+  String get theRound => 'Round: ';
+
+  @override
+  String get theRed => 'Red: ';
+
+  @override
+  String get theBlack => 'Black: ';
+
+  @override
+  String get stepStart => '==Start==';
+
+  @override
+  String get exitNow => 'Exit Now ?';
+
+  @override
+  String get dontExit => 'Wait a moment';
+
+  @override
+  String get yesExit => 'Yes exit';
+
+  @override
+  String get clickAgainToExit => 'Click again to Exit';
+
+  @override
+  String get apply => 'Apply';
+
+  @override
+  String get situationCode => 'Chess Code';
+
+  @override
+  String get invalidCode => 'Invalid Chess Code';
+
+  @override
+  String get copySuccess => 'Copy Success';
+
+  @override
+  String get saveSuccess => 'Save Success';
+
+  @override
+  String get selectDirectorySave => 'Select a Directory to Save';
+
+  @override
+  String get saveFilename => 'Filename to Save';
+
+  @override
+  String get selectPgnFile => 'Select .PGN file';
+
+  @override
+  String get recommendMove => 'Recommend Move';
+
+  @override
+  String get remark => 'Remark';
+
+  @override
+  String get noRemark => 'No remark';
+
+  @override
+  String get check => 'Check';
+
+  @override
+  String get checkmate => 'Checkmate';
+
+  @override
+  String get longRecheckLoose => 'The same move 3 round to Lose';
+
+  @override
+  String get noEatToDraw => '60 round with no eat to Draw';
+
+  @override
+  String get trapped => 'Checkmate';
+
+  @override
+  String get redLoose => 'Loose';
+
+  @override
+  String get redWin => 'Win';
+
+  @override
+  String get redDraw => 'Draw';
+
+  @override
+  String get requestDraw => 'Asked for a draw';
+
+  @override
+  String get agreeToDraw => 'Agree to draw';
+
+  @override
+  String get requestRetract => 'Asked for a Retract';
+
+  @override
+  String get agreeRetract => 'Agree to retract';
+
+  @override
+  String get disagreeRetract => 'Disagree to retract';
+
+  @override
+  String get cantSendCheck => 'You can\'t send Check';
+
+  @override
+  String get plsParryCheck => 'Please parry the Check';
+
+  @override
+  String get oneMoreGame => 'New Game';
+
+  @override
+  String get letMeSee => 'Not now';
+
+  @override
+  String get settingTitle => 'Settings';
+}

+ 192 - 0
lib/l10n/generated/app_localizations_zh.dart

@@ -0,0 +1,192 @@
+import 'app_localizations.dart';
+
+/// The translations for Chinese (`zh`).
+class AppLocalizationsZh extends AppLocalizations {
+  AppLocalizationsZh([String locale = 'zh']) : super(locale);
+
+  @override
+  String get appTitle => '中国象棋';
+
+  @override
+  String get menu => '菜单';
+
+  @override
+  String get openMenu => '打开菜单';
+
+  @override
+  String get flipBoard => '翻转棋盘';
+
+  @override
+  String get copyCode => '复制局面代码';
+
+  @override
+  String get parseCode => '粘贴局面代码';
+
+  @override
+  String get editCode => '编辑局面';
+
+  @override
+  String get newGame => '新对局';
+
+  @override
+  String get loadManual => '加载棋谱';
+
+  @override
+  String get saveManual => '保存棋谱';
+
+  @override
+  String get setting => '设置';
+
+  @override
+  String get featureNotAvailable => '功能暂未实现';
+
+  @override
+  String get modeRobot => '人机模式';
+
+  @override
+  String get modeOnline => '联网模式';
+
+  @override
+  String get modeFree => '自由模式';
+
+  @override
+  String get clearAll => '清除全部';
+
+  @override
+  String get save => '确定';
+
+  @override
+  String get trusteeshipToRobots => '托管给机器人';
+
+  @override
+  String get cancelRobots => '取消托管';
+
+  @override
+  String get thinking => '思考中...';
+
+  @override
+  String get currentInfo => '当前信息';
+
+  @override
+  String get manual => '棋局信息';
+
+  @override
+  String get theEvent => '赛事:';
+
+  @override
+  String get theSite => '地点:';
+
+  @override
+  String get theDate => '日期:';
+
+  @override
+  String get theRound => '轮次:';
+
+  @override
+  String get theRed => '红方:';
+
+  @override
+  String get theBlack => '黑方:';
+
+  @override
+  String get stepStart => '==开始==';
+
+  @override
+  String get exitNow => '确定退出?';
+
+  @override
+  String get dontExit => '暂不退出';
+
+  @override
+  String get yesExit => '立即退出';
+
+  @override
+  String get clickAgainToExit => '再次点击退出';
+
+  @override
+  String get apply => '应用';
+
+  @override
+  String get situationCode => '局面代码';
+
+  @override
+  String get invalidCode => '无效代码';
+
+  @override
+  String get copySuccess => '复制成功';
+
+  @override
+  String get saveSuccess => '保存成功';
+
+  @override
+  String get selectDirectorySave => '选择保存位置';
+
+  @override
+  String get saveFilename => '保存文件名';
+
+  @override
+  String get selectPgnFile => '选择棋谱文件';
+
+  @override
+  String get recommendMove => '推荐招法';
+
+  @override
+  String get remark => '注解';
+
+  @override
+  String get noRemark => '暂无注解';
+
+  @override
+  String get check => '将军';
+
+  @override
+  String get checkmate => '绝杀';
+
+  @override
+  String get longRecheckLoose => '不变招长将作负';
+
+  @override
+  String get noEatToDraw => '60回合无吃子判和';
+
+  @override
+  String get trapped => '困毙';
+
+  @override
+  String get redLoose => '先负';
+
+  @override
+  String get redWin => '先负';
+
+  @override
+  String get redDraw => '先和';
+
+  @override
+  String get requestDraw => '对方请求和棋';
+
+  @override
+  String get agreeToDraw => '同意和棋';
+
+  @override
+  String get requestRetract => '对方请求悔棋';
+
+  @override
+  String get agreeRetract => '同意悔棋';
+
+  @override
+  String get disagreeRetract => '拒绝悔棋';
+
+  @override
+  String get cantSendCheck => '不能送将';
+
+  @override
+  String get plsParryCheck => '请应将';
+
+  @override
+  String get oneMoreGame => '再来一局';
+
+  @override
+  String get letMeSee => '再看看';
+
+  @override
+  String get settingTitle => '系统设置';
+}

+ 46 - 15
lib/main.dart

@@ -4,31 +4,39 @@ import 'package:flutter/foundation.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 import 'package:flutter_chinese_chees/routes.dart';
+import 'package:flutter_chinese_chees/theme.dart';
 import 'package:flutter_chinese_chees/utils/game_manager.dart';
 import 'package:window_manager/window_manager.dart';
+import 'package:flutter_localizations/flutter_localizations.dart';
+import 'package:shirne_dialog/shirne_dialog.dart';
+import 'l10n/generated/app_localizations.dart';
 
 /// Description: enter point
 /// Time       : 04/28/2023 Friday
 /// Author     : liuyuqi.gov@msn.cn
 void main() async {
   WidgetsFlutterBinding.ensureInitialized();
+  // pc 平台,非 web 版本
   if (!kIsWeb && (Platform.isMacOS || Platform.isWindows || Platform.isLinux)) {
     await windowManager.ensureInitialized();
-  }
 
-  const windowOptions = WindowOptions(
-      size: Size(1024, 720),
-      center: true,
-      backgroundColor: Colors.transparent,
-      skipTaskbar: false,
-      titleBarStyle: TitleBarStyle.normal);
+    const windowOptions = WindowOptions(
+        size: Size(1024, 720),
+        center: true,
+        backgroundColor: Colors.transparent,
+        skipTaskbar: false,
+        titleBarStyle: TitleBarStyle.normal);
+
+    windowManager.waitUntilReadyToShow(windowOptions, () async {
+      await windowManager.show();
+      await windowManager.focus();
+    });
 
-  windowManager.waitUntilReadyToShow(windowOptions, () async {
-    await windowManager.show();
-    await windowManager.focus();
-  });
+    windowManager.addListener(MainWindowListener());
+  }
 
-  windowManager.addListener(MainWindowListener());
+  final gamer = GameManager();
+  await gamer.init();
 
   runApp(const MyApp());
 
@@ -56,11 +64,34 @@ class MyApp extends StatelessWidget {
     return MaterialApp(
       title: '中国象棋',
       debugShowCheckedModeBanner: false,
-      theme: ThemeData(
-        primarySwatch: Colors.blue,
-      ),
       onGenerateRoute: Routes.onGenerateRoute,
       initialRoute: Routes.home,
+      onGenerateTitle: (BuildContext context) {
+        if (!kIsWeb &&
+            (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) {
+          windowManager.setTitle(context.l10n.appTitle);
+        }
+        return context.l10n.appTitle;
+      },
+      navigatorKey: MyDialog.navigatorKey,
+      localizationsDelegates: const [
+        AppLocalizations.delegate,
+        ShirneDialogLocalizations.delegate,
+        GlobalMaterialLocalizations.delegate,
+        GlobalWidgetsLocalizations.delegate,
+        GlobalCupertinoLocalizations.delegate,
+      ],
+      supportedLocales: const [
+        Locale('en', ''),
+        Locale('zh', 'CN'),
+      ],
+      theme: AppTheme.createTheme(),
+      highContrastTheme: AppTheme.createTheme(isHighContrast: true),
+      darkTheme: AppTheme.createTheme(isDark: true),
+      highContrastDarkTheme: AppTheme.createTheme(
+        isDark: true,
+        isHighContrast: true,
+      ),
     );
   }
 }

+ 33 - 2
lib/theme.dart

@@ -1,6 +1,37 @@
 /// Description: Theme: dark or light
 /// Time       : 04/28/2023 Friday
 /// Author     : liuyuqi.gov@msn.cn
-class Theme {
-  
+import 'package:flutter/material.dart';
+
+class AppTheme extends ThemeExtension<AppTheme> {
+  AppTheme();
+
+  AppTheme.dark();
+
+  static ThemeData createTheme({
+    bool isDark = false,
+    bool isHighContrast = false,
+  }) {
+    return ThemeData.from(
+      colorScheme: ColorScheme.fromSeed(
+        seedColor: Colors.blue,
+        brightness: isDark ? Brightness.dark : Brightness.light,
+      ),
+      textTheme: const TextTheme(),
+    ).copyWith(
+      extensions: [
+        isDark ? AppTheme.dark() : AppTheme(),
+      ],
+    );
+  }
+
+  @override
+  ThemeExtension<AppTheme> copyWith() {
+    return AppTheme();
+  }
+
+  @override
+  ThemeExtension<AppTheme> lerp(ThemeExtension<AppTheme>? other, double t) {
+    return AppTheme();
+  }
 }