cashier_reserve_app/lib/common/local/cupertino_localizations_del...

183 lines
4.8 KiB
Dart

import 'package:flutter/foundation.dart' show SynchronousFuture;
import 'package:flutter/cupertino.dart';
class CupertinoLocalizationsDelegate
extends LocalizationsDelegate<CupertinoLocalizations> {
const CupertinoLocalizationsDelegate();
@override
bool isSupported(Locale locale) =>
<String>['en', 'zh'].contains(locale.languageCode);
@override
SynchronousFuture<_DefaultCupertinoLocalizations> load(Locale locale) {
return SynchronousFuture<_DefaultCupertinoLocalizations>(
_DefaultCupertinoLocalizations(locale.languageCode));
}
@override
bool shouldReload(CupertinoLocalizationsDelegate old) => false;
}
class _DefaultCupertinoLocalizations extends CupertinoLocalizations {
_DefaultCupertinoLocalizations(this._languageCode);
final DefaultCupertinoLocalizations _en =
const DefaultCupertinoLocalizations();
final String _languageCode;
final Map<String, Map<String, String>> _dict = <String, Map<String, String>>{
'en': <String, String>{
'alert': 'Alert',
'copy': 'Copy',
'paste': 'Paste',
'cut': 'Cut',
'selectAll': 'Select all',
'today': 'today'
},
'zh': <String, String>{
'alert': '警告',
'copy': '复制',
'paste': '粘贴',
'cut': '剪切',
'selectAll': '选择全部',
'today': '今天'
}
};
@override
String get alertDialogLabel => _get('alert')!;
@override
String get anteMeridiemAbbreviation => _en.anteMeridiemAbbreviation;
@override
String get postMeridiemAbbreviation => _en.postMeridiemAbbreviation;
@override
String get copyButtonLabel => _get('copy')!;
@override
String get cutButtonLabel => _get('cut')!;
@override
String get pasteButtonLabel => _get('paste')!;
@override
String get selectAllButtonLabel => _get('selectAll')!;
@override
DatePickerDateOrder get datePickerDateOrder => _en.datePickerDateOrder;
@override
DatePickerDateTimeOrder get datePickerDateTimeOrder =>
_en.datePickerDateTimeOrder;
@override
String datePickerHour(int hour) => _en.datePickerHour(hour);
@override
String datePickerHourSemanticsLabel(int hour) =>
_en.datePickerHourSemanticsLabel(hour);
@override
String datePickerMediumDate(DateTime date) => _en.datePickerMediumDate(date);
@override
String datePickerMinute(int minute) => _en.datePickerMinute(minute);
@override
String datePickerMinuteSemanticsLabel(int minute) =>
_en.datePickerMinuteSemanticsLabel(minute);
@override
String datePickerMonth(int monthIndex) => _en.datePickerMonth(monthIndex);
@override
String datePickerYear(int yearIndex) => _en.datePickerYear(yearIndex);
@override
String timerPickerHour(int hour) => _en.timerPickerHour(hour);
@override
String timerPickerHourLabel(int hour) => _en.timerPickerHourLabel(hour);
@override
String timerPickerMinute(int minute) => _en.timerPickerMinute(minute);
@override
String timerPickerMinuteLabel(int minute) =>
_en.timerPickerMinuteLabel(minute);
@override
String timerPickerSecond(int second) => _en.timerPickerSecond(second);
@override
String timerPickerSecondLabel(int second) =>
_en.timerPickerSecondLabel(second);
String? _get(String key) {
return _dict[_languageCode]![key];
}
@override
String get todayLabel => _get("today")!;
@override
String get modalBarrierDismissLabel => _en.modalBarrierDismissLabel;
@override
String tabSemanticsLabel({required int tabIndex, required int tabCount}) {
return _en.tabSemanticsLabel(tabIndex: tabIndex, tabCount: tabCount);
}
@override
List<String> get timerPickerHourLabels => _en.timerPickerHourLabels;
@override
List<String> get timerPickerMinuteLabels => _en.timerPickerMinuteLabels;
@override
List<String> get timerPickerSecondLabels => _en.timerPickerSecondLabels;
@override
String get searchTextFieldPlaceholderLabel => throw UnimplementedError();
@override
String datePickerDayOfMonth(int dayIndex, [int? weekDay]) {
return _en.datePickerDayOfMonth(dayIndex, weekDay);
}
@override
// TODO: implement noSpellCheckReplacementsLabel
String get noSpellCheckReplacementsLabel => throw UnimplementedError();
@override
String datePickerStandaloneMonth(int monthIndex) {
// TODO: implement datePickerStandaloneMonth
throw UnimplementedError();
}
@override
// TODO: implement lookUpButtonLabel
String get lookUpButtonLabel => throw UnimplementedError();
@override
// TODO: implement menuDismissLabel
String get menuDismissLabel => throw UnimplementedError();
@override
// TODO: implement searchWebButtonLabel
String get searchWebButtonLabel => throw UnimplementedError();
@override
// TODO: implement shareButtonLabel
String get shareButtonLabel => throw UnimplementedError();
@override
// TODO: implement clearButtonLabel
String get clearButtonLabel => throw UnimplementedError();
}