feat: 實作語言切換功能
This commit is contained in:
67
lib/generated/intl/messages_all.dart
Normal file
67
lib/generated/intl/messages_all.dart
Normal file
@@ -0,0 +1,67 @@
|
||||
// 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_Hant.dart' as messages_zh_hant;
|
||||
|
||||
typedef Future<dynamic> LibraryLoader();
|
||||
Map<String, LibraryLoader> _deferredLibraries = {
|
||||
'en': () => new SynchronousFuture(null),
|
||||
'zh_Hant': () => new SynchronousFuture(null),
|
||||
};
|
||||
|
||||
MessageLookupByLibrary? _findExact(String localeName) {
|
||||
switch (localeName) {
|
||||
case 'en':
|
||||
return messages_en.messages;
|
||||
case 'zh_Hant':
|
||||
return messages_zh_hant.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);
|
||||
}
|
||||
81
lib/generated/intl/messages_en.dart
Normal file
81
lib/generated/intl/messages_en.dart
Normal file
@@ -0,0 +1,81 @@
|
||||
// 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(time, reason, location) =>
|
||||
"Time: ${time}\nReason: ${reason},\nLocation: ${location}\n";
|
||||
|
||||
static String m1(location) => "Location: ${location}";
|
||||
|
||||
static String m2(reason) => "Reason: ${reason}";
|
||||
|
||||
static String m3(time) => "Time: ${time}";
|
||||
|
||||
static String m4(displayIndex) => "ID: ${displayIndex}";
|
||||
|
||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
|
||||
"account_setting": MessageLookupByLibrary.simpleMessage("Account"),
|
||||
"additional_information":
|
||||
MessageLookupByLibrary.simpleMessage("Knowledge"),
|
||||
"address": MessageLookupByLibrary.simpleMessage("Address"),
|
||||
"basic_information_setting":
|
||||
MessageLookupByLibrary.simpleMessage("Basic Information"),
|
||||
"call_phone":
|
||||
MessageLookupByLibrary.simpleMessage("Call Emergency Phone"),
|
||||
"cancel": MessageLookupByLibrary.simpleMessage("Cancel"),
|
||||
"confirm": MessageLookupByLibrary.simpleMessage("Confirm"),
|
||||
"edit": MessageLookupByLibrary.simpleMessage("Edit"),
|
||||
"email": MessageLookupByLibrary.simpleMessage("Email"),
|
||||
"email_label": MessageLookupByLibrary.simpleMessage("Email/Username"),
|
||||
"fall_detail": m0,
|
||||
"fall_detail_location": m1,
|
||||
"fall_detail_reason": m2,
|
||||
"fall_detail_time": m3,
|
||||
"fall_detail_title":
|
||||
MessageLookupByLibrary.simpleMessage("Fall Detail"),
|
||||
"fall_id": m4,
|
||||
"fall_record": MessageLookupByLibrary.simpleMessage("Fall Record"),
|
||||
"fall_record_empty":
|
||||
MessageLookupByLibrary.simpleMessage("No fall record"),
|
||||
"forgot_password":
|
||||
MessageLookupByLibrary.simpleMessage("Forgot password"),
|
||||
"gender": MessageLookupByLibrary.simpleMessage("Gender"),
|
||||
"home": MessageLookupByLibrary.simpleMessage("Home"),
|
||||
"language_alert": MessageLookupByLibrary.simpleMessage(
|
||||
"Return to the home page to complete the language setting(Confirm to redirect), otherwise some languages will not be updated in real time!"),
|
||||
"language_alert_android": MessageLookupByLibrary.simpleMessage(
|
||||
"Reopen the APP to complete the language setting, otherwise some languages will not be updated in real time!"),
|
||||
"language_setting": MessageLookupByLibrary.simpleMessage("Language"),
|
||||
"language_setting_alert_title":
|
||||
MessageLookupByLibrary.simpleMessage("Language Setting"),
|
||||
"login_button": MessageLookupByLibrary.simpleMessage("Login"),
|
||||
"logout_button": MessageLookupByLibrary.simpleMessage("Logout"),
|
||||
"name": MessageLookupByLibrary.simpleMessage("Name"),
|
||||
"password_label": MessageLookupByLibrary.simpleMessage("Password"),
|
||||
"personal_information": MessageLookupByLibrary.simpleMessage("Profile"),
|
||||
"phone": MessageLookupByLibrary.simpleMessage("Phone Number"),
|
||||
"realtime_video": MessageLookupByLibrary.simpleMessage("Live View"),
|
||||
"register_button": MessageLookupByLibrary.simpleMessage("Register"),
|
||||
"save": MessageLookupByLibrary.simpleMessage("Save"),
|
||||
"switch_camera": MessageLookupByLibrary.simpleMessage("Switch View")
|
||||
};
|
||||
}
|
||||
76
lib/generated/intl/messages_zh_Hant.dart
Normal file
76
lib/generated/intl/messages_zh_Hant.dart
Normal file
@@ -0,0 +1,76 @@
|
||||
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
|
||||
// This is a library that provides messages for a zh_Hant 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_Hant';
|
||||
|
||||
static String m0(time, reason, location) =>
|
||||
"跌倒時間: ${time}\n跌倒原因: ${reason},\n跌倒地點: ${location}\n";
|
||||
|
||||
static String m1(location) => "跌倒地點: ${location}";
|
||||
|
||||
static String m2(reason) => "跌倒原因: ${reason}";
|
||||
|
||||
static String m3(time) => "跌倒時間: ${time}";
|
||||
|
||||
static String m4(displayIndex) => "編號: ${displayIndex}";
|
||||
|
||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
|
||||
"account_setting": MessageLookupByLibrary.simpleMessage("帳號設定"),
|
||||
"additional_information": MessageLookupByLibrary.simpleMessage("知識補充"),
|
||||
"address": MessageLookupByLibrary.simpleMessage("地址"),
|
||||
"basic_information_setting":
|
||||
MessageLookupByLibrary.simpleMessage("基本資料"),
|
||||
"call_phone": MessageLookupByLibrary.simpleMessage("撥打電話"),
|
||||
"cancel": MessageLookupByLibrary.simpleMessage("取消"),
|
||||
"confirm": MessageLookupByLibrary.simpleMessage("確認"),
|
||||
"edit": MessageLookupByLibrary.simpleMessage("修改資料"),
|
||||
"email": MessageLookupByLibrary.simpleMessage("電子信箱"),
|
||||
"email_label": MessageLookupByLibrary.simpleMessage("電子信箱/帳號"),
|
||||
"fall_detail": m0,
|
||||
"fall_detail_location": m1,
|
||||
"fall_detail_reason": m2,
|
||||
"fall_detail_time": m3,
|
||||
"fall_detail_title": MessageLookupByLibrary.simpleMessage("詳細資料"),
|
||||
"fall_id": m4,
|
||||
"fall_record": MessageLookupByLibrary.simpleMessage("跌倒紀錄"),
|
||||
"fall_record_empty": MessageLookupByLibrary.simpleMessage("尚無跌倒紀錄"),
|
||||
"forgot_password": MessageLookupByLibrary.simpleMessage("忘記密碼"),
|
||||
"gender": MessageLookupByLibrary.simpleMessage("性別"),
|
||||
"home": MessageLookupByLibrary.simpleMessage("首頁"),
|
||||
"language_alert": MessageLookupByLibrary.simpleMessage(
|
||||
"跳轉回首頁以完成語言設定,否則會有部分語言無法即時更新!"),
|
||||
"language_alert_android": MessageLookupByLibrary.simpleMessage(
|
||||
"重新開啟APP以完成語言設定,否則會有部分語言無法即時更新!"),
|
||||
"language_setting": MessageLookupByLibrary.simpleMessage("語言設定"),
|
||||
"language_setting_alert_title":
|
||||
MessageLookupByLibrary.simpleMessage("語言設定"),
|
||||
"login_button": MessageLookupByLibrary.simpleMessage("登入"),
|
||||
"logout_button": MessageLookupByLibrary.simpleMessage("登出"),
|
||||
"name": MessageLookupByLibrary.simpleMessage("姓名"),
|
||||
"password_label": MessageLookupByLibrary.simpleMessage("密碼"),
|
||||
"personal_information": MessageLookupByLibrary.simpleMessage("個人資料"),
|
||||
"phone": MessageLookupByLibrary.simpleMessage("電話"),
|
||||
"realtime_video": MessageLookupByLibrary.simpleMessage("即時畫面"),
|
||||
"register_button": MessageLookupByLibrary.simpleMessage("立即註冊"),
|
||||
"save": MessageLookupByLibrary.simpleMessage("儲存變更"),
|
||||
"switch_camera": MessageLookupByLibrary.simpleMessage("切換畫面")
|
||||
};
|
||||
}
|
||||
429
lib/generated/l10n.dart
Normal file
429
lib/generated/l10n.dart
Normal file
@@ -0,0 +1,429 @@
|
||||
// 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);
|
||||
}
|
||||
|
||||
/// `Email/Username`
|
||||
String get email_label {
|
||||
return Intl.message(
|
||||
'Email/Username',
|
||||
name: 'email_label',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Password`
|
||||
String get password_label {
|
||||
return Intl.message(
|
||||
'Password',
|
||||
name: 'password_label',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Login`
|
||||
String get login_button {
|
||||
return Intl.message(
|
||||
'Login',
|
||||
name: 'login_button',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Logout`
|
||||
String get logout_button {
|
||||
return Intl.message(
|
||||
'Logout',
|
||||
name: 'logout_button',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Register`
|
||||
String get register_button {
|
||||
return Intl.message(
|
||||
'Register',
|
||||
name: 'register_button',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Forgot password`
|
||||
String get forgot_password {
|
||||
return Intl.message(
|
||||
'Forgot password',
|
||||
name: 'forgot_password',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Live View`
|
||||
String get realtime_video {
|
||||
return Intl.message(
|
||||
'Live View',
|
||||
name: 'realtime_video',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Fall Record`
|
||||
String get fall_record {
|
||||
return Intl.message(
|
||||
'Fall Record',
|
||||
name: 'fall_record',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Switch View`
|
||||
String get switch_camera {
|
||||
return Intl.message(
|
||||
'Switch View',
|
||||
name: 'switch_camera',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Knowledge`
|
||||
String get additional_information {
|
||||
return Intl.message(
|
||||
'Knowledge',
|
||||
name: 'additional_information',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Profile`
|
||||
String get personal_information {
|
||||
return Intl.message(
|
||||
'Profile',
|
||||
name: 'personal_information',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Home`
|
||||
String get home {
|
||||
return Intl.message(
|
||||
'Home',
|
||||
name: 'home',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Basic Information`
|
||||
String get basic_information_setting {
|
||||
return Intl.message(
|
||||
'Basic Information',
|
||||
name: 'basic_information_setting',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Account`
|
||||
String get account_setting {
|
||||
return Intl.message(
|
||||
'Account',
|
||||
name: 'account_setting',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Language`
|
||||
String get language_setting {
|
||||
return Intl.message(
|
||||
'Language',
|
||||
name: 'language_setting',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Call Emergency Phone`
|
||||
String get call_phone {
|
||||
return Intl.message(
|
||||
'Call Emergency Phone',
|
||||
name: 'call_phone',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Name`
|
||||
String get name {
|
||||
return Intl.message(
|
||||
'Name',
|
||||
name: 'name',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Phone Number`
|
||||
String get phone {
|
||||
return Intl.message(
|
||||
'Phone Number',
|
||||
name: 'phone',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Gender`
|
||||
String get gender {
|
||||
return Intl.message(
|
||||
'Gender',
|
||||
name: 'gender',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Address`
|
||||
String get address {
|
||||
return Intl.message(
|
||||
'Address',
|
||||
name: 'address',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Edit`
|
||||
String get edit {
|
||||
return Intl.message(
|
||||
'Edit',
|
||||
name: 'edit',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Save`
|
||||
String get save {
|
||||
return Intl.message(
|
||||
'Save',
|
||||
name: 'save',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Email`
|
||||
String get email {
|
||||
return Intl.message(
|
||||
'Email',
|
||||
name: 'email',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `ID: {displayIndex}`
|
||||
String fall_id(Object displayIndex) {
|
||||
return Intl.message(
|
||||
'ID: $displayIndex',
|
||||
name: 'fall_id',
|
||||
desc: '',
|
||||
args: [displayIndex],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Time: {time}\nReason: {reason},\nLocation: {location}\n`
|
||||
String fall_detail(Object time, Object reason, Object location) {
|
||||
return Intl.message(
|
||||
'Time: $time\nReason: $reason,\nLocation: $location\n',
|
||||
name: 'fall_detail',
|
||||
desc: '',
|
||||
args: [time, reason, location],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Fall Detail`
|
||||
String get fall_detail_title {
|
||||
return Intl.message(
|
||||
'Fall Detail',
|
||||
name: 'fall_detail_title',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Reason: {reason}`
|
||||
String fall_detail_reason(Object reason) {
|
||||
return Intl.message(
|
||||
'Reason: $reason',
|
||||
name: 'fall_detail_reason',
|
||||
desc: '',
|
||||
args: [reason],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Location: {location}`
|
||||
String fall_detail_location(Object location) {
|
||||
return Intl.message(
|
||||
'Location: $location',
|
||||
name: 'fall_detail_location',
|
||||
desc: '',
|
||||
args: [location],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Time: {time}`
|
||||
String fall_detail_time(Object time) {
|
||||
return Intl.message(
|
||||
'Time: $time',
|
||||
name: 'fall_detail_time',
|
||||
desc: '',
|
||||
args: [time],
|
||||
);
|
||||
}
|
||||
|
||||
/// `No fall record`
|
||||
String get fall_record_empty {
|
||||
return Intl.message(
|
||||
'No fall record',
|
||||
name: 'fall_record_empty',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Language Setting`
|
||||
String get language_setting_alert_title {
|
||||
return Intl.message(
|
||||
'Language Setting',
|
||||
name: 'language_setting_alert_title',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Return to the home page to complete the language setting(Confirm to redirect), otherwise some languages will not be updated in real time!`
|
||||
String get language_alert {
|
||||
return Intl.message(
|
||||
'Return to the home page to complete the language setting(Confirm to redirect), otherwise some languages will not be updated in real time!',
|
||||
name: 'language_alert',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Reopen the APP to complete the language setting, otherwise some languages will not be updated in real time!`
|
||||
String get language_alert_android {
|
||||
return Intl.message(
|
||||
'Reopen the APP to complete the language setting, otherwise some languages will not be updated in real time!',
|
||||
name: 'language_alert_android',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Cancel`
|
||||
String get cancel {
|
||||
return Intl.message(
|
||||
'Cancel',
|
||||
name: 'cancel',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Confirm`
|
||||
String get confirm {
|
||||
return Intl.message(
|
||||
'Confirm',
|
||||
name: 'confirm',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
|
||||
const AppLocalizationDelegate();
|
||||
|
||||
List<Locale> get supportedLocales {
|
||||
return const <Locale>[
|
||||
Locale.fromSubtags(languageCode: 'en'),
|
||||
Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant'),
|
||||
];
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user