Cupertino localization step 1: add an English arb file (#29200)
diff --git a/dev/tools/gen_localizations.dart b/dev/tools/gen_localizations.dart
index 87459dc..8b3007b 100644
--- a/dev/tools/gen_localizations.dart
+++ b/dev/tools/gen_localizations.dart
@@ -570,7 +570,7 @@
// 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 @@
}
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)) {
diff --git a/dev/tools/localizations_utils.dart b/dev/tools/localizations_utils.dart
index 512bf61..d92fad9 100644
--- a/dev/tools/localizations_utils.dart
+++ b/dev/tools/localizations_utils.dart
@@ -24,7 +24,10 @@
/// 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 @@
/// 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) {
diff --git a/packages/flutter/lib/src/cupertino/localizations.dart b/packages/flutter/lib/src/cupertino/localizations.dart
index 8ac0484..42e412e 100644
--- a/packages/flutter/lib/src/cupertino/localizations.dart
+++ b/packages/flutter/lib/src/cupertino/localizations.dart
@@ -65,6 +65,7 @@
///
/// - 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 @@
///
/// - 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 @@
///
/// - 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 @@
///
/// - 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 @@
///
/// - 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 @@
///
/// - 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 @@
///
/// - 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 @@
///
/// - 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 @@
///
/// - 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
diff --git a/packages/flutter_localizations/lib/src/l10n/cupertino_en.arb b/packages/flutter_localizations/lib/src/l10n/cupertino_en.arb
new file mode 100644
index 0000000..3bd85ed
--- /dev/null
+++ b/packages/flutter_localizations/lib/src/l10n/cupertino_en.arb
@@ -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."
+ },