Use correct locale for CupertinoDatePicker weekday (#151494)
#120052 introduces the `showDayOfWeek` flag to `CupertinoDatePicker` for mode `CupertinoDatePickerMode.date`, but the default `en` locale from `DefaultCupertinoLocalizations` is always used for the day of the week:
5103d75743/packages/flutter_localizations/lib/src/cupertino_localizations.dart (L116-L119)
This PR introduces a new `intl.DateFormat` `weekdayFormat` to replace the default with the abbreviated weekday for any supported locales.
| Before | After |
| --- | --- |
| <img width="379" alt="Screenshot 2024-07-09 at 5 08 43â¯PM" src="https://github.com/flutter/flutter/assets/77553258/d6899c6b-bd0a-4484-a6a8-3ef1512aeae1"> | <img width="379" alt="Screenshot 2024-07-09 at 5 08 11â¯PM" src="https://github.com/flutter/flutter/assets/77553258/f320c634-80d1-4f3b-adfd-ed85a9dfc3f6"> |
Fixes #141875
This commit is contained in:
@@ -41,6 +41,7 @@ String generateCupertinoConstructor(LocaleInfo locale) {
|
||||
super.localeName = '$localeName',
|
||||
required super.fullYearFormat,
|
||||
required super.dayFormat,
|
||||
required super.weekdayFormat,
|
||||
required super.mediumDateFormat,
|
||||
required super.singleDigitHourFormat,
|
||||
required super.singleDigitMinuteFormat,
|
||||
@@ -57,6 +58,7 @@ GlobalCupertinoLocalizations? getCupertinoTranslation(
|
||||
Locale locale,
|
||||
intl.DateFormat fullYearFormat,
|
||||
intl.DateFormat dayFormat,
|
||||
intl.DateFormat weekdayFormat,
|
||||
intl.DateFormat mediumDateFormat,
|
||||
intl.DateFormat singleDigitHourFormat,
|
||||
intl.DateFormat singleDigitMinuteFormat,
|
||||
@@ -66,7 +68,7 @@ GlobalCupertinoLocalizations? getCupertinoTranslation(
|
||||
) {''';
|
||||
|
||||
const String cupertinoFactoryArguments =
|
||||
'fullYearFormat: fullYearFormat, dayFormat: dayFormat, mediumDateFormat: mediumDateFormat, singleDigitHourFormat: singleDigitHourFormat, singleDigitMinuteFormat: singleDigitMinuteFormat, doubleDigitMinuteFormat: doubleDigitMinuteFormat, singleDigitSecondFormat: singleDigitSecondFormat, decimalFormat: decimalFormat';
|
||||
'fullYearFormat: fullYearFormat, dayFormat: dayFormat, weekdayFormat: weekdayFormat, mediumDateFormat: mediumDateFormat, singleDigitHourFormat: singleDigitHourFormat, singleDigitMinuteFormat: singleDigitMinuteFormat, doubleDigitMinuteFormat: doubleDigitMinuteFormat, singleDigitSecondFormat: singleDigitSecondFormat, decimalFormat: decimalFormat';
|
||||
|
||||
const String cupertinoSupportedLanguagesConstant = 'kCupertinoSupportedLanguages';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user