@@ -62,17 +62,15 @@ import 'app_localizations_zh.dart';
6262/// be consistent with the languages listed in the AppLocalizations.supportedLocales
6363/// property.
6464abstract class AppLocalizations {
65- AppLocalizations (String locale)
66- : localeName = intl.Intl .canonicalizedLocale (locale.toString ());
65+ AppLocalizations (String locale) : localeName = intl.Intl .canonicalizedLocale (locale.toString ());
6766
6867 final String localeName;
6968
7069 static AppLocalizations ? of (BuildContext context) {
7170 return Localizations .of <AppLocalizations >(context, AppLocalizations );
7271 }
7372
74- static const LocalizationsDelegate <AppLocalizations > delegate =
75- _AppLocalizationsDelegate ();
73+ static const LocalizationsDelegate <AppLocalizations > delegate = _AppLocalizationsDelegate ();
7674
7775 /// A list of this localizations delegate along with the default localizations
7876 /// delegates.
@@ -84,8 +82,7 @@ abstract class AppLocalizations {
8482 /// Additional delegates can be added by appending to this list in
8583 /// MaterialApp. This list does not have to be used at all if a custom list
8684 /// of delegates is preferred or required.
87- static const List <LocalizationsDelegate <dynamic >> localizationsDelegates =
88- < LocalizationsDelegate <dynamic >> [
85+ static const List <LocalizationsDelegate <dynamic >> localizationsDelegates = < LocalizationsDelegate <dynamic >> [
8986 delegate,
9087 GlobalMaterialLocalizations .delegate,
9188 GlobalCupertinoLocalizations .delegate,
@@ -394,8 +391,7 @@ abstract class AppLocalizations {
394391 String get deepCopy;
395392}
396393
397- class _AppLocalizationsDelegate
398- extends LocalizationsDelegate <AppLocalizations > {
394+ class _AppLocalizationsDelegate extends LocalizationsDelegate <AppLocalizations > {
399395 const _AppLocalizationsDelegate ();
400396
401397 @override
@@ -404,37 +400,34 @@ class _AppLocalizationsDelegate
404400 }
405401
406402 @override
407- bool isSupported (Locale locale) =>
408- < String > ['en' , 'zh' ].contains (locale.languageCode);
403+ bool isSupported (Locale locale) => < String > ['en' , 'zh' ].contains (locale.languageCode);
409404
410405 @override
411406 bool shouldReload (_AppLocalizationsDelegate old) => false ;
412407}
413408
414409AppLocalizations lookupAppLocalizations (Locale locale) {
410+
415411 // Lookup logic when language+script codes are specified.
416412 switch (locale.languageCode) {
417- case 'zh' :
418- {
419- switch (locale.scriptCode) {
420- case 'Hant' :
421- return AppLocalizationsZhHant ();
422- }
423- break ;
424- }
413+ case 'zh' : {
414+ switch (locale.scriptCode) {
415+ case 'Hant' : return AppLocalizationsZhHant ();
416+ }
417+ break ;
418+ }
425419 }
426420
427421 // Lookup logic when only language code is specified.
428422 switch (locale.languageCode) {
429- case 'en' :
430- return AppLocalizationsEn ();
431- case 'zh' :
432- return AppLocalizationsZh ();
423+ case 'en' : return AppLocalizationsEn ();
424+ case 'zh' : return AppLocalizationsZh ();
433425 }
434426
435427 throw FlutterError (
436- 'AppLocalizations.delegate failed to load unsupported locale "$locale ". This is likely '
437- 'an issue with the localizations generation tool. Please file an issue '
438- 'on GitHub with a reproducible sample app and the gen-l10n configuration '
439- 'that was used.' );
428+ 'AppLocalizations.delegate failed to load unsupported locale "$locale ". This is likely '
429+ 'an issue with the localizations generation tool. Please file an issue '
430+ 'on GitHub with a reproducible sample app and the gen-l10n configuration '
431+ 'that was used.'
432+ );
440433}
0 commit comments