bbea1dd364
Co-Authored-By: Claude Code <noreply@anthropic.com>
783 lines
21 KiB
Dart
783 lines
21 KiB
Dart
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';
|
||
|
||
// ignore_for_file: type=lint
|
||
|
||
/// 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 'l10n/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 @appName.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'现场影像'**
|
||
String get appName;
|
||
|
||
/// No description provided for @login.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'登录'**
|
||
String get login;
|
||
|
||
/// No description provided for @logout.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'退出登录'**
|
||
String get logout;
|
||
|
||
/// No description provided for @username.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'账号'**
|
||
String get username;
|
||
|
||
/// No description provided for @password.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'密码'**
|
||
String get password;
|
||
|
||
/// No description provided for @albums.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'相册'**
|
||
String get albums;
|
||
|
||
/// No description provided for @albumDetail.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'相册详情'**
|
||
String get albumDetail;
|
||
|
||
/// No description provided for @queue.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'上传队列'**
|
||
String get queue;
|
||
|
||
/// No description provided for @settings.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'设置'**
|
||
String get settings;
|
||
|
||
/// No description provided for @language.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'语言'**
|
||
String get language;
|
||
|
||
/// No description provided for @localeFollowSystem.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'跟随系统'**
|
||
String get localeFollowSystem;
|
||
|
||
/// No description provided for @localeChinese.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'中文'**
|
||
String get localeChinese;
|
||
|
||
/// No description provided for @localeEnglish.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'English'**
|
||
String get localeEnglish;
|
||
|
||
/// No description provided for @retry.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'重试'**
|
||
String get retry;
|
||
|
||
/// No description provided for @cancel.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'取消'**
|
||
String get cancel;
|
||
|
||
/// No description provided for @errorGeneric.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'出错了,请重试'**
|
||
String get errorGeneric;
|
||
|
||
/// No description provided for @ok.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'好的'**
|
||
String get ok;
|
||
|
||
/// No description provided for @homeTabAlbums.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'相册'**
|
||
String get homeTabAlbums;
|
||
|
||
/// No description provided for @homeTabQueue.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'队列'**
|
||
String get homeTabQueue;
|
||
|
||
/// No description provided for @homeTabSettings.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'设置'**
|
||
String get homeTabSettings;
|
||
|
||
/// No description provided for @loginHint.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'使用工作人员账号登录'**
|
||
String get loginHint;
|
||
|
||
/// No description provided for @fieldRequired.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'此项为必填项'**
|
||
String get fieldRequired;
|
||
|
||
/// No description provided for @passwordChangeTitle.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'修改密码'**
|
||
String get passwordChangeTitle;
|
||
|
||
/// No description provided for @currentPassword.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'当前密码'**
|
||
String get currentPassword;
|
||
|
||
/// No description provided for @newPassword.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'新密码'**
|
||
String get newPassword;
|
||
|
||
/// No description provided for @confirmNewPassword.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'确认新密码'**
|
||
String get confirmNewPassword;
|
||
|
||
/// No description provided for @passwordMinLength.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'新密码至少需要 8 个字符'**
|
||
String get passwordMinLength;
|
||
|
||
/// No description provided for @passwordMismatch.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'两次输入的新密码不一致'**
|
||
String get passwordMismatch;
|
||
|
||
/// No description provided for @passwordChangeSuccess.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'密码已修改'**
|
||
String get passwordChangeSuccess;
|
||
|
||
/// No description provided for @errorAuthInvalidCredentials.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'账号或密码错误'**
|
||
String get errorAuthInvalidCredentials;
|
||
|
||
/// No description provided for @errorOldPasswordIncorrect.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'当前密码错误'**
|
||
String get errorOldPasswordIncorrect;
|
||
|
||
/// No description provided for @errorAuthRateLimited.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'尝试次数过多,请稍后再试'**
|
||
String get errorAuthRateLimited;
|
||
|
||
/// No description provided for @errorAuthTokenExpired.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'会话已过期,请重新登录'**
|
||
String get errorAuthTokenExpired;
|
||
|
||
/// No description provided for @errorValidation.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'输入有误,请检查后重试'**
|
||
String get errorValidation;
|
||
|
||
/// No description provided for @errorNetwork.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'网络连接失败,请检查网络后重试'**
|
||
String get errorNetwork;
|
||
|
||
/// No description provided for @errorNetworkTimeout.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'网络超时,请重试'**
|
||
String get errorNetworkTimeout;
|
||
|
||
/// No description provided for @errorInternal.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'服务暂时不可用,请稍后重试'**
|
||
String get errorInternal;
|
||
|
||
/// No description provided for @albumsEmpty.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'暂无相册,点击「新建相册」开始'**
|
||
String get albumsEmpty;
|
||
|
||
/// No description provided for @loadMoreFailed.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'加载更多失败,点击重试'**
|
||
String get loadMoreFailed;
|
||
|
||
/// No description provided for @albumCreate.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'新建相册'**
|
||
String get albumCreate;
|
||
|
||
/// No description provided for @albumEdit.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'编辑相册'**
|
||
String get albumEdit;
|
||
|
||
/// No description provided for @albumTitle.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'标题'**
|
||
String get albumTitle;
|
||
|
||
/// No description provided for @albumDescription.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'描述'**
|
||
String get albumDescription;
|
||
|
||
/// No description provided for @albumVenue.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'场地'**
|
||
String get albumVenue;
|
||
|
||
/// No description provided for @albumAddress.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'地址'**
|
||
String get albumAddress;
|
||
|
||
/// No description provided for @albumDefaultLocale.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'默认语言'**
|
||
String get albumDefaultLocale;
|
||
|
||
/// No description provided for @albumStartAt.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'开始时间'**
|
||
String get albumStartAt;
|
||
|
||
/// No description provided for @albumEndAtOptional.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'结束时间(可选)'**
|
||
String get albumEndAtOptional;
|
||
|
||
/// No description provided for @clearEndAt.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'清除结束时间'**
|
||
String get clearEndAt;
|
||
|
||
/// No description provided for @albumTimezone.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'时区'**
|
||
String get albumTimezone;
|
||
|
||
/// No description provided for @albumTimezoneInvalid.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'无效的 IANA 时区名称'**
|
||
String get albumTimezoneInvalid;
|
||
|
||
/// No description provided for @switchUpload.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'允许上传'**
|
||
String get switchUpload;
|
||
|
||
/// No description provided for @switchPublic.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'公开可见'**
|
||
String get switchPublic;
|
||
|
||
/// No description provided for @switchDownload.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'允许下载'**
|
||
String get switchDownload;
|
||
|
||
/// No description provided for @switchOriginalDownload.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'允许下载原图'**
|
||
String get switchOriginalDownload;
|
||
|
||
/// No description provided for @formStartAtRequired.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'请选择开始时间'**
|
||
String get formStartAtRequired;
|
||
|
||
/// No description provided for @formDefaultLocaleMissing.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'默认语言必须填写标题'**
|
||
String get formDefaultLocaleMissing;
|
||
|
||
/// No description provided for @formTitleRequiredWithFields.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'填写了描述/场地/地址时,标题不能为空'**
|
||
String get formTitleRequiredWithFields;
|
||
|
||
/// No description provided for @formEndAtNotAfterStartAt.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'结束时间必须晚于开始时间'**
|
||
String get formEndAtNotAfterStartAt;
|
||
|
||
/// No description provided for @create.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'创建'**
|
||
String get create;
|
||
|
||
/// No description provided for @save.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'保存'**
|
||
String get save;
|
||
|
||
/// No description provided for @albumStatusActive.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'正常'**
|
||
String get albumStatusActive;
|
||
|
||
/// No description provided for @albumStatusOffline.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'下线'**
|
||
String get albumStatusOffline;
|
||
|
||
/// No description provided for @tagUpload.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'上传'**
|
||
String get tagUpload;
|
||
|
||
/// No description provided for @tagPublic.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'公开'**
|
||
String get tagPublic;
|
||
|
||
/// No description provided for @tagDownload.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'下载'**
|
||
String get tagDownload;
|
||
|
||
/// No description provided for @tagOriginal.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'原图'**
|
||
String get tagOriginal;
|
||
|
||
/// No description provided for @notSet.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'未定'**
|
||
String get notSet;
|
||
|
||
/// No description provided for @actionEdit.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'编辑'**
|
||
String get actionEdit;
|
||
|
||
/// No description provided for @albumMembers.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'成员管理'**
|
||
String get albumMembers;
|
||
|
||
/// No description provided for @albumCategories.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'分类管理'**
|
||
String get albumCategories;
|
||
|
||
/// No description provided for @shareQrTitle.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'分享二维码'**
|
||
String get shareQrTitle;
|
||
|
||
/// No description provided for @albumPhotos.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'照片管理'**
|
||
String get albumPhotos;
|
||
|
||
/// No description provided for @delete.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'删除'**
|
||
String get delete;
|
||
|
||
/// No description provided for @deleteConfirmCategory.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'确定删除该分类?该分类下的照片将变为未分类。'**
|
||
String get deleteConfirmCategory;
|
||
|
||
/// No description provided for @categoryEmpty.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'暂无分类,点击右上角新增'**
|
||
String get categoryEmpty;
|
||
|
||
/// No description provided for @categoryAdd.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'新增分类'**
|
||
String get categoryAdd;
|
||
|
||
/// No description provided for @categoryEdit.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'编辑分类'**
|
||
String get categoryEdit;
|
||
|
||
/// No description provided for @categoryNameZh.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'中文名称'**
|
||
String get categoryNameZh;
|
||
|
||
/// No description provided for @categoryNameEn.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'英文名称'**
|
||
String get categoryNameEn;
|
||
|
||
/// No description provided for @categorySortOrder.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'排序序号'**
|
||
String get categorySortOrder;
|
||
|
||
/// No description provided for @categoryNameRequired.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'至少填写一个语言的名称'**
|
||
String get categoryNameRequired;
|
||
|
||
/// No description provided for @categorySortOrderInvalid.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'排序序号必须是整数'**
|
||
String get categorySortOrderInvalid;
|
||
|
||
/// No description provided for @albumMembersEmpty.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'暂无成员'**
|
||
String get albumMembersEmpty;
|
||
|
||
/// No description provided for @inviteSearchHint.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'输入账号前缀搜索邀请(至少 2 个字符)'**
|
||
String get inviteSearchHint;
|
||
|
||
/// No description provided for @inviteNoResults.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'未找到匹配用户'**
|
||
String get inviteNoResults;
|
||
|
||
/// No description provided for @invite.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'邀请'**
|
||
String get invite;
|
||
|
||
/// No description provided for @memberInvited.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'已邀请'**
|
||
String get memberInvited;
|
||
|
||
/// No description provided for @removeMember.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'移除成员'**
|
||
String get removeMember;
|
||
|
||
/// No description provided for @removeMemberConfirm.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'确定移除该成员?'**
|
||
String get removeMemberConfirm;
|
||
|
||
/// No description provided for @roleOwner.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'创建者'**
|
||
String get roleOwner;
|
||
|
||
/// No description provided for @roleCollaborator.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'协作者'**
|
||
String get roleCollaborator;
|
||
|
||
/// No description provided for @selfMarker.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'(我)'**
|
||
String get selfMarker;
|
||
|
||
/// No description provided for @errorMemberConflict.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'该用户已是相册成员'**
|
||
String get errorMemberConflict;
|
||
|
||
/// No description provided for @qrHint.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'扫码或打开链接观看'**
|
||
String get qrHint;
|
||
|
||
/// No description provided for @copyLink.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'复制链接'**
|
||
String get copyLink;
|
||
|
||
/// No description provided for @copiedToClipboard.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'已复制'**
|
||
String get copiedToClipboard;
|
||
|
||
/// No description provided for @photosTask9Placeholder.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'照片管理为占位版本,完整功能将在任务 9 上线'**
|
||
String get photosTask9Placeholder;
|
||
|
||
/// No description provided for @albumPhotosEmpty.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'暂无照片'**
|
||
String get albumPhotosEmpty;
|
||
|
||
/// No description provided for @visibilityPublished.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'已发布'**
|
||
String get visibilityPublished;
|
||
|
||
/// No description provided for @visibilityUnpublished.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'未发布'**
|
||
String get visibilityUnpublished;
|
||
|
||
/// No description provided for @visibilityHidden.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'已隐藏'**
|
||
String get visibilityHidden;
|
||
|
||
/// No description provided for @visibilityDeleted.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'已删除'**
|
||
String get visibilityDeleted;
|
||
|
||
/// No description provided for @procPendingUpload.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'待上传'**
|
||
String get procPendingUpload;
|
||
|
||
/// No description provided for @procUploaded.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'已上传'**
|
||
String get procUploaded;
|
||
|
||
/// No description provided for @procProcessing.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'处理中'**
|
||
String get procProcessing;
|
||
|
||
/// No description provided for @procReady.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'就绪'**
|
||
String get procReady;
|
||
|
||
/// No description provided for @procProcessingFailed.
|
||
///
|
||
/// In zh, this message translates to:
|
||
/// **'处理失败'**
|
||
String get procProcessingFailed;
|
||
}
|
||
|
||
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.',
|
||
);
|
||
}
|