Cupertino localization step 1: add an English arb file (#29200)
This commit is contained in:
parent
0067efca61
commit
fa149eea9b
@ -570,7 +570,7 @@ void processBundle(File file, { @required String localeString }) {
|
||||
// Only pre-assume scriptCode if there is a country or script code to assume off of.
|
||||
// When we assume scriptCode based on languageCode-only, we want this initial pass
|
||||
// to use the un-assumed version as a base class.
|
||||
LocaleInfo locale = LocaleInfo.fromString(localeString, assume: localeString.split('_').length > 1);
|
||||
LocaleInfo locale = LocaleInfo.fromString(localeString, deriveScriptCode: localeString.split('_').length > 1);
|
||||
// Allow overwrite if the existing data is assumed.
|
||||
if (assumedLocales.contains(locale)) {
|
||||
localeToResources[locale] = <String, String>{};
|
||||
@ -582,7 +582,7 @@ void processBundle(File file, { @required String localeString }) {
|
||||
}
|
||||
populateResources(locale);
|
||||
// Add an assumed locale to default to when there is no info on scriptOnly locales.
|
||||
locale = LocaleInfo.fromString(localeString, assume: true);
|
||||
locale = LocaleInfo.fromString(localeString, deriveScriptCode: true);
|
||||
if (locale.scriptCode != null) {
|
||||
final LocaleInfo scriptLocale = LocaleInfo.fromString(locale.languageCode + '_' + locale.scriptCode);
|
||||
if (!localeToResources.containsKey(scriptLocale)) {
|
||||
|
@ -24,7 +24,10 @@ class LocaleInfo implements Comparable<LocaleInfo> {
|
||||
/// and country is 2-3 characters and all uppercase.
|
||||
///
|
||||
/// 'language_COUNTRY' or 'language_script' are also valid. Missing fields will be null.
|
||||
factory LocaleInfo.fromString(String locale, {bool assume = false}) {
|
||||
///
|
||||
/// When `deriveScriptCode` is true, if [scriptCode] was unspecified, it will
|
||||
/// be derived from the [languageCode] and [countryCode] if possible.
|
||||
factory LocaleInfo.fromString(String locale, { bool deriveScriptCode = false }) {
|
||||
final List<String> codes = locale.split('_'); // [language, script, country]
|
||||
assert(codes.isNotEmpty && codes.length < 4);
|
||||
final String languageCode = codes[0];
|
||||
@ -49,7 +52,7 @@ class LocaleInfo implements Comparable<LocaleInfo> {
|
||||
/// The basis of the assumptions here are based off of known usage of scripts
|
||||
/// across various countries. For example, we know Taiwan uses traditional (Hant)
|
||||
/// script, so it is safe to apply (Hant) to Taiwanese languages.
|
||||
if (assume && scriptCode == null) {
|
||||
if (deriveScriptCode && scriptCode == null) {
|
||||
switch (languageCode) {
|
||||
case 'zh': {
|
||||
if (countryCode == null) {
|
||||
|
@ -65,6 +65,7 @@ abstract class CupertinoLocalizations {
|
||||
///
|
||||
/// - US English: 2018
|
||||
/// - Korean: 2018년
|
||||
// The global version uses date symbols data from the intl package.
|
||||
String datePickerYear(int yearIndex);
|
||||
|
||||
/// Month that is shown in [CupertinoDatePicker] spinner corresponding to
|
||||
@ -74,6 +75,7 @@ abstract class CupertinoLocalizations {
|
||||
///
|
||||
/// - US English: January
|
||||
/// - Korean: 1월
|
||||
// The global version uses date symbols data from the intl package.
|
||||
String datePickerMonth(int monthIndex);
|
||||
|
||||
/// Day of month that is shown in [CupertinoDatePicker] spinner corresponding
|
||||
@ -83,6 +85,7 @@ abstract class CupertinoLocalizations {
|
||||
///
|
||||
/// - US English: 1
|
||||
/// - Korean: 1일
|
||||
// The global version uses date symbols data from the intl package.
|
||||
String datePickerDayOfMonth(int dayIndex);
|
||||
|
||||
/// The medium-width date format that is shown in [CupertinoDatePicker]
|
||||
@ -92,6 +95,7 @@ abstract class CupertinoLocalizations {
|
||||
///
|
||||
/// - US English: Wed Sep 27
|
||||
/// - Russian: ср сент. 27
|
||||
// The global version is based on intl package's DateFormat.MMMEd.
|
||||
String datePickerMediumDate(DateTime date);
|
||||
|
||||
/// Hour that is shown in [CupertinoDatePicker] spinner corresponding
|
||||
@ -101,9 +105,11 @@ abstract class CupertinoLocalizations {
|
||||
///
|
||||
/// - US English: 1
|
||||
/// - Arabic: ٠١
|
||||
// The global version uses date symbols data from the intl package.
|
||||
String datePickerHour(int hour);
|
||||
|
||||
/// Semantics label for the given hour value in [CupertinoDatePicker].
|
||||
// The global version uses the translated string from the arb file.
|
||||
String datePickerHourSemanticsLabel(int hour);
|
||||
|
||||
/// Minute that is shown in [CupertinoDatePicker] spinner corresponding
|
||||
@ -113,24 +119,31 @@ abstract class CupertinoLocalizations {
|
||||
///
|
||||
/// - US English: 01
|
||||
/// - Arabic: ٠١
|
||||
// The global version uses date symbols data from the intl package.
|
||||
String datePickerMinute(int minute);
|
||||
|
||||
/// Semantics label for the given minute value in [CupertinoDatePicker].
|
||||
// The global version uses the translated string from the arb file.
|
||||
String datePickerMinuteSemanticsLabel(int minute);
|
||||
|
||||
/// The order of the date elements that will be shown in [CupertinoDatePicker].
|
||||
// The global version uses the translated string from the arb file.
|
||||
DatePickerDateOrder get datePickerDateOrder;
|
||||
|
||||
/// The order of the time elements that will be shown in [CupertinoDatePicker].
|
||||
// The global version uses the translated string from the arb file.
|
||||
DatePickerDateTimeOrder get datePickerDateTimeOrder;
|
||||
|
||||
/// The abbreviation for ante meridiem (before noon) shown in the time picker.
|
||||
// The global version uses the translated string from the arb file.
|
||||
String get anteMeridiemAbbreviation;
|
||||
|
||||
/// The abbreviation for post meridiem (after noon) shown in the time picker.
|
||||
// The global version uses the translated string from the arb file.
|
||||
String get postMeridiemAbbreviation;
|
||||
|
||||
/// The term used by the system to announce dialog alerts.
|
||||
// The global version uses the translated string from the arb file.
|
||||
String get alertDialogLabel;
|
||||
|
||||
/// Hour that is shown in [CupertinoTimerPicker] corresponding to
|
||||
@ -140,6 +153,7 @@ abstract class CupertinoLocalizations {
|
||||
///
|
||||
/// - US English: 1
|
||||
/// - Arabic: ١
|
||||
// The global version uses date symbols data from the intl package.
|
||||
String timerPickerHour(int hour);
|
||||
|
||||
/// Minute that is shown in [CupertinoTimerPicker] corresponding to
|
||||
@ -149,6 +163,7 @@ abstract class CupertinoLocalizations {
|
||||
///
|
||||
/// - US English: 1
|
||||
/// - Arabic: ١
|
||||
// The global version uses date symbols data from the intl package.
|
||||
String timerPickerMinute(int minute);
|
||||
|
||||
/// Second that is shown in [CupertinoTimerPicker] corresponding to
|
||||
@ -158,33 +173,41 @@ abstract class CupertinoLocalizations {
|
||||
///
|
||||
/// - US English: 1
|
||||
/// - Arabic: ١
|
||||
// The global version uses date symbols data from the intl package.
|
||||
String timerPickerSecond(int second);
|
||||
|
||||
/// Label that appears next to the hour picker in
|
||||
/// [CupertinoTimerPicker] when selected hour value is `hour`.
|
||||
/// This function will deal with pluralization based on the `hour` parameter.
|
||||
// The global version uses the translated string from the arb file.
|
||||
String timerPickerHourLabel(int hour);
|
||||
|
||||
/// Label that appears next to the minute picker in
|
||||
/// [CupertinoTimerPicker] when selected minute value is `minute`.
|
||||
/// This function will deal with pluralization based on the `minute` parameter.
|
||||
// The global version uses the translated string from the arb file.
|
||||
String timerPickerMinuteLabel(int minute);
|
||||
|
||||
/// Label that appears next to the minute picker in
|
||||
/// [CupertinoTimerPicker] when selected minute value is `second`.
|
||||
/// This function will deal with pluralization based on the `second` parameter.
|
||||
// The global version uses the translated string from the arb file.
|
||||
String timerPickerSecondLabel(int second);
|
||||
|
||||
/// The term used for cutting
|
||||
// The global version uses the translated string from the arb file.
|
||||
String get cutButtonLabel;
|
||||
|
||||
/// The term used for copying
|
||||
// The global version uses the translated string from the arb file.
|
||||
String get copyButtonLabel;
|
||||
|
||||
/// The term used for pasting
|
||||
// The global version uses the translated string from the arb file.
|
||||
String get pasteButtonLabel;
|
||||
|
||||
/// The term used for selecting everything
|
||||
// The global version uses the translated string from the arb file.
|
||||
String get selectAllButtonLabel;
|
||||
|
||||
/// The `CupertinoLocalizations` from the closest [Localizations] instance
|
||||
|
77
packages/flutter_localizations/lib/src/l10n/cupertino_en.arb
Normal file
77
packages/flutter_localizations/lib/src/l10n/cupertino_en.arb
Normal file
@ -0,0 +1,77 @@
|
||||
{
|
||||
"datePickerHourSemanticsLabelOther": "$hour o'clock",
|
||||
"@datePickerHourSemanticsLabel": {
|
||||
"description": "Accessibility announcement for the selected hour on a time picker such as '5 o'clock' or '5点'",
|
||||
"plural": "hour"
|
||||
},
|
||||
|
||||
"datePickerMinuteSemanticsOne": "1 minute",
|
||||
"datePickerMinuteSemanticsOther": "$minute minutes",
|
||||
"@datePickerMinuteSemanticsLabel": {
|
||||
"description": "Accessibility announcement for the selected minute on a time picker such as '15 minutes' or '15分'",
|
||||
"plural": "minute"
|
||||
},
|
||||
|
||||
"datePickerDateOrder": "mdy",
|
||||
"@datePickerDateOrder": {
|
||||
"description": "The standard order for the locale to arrange day, month and year in a date. Options are dmy, mdy, ymd and ydm.",
|
||||
},
|
||||
|
||||
"datePickerDateTimeOrder": "date_time_dayPeriod",
|
||||
"@datePickerDateTimeOrder": {
|
||||
"description": "The standard order for the locale to date, time and am/pm in a datetime. Options are date_time_dayPeriod, date_dayPeriod_time, time_dayPeriod_date and dayPeriod_time_date where 'dayPeriod' is am/pm.",
|
||||
},
|
||||
|
||||
"anteMeridiemAbbreviation": "AM",
|
||||
"@anteMeridiemAbbreviation": {
|
||||
"description": "The abbreviation for ante meridiem (before noon) shown in the time picker.",
|
||||
},
|
||||
|
||||
"postMeridiemAbbreviation": "PM",
|
||||
"@postMeridiemAbbreviation": {
|
||||
"description": "The abbreviation for post meridiem (after noon) shown in the time picker.",
|
||||
},
|
||||
|
||||
"alertDialogLabel": "Alert",
|
||||
"@alertDialogLabel": {
|
||||
"description": "The accessibility audio announcement made when an iOS style alert dialog is opened."
|
||||
},
|
||||
|
||||
"timerPickerHourLabelOne": "hour",
|
||||
"timerPickerHourLabelOther": "hours",
|
||||
"@timerPickerHourLabel": {
|
||||
"description": "The label adjacent to an hour integer number in a countdown timer.",
|
||||
"plural": "hour"
|
||||
},
|
||||
|
||||
"timerPickerMinuteLabelOther": "min",
|
||||
"@timerPickerMinuteLabel": {
|
||||
"description": "The label adjacent to a minute integer number in a countdown timer.",
|
||||
"plural": "minute"
|
||||
},
|
||||
|
||||
"timerPickerSecondLabelOther": "sec",
|
||||
"@timerPickerSecondLabel": {
|
||||
"description": "The label adjacent to a second integer number in a countdown timer.",
|
||||
"plural": "second"
|
||||
},
|
||||
|
||||
"cutButtonLabel": "Cut",
|
||||
"@cutButtonLabel": {
|
||||
"description": "The label for cut buttons and menu items."
|
||||
},
|
||||
|
||||
"copyButtonLabel": "Copy",
|
||||
"@copyButtonLabel": {
|
||||
"description": "The label for copy buttons and menu items."
|
||||
},
|
||||
|
||||
"pasteButtonLabel": "Paste",
|
||||
"@pasteButtonLabel": {
|
||||
"description": "The label for paste buttons and menu items."
|
||||
},
|
||||
|
||||
"selectAllButtonLabel": "Select All",
|
||||
"@selectAllButtonLabel": {
|
||||
"description": "The label for select-all buttons and menu items."
|
||||
},
|
Loading…
x
Reference in New Issue
Block a user