Correct DefaultMaterialLocalizations.delegate supported locales list (#15260)
This commit is contained in:
parent
ea155df91e
commit
f14397ae11
@ -14,6 +14,10 @@ import 'l10n/date_localizations.dart' as date_localizations;
|
|||||||
import 'l10n/localizations.dart' show TranslationBundle, translationBundleForLocale;
|
import 'l10n/localizations.dart' show TranslationBundle, translationBundleForLocale;
|
||||||
import 'widgets_localizations.dart';
|
import 'widgets_localizations.dart';
|
||||||
|
|
||||||
|
// Watch out: the supported locales list in the doc comment below must be kept
|
||||||
|
// in sync with the list we test, see test/translations_test.dart, and of course
|
||||||
|
// the acutal list of supported locales in _MaterialLocalizationsDelegate.
|
||||||
|
|
||||||
/// Localized strings for the material widgets.
|
/// Localized strings for the material widgets.
|
||||||
///
|
///
|
||||||
/// To include the localizations provided by this class in a [MaterialApp],
|
/// To include the localizations provided by this class in a [MaterialApp],
|
||||||
@ -493,22 +497,29 @@ void _loadDateIntlDataIfNotLoaded() {
|
|||||||
class _MaterialLocalizationsDelegate extends LocalizationsDelegate<MaterialLocalizations> {
|
class _MaterialLocalizationsDelegate extends LocalizationsDelegate<MaterialLocalizations> {
|
||||||
const _MaterialLocalizationsDelegate();
|
const _MaterialLocalizationsDelegate();
|
||||||
|
|
||||||
|
// Watch out: this list must match the one in the GlobalMaterialLocalizations
|
||||||
|
// class doc and the list we test, see test/translations_test.dart.
|
||||||
static const List<String> _supportedLanguages = const <String>[
|
static const List<String> _supportedLanguages = const <String>[
|
||||||
'ar', // Arabic
|
'ar', // Arabic
|
||||||
'de', // German
|
'de', // German
|
||||||
'en', // English
|
'en', // English
|
||||||
'es', // Spanish
|
'es', // Spanish
|
||||||
'fa', // Farsi
|
'fa', // Farsi (Persian)
|
||||||
'fr', // French
|
'fr', // French
|
||||||
'he', // Hebrew
|
'he', // Hebrew
|
||||||
'it', // Italian
|
'it', // Italian
|
||||||
'ja', // Japanese
|
'ja', // Japanese
|
||||||
|
'ko', // Korean
|
||||||
|
'nl', // Dutch
|
||||||
|
'pl', // Polish
|
||||||
'ps', // Pashto
|
'ps', // Pashto
|
||||||
'pt', // Portugese
|
'pt', // Portugese
|
||||||
'ro', // Romanian
|
'ro', // Romanian
|
||||||
'ru', // Russian
|
'ru', // Russian
|
||||||
|
'th', // Thai
|
||||||
|
'tr', // Turkish
|
||||||
'ur', // Urdu
|
'ur', // Urdu
|
||||||
'zh', // Simplified Chinese
|
'zh', // Chinese (simplified)
|
||||||
];
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -7,6 +7,8 @@ import 'package:flutter_localizations/flutter_localizations.dart';
|
|||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
// Watch out: this list must be kept in sync with the comment at the top of
|
||||||
|
// GlobalMaterialLocalizations.
|
||||||
final List<String> languages = <String>[
|
final List<String> languages = <String>[
|
||||||
'ar', // Arabic
|
'ar', // Arabic
|
||||||
'de', // German
|
'de', // German
|
||||||
@ -33,6 +35,9 @@ void main() {
|
|||||||
for (String language in languages) {
|
for (String language in languages) {
|
||||||
testWidgets('translations exist for $language', (WidgetTester tester) async {
|
testWidgets('translations exist for $language', (WidgetTester tester) async {
|
||||||
final Locale locale = new Locale(language, '');
|
final Locale locale = new Locale(language, '');
|
||||||
|
|
||||||
|
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
|
||||||
|
|
||||||
final MaterialLocalizations localizations = new GlobalMaterialLocalizations(locale);
|
final MaterialLocalizations localizations = new GlobalMaterialLocalizations(locale);
|
||||||
|
|
||||||
expect(localizations.openAppDrawerTooltip, isNotNull);
|
expect(localizations.openAppDrawerTooltip, isNotNull);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user