@@ -62,15 +62,17 @@ import 'app_localizations_es.dart' deferred as app_localizations_es;
6262/// be consistent with the languages listed in the AppLocalizations.supportedLocales
6363/// property.
6464abstract class AppLocalizations {
65- AppLocalizations (String locale) : localeName = intl.Intl .canonicalizedLocale (locale.toString ());
65+ AppLocalizations (String locale)
66+ : localeName = intl.Intl .canonicalizedLocale (locale.toString ());
6667
6768 final String localeName;
6869
6970 static AppLocalizations ? of (BuildContext context) {
7071 return Localizations .of <AppLocalizations >(context, AppLocalizations );
7172 }
7273
73- static const LocalizationsDelegate <AppLocalizations > delegate = _AppLocalizationsDelegate ();
74+ static const LocalizationsDelegate <AppLocalizations > delegate =
75+ _AppLocalizationsDelegate ();
7476
7577 /// A list of this localizations delegate along with the default localizations
7678 /// delegates.
@@ -82,18 +84,19 @@ abstract class AppLocalizations {
8284 /// Additional delegates can be added by appending to this list in
8385 /// MaterialApp. This list does not have to be used at all if a custom list
8486 /// of delegates is preferred or required.
85- static const List <LocalizationsDelegate <dynamic >> localizationsDelegates = < LocalizationsDelegate <dynamic >> [
86- delegate,
87- GlobalMaterialLocalizations .delegate,
88- GlobalCupertinoLocalizations .delegate,
89- GlobalWidgetsLocalizations .delegate,
90- ];
87+ static const List <LocalizationsDelegate <dynamic >> localizationsDelegates =
88+ < LocalizationsDelegate <dynamic >> [
89+ delegate,
90+ GlobalMaterialLocalizations .delegate,
91+ GlobalCupertinoLocalizations .delegate,
92+ GlobalWidgetsLocalizations .delegate,
93+ ];
9194
9295 /// A list of this localizations delegate's supported locales.
9396 static const List <Locale > supportedLocales = < Locale > [
9497 Locale ('en' ),
9598 Locale ('ar' ),
96- Locale ('es' )
99+ Locale ('es' ),
97100 ];
98101
99102 /// The title of the application
@@ -577,7 +580,8 @@ abstract class AppLocalizations {
577580 String incorrectPinThrottleError (String waitTime);
578581}
579582
580- class _AppLocalizationsDelegate extends LocalizationsDelegate <AppLocalizations > {
583+ class _AppLocalizationsDelegate
584+ extends LocalizationsDelegate <AppLocalizations > {
581585 const _AppLocalizationsDelegate ();
582586
583587 @override
@@ -586,26 +590,34 @@ class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations>
586590 }
587591
588592 @override
589- bool isSupported (Locale locale) => < String > ['ar' , 'en' , 'es' ].contains (locale.languageCode);
593+ bool isSupported (Locale locale) =>
594+ < String > ['ar' , 'en' , 'es' ].contains (locale.languageCode);
590595
591596 @override
592597 bool shouldReload (_AppLocalizationsDelegate old) => false ;
593598}
594599
595600Future <AppLocalizations > lookupAppLocalizations (Locale locale) {
596-
597-
598601 // Lookup logic when only language code is specified.
599602 switch (locale.languageCode) {
600- case 'ar' : return app_localizations_ar.loadLibrary ().then ((dynamic _) => app_localizations_ar.AppLocalizationsAr ());
601- case 'en' : return app_localizations_en.loadLibrary ().then ((dynamic _) => app_localizations_en.AppLocalizationsEn ());
602- case 'es' : return app_localizations_es.loadLibrary ().then ((dynamic _) => app_localizations_es.AppLocalizationsEs ());
603+ case 'ar' :
604+ return app_localizations_ar.loadLibrary ().then (
605+ (dynamic _) => app_localizations_ar.AppLocalizationsAr (),
606+ );
607+ case 'en' :
608+ return app_localizations_en.loadLibrary ().then (
609+ (dynamic _) => app_localizations_en.AppLocalizationsEn (),
610+ );
611+ case 'es' :
612+ return app_localizations_es.loadLibrary ().then (
613+ (dynamic _) => app_localizations_es.AppLocalizationsEs (),
614+ );
603615 }
604616
605617 throw FlutterError (
606618 'AppLocalizations.delegate failed to load unsupported locale "$locale ". This is likely '
607619 'an issue with the localizations generation tool. Please file an issue '
608620 'on GitHub with a reproducible sample app and the gen-l10n configuration '
609- 'that was used.'
621+ 'that was used.' ,
610622 );
611623}
0 commit comments