添加语言切换

This commit is contained in:
rang 2025-10-22 17:58:29 +08:00
parent e0deb84123
commit e06c834d0e
21 changed files with 1416 additions and 281 deletions

View file

@ -0,0 +1,72 @@
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that looks up messages for specific locales by
// delegating to the appropriate library.
// Ignore issues from commonly used lints in this file.
// ignore_for_file:implementation_imports, file_names, unnecessary_new
// ignore_for_file:unnecessary_brace_in_string_interps, directives_ordering
// ignore_for_file:argument_type_not_assignable, invalid_assignment
// ignore_for_file:prefer_single_quotes, prefer_generic_function_type_aliases
// ignore_for_file:comment_references
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
import 'package:intl/src/intl_helpers.dart';
import 'messages_en.dart' as messages_en;
import 'messages_zh.dart' as messages_zh;
typedef Future<dynamic> LibraryLoader();
Map<String, LibraryLoader> _deferredLibraries = {
'en': () => new SynchronousFuture(null),
'zh': () => new SynchronousFuture(null),
};
MessageLookupByLibrary? _findExact(String localeName) {
switch (localeName) {
case 'en':
return messages_en.messages;
case 'zh':
return messages_zh.messages;
default:
return null;
}
}
/// User programs should call this before using [localeName] for messages.
Future<bool> initializeMessages(String localeName) {
var availableLocale = Intl.verifiedLocale(
localeName,
(locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null,
);
if (availableLocale == null) {
return new SynchronousFuture(false);
}
var lib = _deferredLibraries[availableLocale];
lib == null ? new SynchronousFuture(false) : lib();
initializeInternalMessageLookup(() => new CompositeMessageLookup());
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
return new SynchronousFuture(true);
}
bool _messagesExistFor(String locale) {
try {
return _findExact(locale) != null;
} catch (e) {
return false;
}
}
MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) {
var actualLocale = Intl.verifiedLocale(
locale,
_messagesExistFor,
onFailure: (_) => null,
);
if (actualLocale == null) return null;
return _findExact(actualLocale);
}

View file

@ -0,0 +1,150 @@
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that provides messages for a en locale. All the
// messages from the main program should be duplicated here with the same
// function name.
// Ignore issues from commonly used lints in this file.
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
final messages = new MessageLookup();
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'en';
static String m0(item) => "Are you sure you want to delete ${item}?";
static String m1(item) => "Deleted ${item}";
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"appSettings": MessageLookupByLibrary.simpleMessage("App Settings"),
"appearance": MessageLookupByLibrary.simpleMessage("Appearance"),
"autoTurnOnSleepTimer": MessageLookupByLibrary.simpleMessage(
"Auto Turn On Sleep Timer",
),
"automaticallyDescription": MessageLookupByLibrary.simpleMessage(
"Automatically turn on the sleep timer based on the time of day",
),
"backup": MessageLookupByLibrary.simpleMessage("Backup"),
"backupAndRestore": MessageLookupByLibrary.simpleMessage(
"Backup and Restore",
),
"bookAbout": MessageLookupByLibrary.simpleMessage("About the Book"),
"bookAboutDefault": MessageLookupByLibrary.simpleMessage(
"Sorry, no description found",
),
"bookMetadataAbridged": MessageLookupByLibrary.simpleMessage("Abridged"),
"bookMetadataLength": MessageLookupByLibrary.simpleMessage("Length"),
"bookMetadataPublished": MessageLookupByLibrary.simpleMessage("Published"),
"bookMetadataUnabridged": MessageLookupByLibrary.simpleMessage(
"Unabridged",
),
"cancel": MessageLookupByLibrary.simpleMessage("Cancel"),
"copyToClipboard": MessageLookupByLibrary.simpleMessage(
"Copy to Clipboard",
),
"copyToClipboardDescription": MessageLookupByLibrary.simpleMessage(
"Copy the app settings to the clipboard",
),
"copyToClipboardToast": MessageLookupByLibrary.simpleMessage(
"Settings copied to clipboard",
),
"delete": MessageLookupByLibrary.simpleMessage("Delete"),
"deleteDialog": m0,
"deleted": m1,
"explore": MessageLookupByLibrary.simpleMessage("explore"),
"exploreTooltip": MessageLookupByLibrary.simpleMessage(
"Search and Explore",
),
"general": MessageLookupByLibrary.simpleMessage("General"),
"home": MessageLookupByLibrary.simpleMessage("Home"),
"homeContinueListening": MessageLookupByLibrary.simpleMessage(
"Continue Listening",
),
"homeListenAgain": MessageLookupByLibrary.simpleMessage("Listen Again"),
"homePageSettings": MessageLookupByLibrary.simpleMessage(
"Home Page Settings",
),
"homePageSettingsDescription": MessageLookupByLibrary.simpleMessage(
"Customize the home page",
),
"homeStartListening": MessageLookupByLibrary.simpleMessage(
"Start Listening",
),
"language": MessageLookupByLibrary.simpleMessage("Language"),
"languageDescription": MessageLookupByLibrary.simpleMessage(
"Language switch",
),
"library": MessageLookupByLibrary.simpleMessage("Library"),
"libraryTooltip": MessageLookupByLibrary.simpleMessage(
"Browse your library",
),
"no": MessageLookupByLibrary.simpleMessage("No"),
"notificationMediaPlayer": MessageLookupByLibrary.simpleMessage(
"Notification Media Player",
),
"notificationMediaPlayerDescription": MessageLookupByLibrary.simpleMessage(
"Customize the media player in notifications",
),
"ok": MessageLookupByLibrary.simpleMessage("OK"),
"pause": MessageLookupByLibrary.simpleMessage("Pause"),
"play": MessageLookupByLibrary.simpleMessage("Play"),
"playerSettings": MessageLookupByLibrary.simpleMessage("Player Settings"),
"playerSettingsDescription": MessageLookupByLibrary.simpleMessage(
"Customize the player settings",
),
"readLess": MessageLookupByLibrary.simpleMessage("Read Less"),
"readMore": MessageLookupByLibrary.simpleMessage("Read More"),
"reset": MessageLookupByLibrary.simpleMessage("Reset"),
"resetAppSettings": MessageLookupByLibrary.simpleMessage(
"Reset App Settings",
),
"resetAppSettingsDescription": MessageLookupByLibrary.simpleMessage(
"Reset the app settings to the default values",
),
"resetAppSettingsDialog": MessageLookupByLibrary.simpleMessage(
"Are you sure you want to reset the app settings?",
),
"restore": MessageLookupByLibrary.simpleMessage("Restore"),
"restoreBackup": MessageLookupByLibrary.simpleMessage("Restore Backup"),
"restoreBackupHint": MessageLookupByLibrary.simpleMessage(
"Paste the backup here",
),
"restoreBackupInvalid": MessageLookupByLibrary.simpleMessage(
"Invalid backup",
),
"restoreBackupSuccess": MessageLookupByLibrary.simpleMessage(
"Settings restored",
),
"restoreBackupValidator": MessageLookupByLibrary.simpleMessage(
"Please paste the backup here",
),
"restoreDescription": MessageLookupByLibrary.simpleMessage(
"Restore the app settings from the backup",
),
"resume": MessageLookupByLibrary.simpleMessage("Resume"),
"shakeDetector": MessageLookupByLibrary.simpleMessage("Shake Detector"),
"shakeDetectorDescription": MessageLookupByLibrary.simpleMessage(
"Customize the shake detector settings",
),
"themeSettings": MessageLookupByLibrary.simpleMessage("Theme Settings"),
"themeSettingsDescription": MessageLookupByLibrary.simpleMessage(
"Customize the app theme",
),
"unknown": MessageLookupByLibrary.simpleMessage("Unknown"),
"yes": MessageLookupByLibrary.simpleMessage("Yes"),
"you": MessageLookupByLibrary.simpleMessage("You"),
"youTooltip": MessageLookupByLibrary.simpleMessage(
"Your Profile and Settings",
),
};
}

View file

@ -0,0 +1,104 @@
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that provides messages for a zh locale. All the
// messages from the main program should be duplicated here with the same
// function name.
// Ignore issues from commonly used lints in this file.
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
final messages = new MessageLookup();
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'zh';
static String m0(item) => "确定要删除 ${item} 吗?";
static String m1(item) => "已删除 ${item}";
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"appSettings": MessageLookupByLibrary.simpleMessage("应用设置"),
"appearance": MessageLookupByLibrary.simpleMessage("外观"),
"autoTurnOnSleepTimer": MessageLookupByLibrary.simpleMessage("自动开启睡眠定时器"),
"automaticallyDescription": MessageLookupByLibrary.simpleMessage(
"根据一天中的时间自动打开睡眠定时器",
),
"backup": MessageLookupByLibrary.simpleMessage("备份"),
"backupAndRestore": MessageLookupByLibrary.simpleMessage("备份与恢复"),
"bookAbout": MessageLookupByLibrary.simpleMessage("关于本书"),
"bookAboutDefault": MessageLookupByLibrary.simpleMessage("抱歉,找不到描述"),
"cancel": MessageLookupByLibrary.simpleMessage("取消"),
"copyToClipboard": MessageLookupByLibrary.simpleMessage("复制到剪贴板"),
"copyToClipboardDescription": MessageLookupByLibrary.simpleMessage(
"将应用程序设置复制到剪贴板",
),
"copyToClipboardToast": MessageLookupByLibrary.simpleMessage("设置已复制到剪贴板"),
"delete": MessageLookupByLibrary.simpleMessage("Delete"),
"deleteDialog": m0,
"deleted": m1,
"explore": MessageLookupByLibrary.simpleMessage("探索"),
"exploreTooltip": MessageLookupByLibrary.simpleMessage("搜索和探索"),
"general": MessageLookupByLibrary.simpleMessage("通用"),
"home": MessageLookupByLibrary.simpleMessage("首页"),
"homeContinueListening": MessageLookupByLibrary.simpleMessage("继续收听"),
"homeListenAgain": MessageLookupByLibrary.simpleMessage("再听一遍"),
"homePageSettings": MessageLookupByLibrary.simpleMessage("主页设置"),
"homePageSettingsDescription": MessageLookupByLibrary.simpleMessage(
"自定义主页",
),
"homeStartListening": MessageLookupByLibrary.simpleMessage("开始收听"),
"language": MessageLookupByLibrary.simpleMessage("语言"),
"languageDescription": MessageLookupByLibrary.simpleMessage("语言切换"),
"library": MessageLookupByLibrary.simpleMessage("媒体库"),
"libraryTooltip": MessageLookupByLibrary.simpleMessage("浏览您的媒体库"),
"no": MessageLookupByLibrary.simpleMessage(""),
"notificationMediaPlayer": MessageLookupByLibrary.simpleMessage("通知媒体播放器"),
"notificationMediaPlayerDescription": MessageLookupByLibrary.simpleMessage(
"在通知中自定义媒体播放器",
),
"ok": MessageLookupByLibrary.simpleMessage("确定"),
"pause": MessageLookupByLibrary.simpleMessage("暂停"),
"play": MessageLookupByLibrary.simpleMessage("播放"),
"playerSettings": MessageLookupByLibrary.simpleMessage("播放器设置"),
"playerSettingsDescription": MessageLookupByLibrary.simpleMessage(
"自定义播放器设置",
),
"readLess": MessageLookupByLibrary.simpleMessage("折叠"),
"readMore": MessageLookupByLibrary.simpleMessage("展开"),
"reset": MessageLookupByLibrary.simpleMessage("重置"),
"resetAppSettings": MessageLookupByLibrary.simpleMessage("重置应用程序设置"),
"resetAppSettingsDescription": MessageLookupByLibrary.simpleMessage(
"将应用程序设置重置为默认值",
),
"resetAppSettingsDialog": MessageLookupByLibrary.simpleMessage(
"您确定要重置应用程序设置吗?",
),
"restore": MessageLookupByLibrary.simpleMessage("恢复"),
"restoreBackup": MessageLookupByLibrary.simpleMessage("恢复备份"),
"restoreBackupHint": MessageLookupByLibrary.simpleMessage("将备份粘贴到此处"),
"restoreBackupInvalid": MessageLookupByLibrary.simpleMessage("无效备份"),
"restoreBackupSuccess": MessageLookupByLibrary.simpleMessage("设置已恢复"),
"restoreBackupValidator": MessageLookupByLibrary.simpleMessage("请将备份粘贴到此处"),
"restoreDescription": MessageLookupByLibrary.simpleMessage("从备份中还原应用程序设置"),
"resume": MessageLookupByLibrary.simpleMessage("继续"),
"shakeDetector": MessageLookupByLibrary.simpleMessage("抖动检测器"),
"shakeDetectorDescription": MessageLookupByLibrary.simpleMessage(
"自定义抖动检测器设置",
),
"themeSettings": MessageLookupByLibrary.simpleMessage("主题设置"),
"themeSettingsDescription": MessageLookupByLibrary.simpleMessage("自定义应用主题"),
"unknown": MessageLookupByLibrary.simpleMessage("未知"),
"yes": MessageLookupByLibrary.simpleMessage(""),
"you": MessageLookupByLibrary.simpleMessage("我的"),
"youTooltip": MessageLookupByLibrary.simpleMessage("您的个人资料和设置"),
};
}

598
lib/generated/l10n.dart Normal file
View file

@ -0,0 +1,598 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'intl/messages_all.dart';
// **************************************************************************
// Generator: Flutter Intl IDE plugin
// Made by Localizely
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, lines_longer_than_80_chars
// ignore_for_file: join_return_with_assignment, prefer_final_in_for_each
// ignore_for_file: avoid_redundant_argument_values, avoid_escaping_inner_quotes
class S {
S();
static S? _current;
static S get current {
assert(
_current != null,
'No instance of S was loaded. Try to initialize the S delegate before accessing S.current.',
);
return _current!;
}
static const AppLocalizationDelegate delegate = AppLocalizationDelegate();
static Future<S> load(Locale locale) {
final name = (locale.countryCode?.isEmpty ?? false)
? locale.languageCode
: locale.toString();
final localeName = Intl.canonicalizedLocale(name);
return initializeMessages(localeName).then((_) {
Intl.defaultLocale = localeName;
final instance = S();
S._current = instance;
return instance;
});
}
static S of(BuildContext context) {
final instance = S.maybeOf(context);
assert(
instance != null,
'No instance of S present in the widget tree. Did you add S.delegate in localizationsDelegates?',
);
return instance!;
}
static S? maybeOf(BuildContext context) {
return Localizations.of<S>(context, S);
}
/// `Yes`
String get yes {
return Intl.message('Yes', name: 'yes', desc: '', args: []);
}
/// `No`
String get no {
return Intl.message('No', name: 'no', desc: '', args: []);
}
/// `OK`
String get ok {
return Intl.message('OK', name: 'ok', desc: '', args: []);
}
/// `Cancel`
String get cancel {
return Intl.message('Cancel', name: 'cancel', desc: '', args: []);
}
/// `Reset`
String get reset {
return Intl.message('Reset', name: 'reset', desc: '', args: []);
}
/// `Delete`
String get delete {
return Intl.message('Delete', name: 'delete', desc: '', args: []);
}
/// `Are you sure you want to delete {item}?`
String deleteDialog(String item) {
return Intl.message(
'Are you sure you want to delete $item?',
name: 'deleteDialog',
desc: '',
args: [item],
);
}
/// `Deleted {item}`
String deleted(String item) {
return Intl.message(
'Deleted $item',
name: 'deleted',
desc: '已删除 {}',
args: [item],
);
}
/// `Pause`
String get pause {
return Intl.message('Pause', name: 'pause', desc: '', args: []);
}
/// `Play`
String get play {
return Intl.message('Play', name: 'play', desc: '', args: []);
}
/// `Resume`
String get resume {
return Intl.message('Resume', name: 'resume', desc: '', args: []);
}
/// `Unknown`
String get unknown {
return Intl.message('Unknown', name: 'unknown', desc: '', args: []);
}
/// `Read More`
String get readMore {
return Intl.message('Read More', name: 'readMore', desc: '', args: []);
}
/// `Read Less`
String get readLess {
return Intl.message('Read Less', name: 'readLess', desc: '', args: []);
}
/// `Home`
String get home {
return Intl.message('Home', name: 'home', desc: '', args: []);
}
/// `Listen Again`
String get homeListenAgain {
return Intl.message(
'Listen Again',
name: 'homeListenAgain',
desc: '',
args: [],
);
}
/// `Continue Listening`
String get homeContinueListening {
return Intl.message(
'Continue Listening',
name: 'homeContinueListening',
desc: '',
args: [],
);
}
/// `Start Listening`
String get homeStartListening {
return Intl.message(
'Start Listening',
name: 'homeStartListening',
desc: '',
args: [],
);
}
/// `About the Book`
String get bookAbout {
return Intl.message(
'About the Book',
name: 'bookAbout',
desc: '',
args: [],
);
}
/// `Sorry, no description found`
String get bookAboutDefault {
return Intl.message(
'Sorry, no description found',
name: 'bookAboutDefault',
desc: '',
args: [],
);
}
/// `Abridged`
String get bookMetadataAbridged {
return Intl.message(
'Abridged',
name: 'bookMetadataAbridged',
desc: '',
args: [],
);
}
/// `Unabridged`
String get bookMetadataUnabridged {
return Intl.message(
'Unabridged',
name: 'bookMetadataUnabridged',
desc: '',
args: [],
);
}
/// `Length`
String get bookMetadataLength {
return Intl.message(
'Length',
name: 'bookMetadataLength',
desc: '',
args: [],
);
}
/// `Published`
String get bookMetadataPublished {
return Intl.message(
'Published',
name: 'bookMetadataPublished',
desc: '',
args: [],
);
}
/// `Library`
String get library {
return Intl.message('Library', name: 'library', desc: '', args: []);
}
/// `Browse your library`
String get libraryTooltip {
return Intl.message(
'Browse your library',
name: 'libraryTooltip',
desc: '',
args: [],
);
}
/// `explore`
String get explore {
return Intl.message('explore', name: 'explore', desc: '', args: []);
}
/// `Search and Explore`
String get exploreTooltip {
return Intl.message(
'Search and Explore',
name: 'exploreTooltip',
desc: '',
args: [],
);
}
/// `You`
String get you {
return Intl.message('You', name: 'you', desc: '', args: []);
}
/// `Your Profile and Settings`
String get youTooltip {
return Intl.message(
'Your Profile and Settings',
name: 'youTooltip',
desc: '',
args: [],
);
}
/// `App Settings`
String get appSettings {
return Intl.message(
'App Settings',
name: 'appSettings',
desc: '',
args: [],
);
}
/// `General`
String get general {
return Intl.message('General', name: 'general', desc: '', args: []);
}
/// `Language`
String get language {
return Intl.message('Language', name: 'language', desc: '', args: []);
}
/// `Language switch`
String get languageDescription {
return Intl.message(
'Language switch',
name: 'languageDescription',
desc: '',
args: [],
);
}
/// `Player Settings`
String get playerSettings {
return Intl.message(
'Player Settings',
name: 'playerSettings',
desc: '',
args: [],
);
}
/// `Customize the player settings`
String get playerSettingsDescription {
return Intl.message(
'Customize the player settings',
name: 'playerSettingsDescription',
desc: '',
args: [],
);
}
/// `Auto Turn On Sleep Timer`
String get autoTurnOnSleepTimer {
return Intl.message(
'Auto Turn On Sleep Timer',
name: 'autoTurnOnSleepTimer',
desc: '',
args: [],
);
}
/// `Automatically turn on the sleep timer based on the time of day`
String get automaticallyDescription {
return Intl.message(
'Automatically turn on the sleep timer based on the time of day',
name: 'automaticallyDescription',
desc: '',
args: [],
);
}
/// `Shake Detector`
String get shakeDetector {
return Intl.message(
'Shake Detector',
name: 'shakeDetector',
desc: '',
args: [],
);
}
/// `Customize the shake detector settings`
String get shakeDetectorDescription {
return Intl.message(
'Customize the shake detector settings',
name: 'shakeDetectorDescription',
desc: '',
args: [],
);
}
/// `Appearance`
String get appearance {
return Intl.message('Appearance', name: 'appearance', desc: '', args: []);
}
/// `Theme Settings`
String get themeSettings {
return Intl.message(
'Theme Settings',
name: 'themeSettings',
desc: '',
args: [],
);
}
/// `Customize the app theme`
String get themeSettingsDescription {
return Intl.message(
'Customize the app theme',
name: 'themeSettingsDescription',
desc: '',
args: [],
);
}
/// `Notification Media Player`
String get notificationMediaPlayer {
return Intl.message(
'Notification Media Player',
name: 'notificationMediaPlayer',
desc: '',
args: [],
);
}
/// `Customize the media player in notifications`
String get notificationMediaPlayerDescription {
return Intl.message(
'Customize the media player in notifications',
name: 'notificationMediaPlayerDescription',
desc: '',
args: [],
);
}
/// `Home Page Settings`
String get homePageSettings {
return Intl.message(
'Home Page Settings',
name: 'homePageSettings',
desc: '',
args: [],
);
}
/// `Customize the home page`
String get homePageSettingsDescription {
return Intl.message(
'Customize the home page',
name: 'homePageSettingsDescription',
desc: '',
args: [],
);
}
/// `Backup and Restore`
String get backupAndRestore {
return Intl.message(
'Backup and Restore',
name: 'backupAndRestore',
desc: '',
args: [],
);
}
/// `Copy to Clipboard`
String get copyToClipboard {
return Intl.message(
'Copy to Clipboard',
name: 'copyToClipboard',
desc: '',
args: [],
);
}
/// `Copy the app settings to the clipboard`
String get copyToClipboardDescription {
return Intl.message(
'Copy the app settings to the clipboard',
name: 'copyToClipboardDescription',
desc: '',
args: [],
);
}
/// `Settings copied to clipboard`
String get copyToClipboardToast {
return Intl.message(
'Settings copied to clipboard',
name: 'copyToClipboardToast',
desc: '',
args: [],
);
}
/// `Restore`
String get restore {
return Intl.message('Restore', name: 'restore', desc: '', args: []);
}
/// `Restore the app settings from the backup`
String get restoreDescription {
return Intl.message(
'Restore the app settings from the backup',
name: 'restoreDescription',
desc: '',
args: [],
);
}
/// `Restore Backup`
String get restoreBackup {
return Intl.message(
'Restore Backup',
name: 'restoreBackup',
desc: '',
args: [],
);
}
/// `Backup`
String get backup {
return Intl.message('Backup', name: 'backup', desc: '', args: []);
}
/// `Paste the backup here`
String get restoreBackupHint {
return Intl.message(
'Paste the backup here',
name: 'restoreBackupHint',
desc: '',
args: [],
);
}
/// `Please paste the backup here`
String get restoreBackupValidator {
return Intl.message(
'Please paste the backup here',
name: 'restoreBackupValidator',
desc: '',
args: [],
);
}
/// `Invalid backup`
String get restoreBackupInvalid {
return Intl.message(
'Invalid backup',
name: 'restoreBackupInvalid',
desc: '',
args: [],
);
}
/// `Settings restored`
String get restoreBackupSuccess {
return Intl.message(
'Settings restored',
name: 'restoreBackupSuccess',
desc: '',
args: [],
);
}
/// `Reset App Settings`
String get resetAppSettings {
return Intl.message(
'Reset App Settings',
name: 'resetAppSettings',
desc: '',
args: [],
);
}
/// `Reset the app settings to the default values`
String get resetAppSettingsDescription {
return Intl.message(
'Reset the app settings to the default values',
name: 'resetAppSettingsDescription',
desc: '',
args: [],
);
}
/// `Are you sure you want to reset the app settings?`
String get resetAppSettingsDialog {
return Intl.message(
'Are you sure you want to reset the app settings?',
name: 'resetAppSettingsDialog',
desc: '',
args: [],
);
}
}
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
const AppLocalizationDelegate();
List<Locale> get supportedLocales {
return const <Locale>[
Locale.fromSubtags(languageCode: 'en'),
Locale.fromSubtags(languageCode: 'zh'),
];
}
@override
bool isSupported(Locale locale) => _isSupported(locale);
@override
Future<S> load(Locale locale) => S.load(locale);
@override
bool shouldReload(AppLocalizationDelegate old) => false;
bool _isSupported(Locale locale) {
for (var supportedLocale in supportedLocales) {
if (supportedLocale.languageCode == locale.languageCode) {
return true;
}
}
return false;
}
}