@@ -1014,51 +1014,6 @@ flutter:
10141014 expect (generator.supportedLocales.contains (LocaleInfo .fromString ('zh' )), true );
10151015 });
10161016
1017- testWithoutContext ('correctly requires @@locale property in arb file to match the filename locale suffix' , () {
1018- const String arbFileWithEnLocale = '''
1019- {
1020- "@@locale": "en",
1021- "title": "Stocks",
1022- "@title": {
1023- "description": "Title for the Stocks application"
1024- }
1025- }''' ;
1026-
1027- const String arbFileWithZhLocale = '''
1028- {
1029- "@@locale": "zh",
1030- "title": "标题",
1031- "@title": {
1032- "description": "Title for the Stocks application"
1033- }
1034- }''' ;
1035-
1036- final Directory l10nDirectory = fs.currentDirectory.childDirectory ('lib' ).childDirectory ('l10n' )
1037- ..createSync (recursive: true );
1038- l10nDirectory.childFile ('app_es.arb' )
1039- .writeAsStringSync (arbFileWithEnLocale);
1040- l10nDirectory.childFile ('app_am.arb' )
1041- .writeAsStringSync (arbFileWithZhLocale);
1042-
1043- expect (
1044- () {
1045- LocalizationsGenerator (
1046- fileSystem: fs,
1047- inputPathString: defaultL10nPathString,
1048- outputPathString: defaultL10nPathString,
1049- templateArbFileName: 'app_es.arb' ,
1050- outputFileString: defaultOutputFileString,
1051- classNameString: defaultClassNameString,
1052- ).loadResources ();
1053- },
1054- throwsA (isA <L10nException >().having (
1055- (L10nException e) => e.message,
1056- 'message' ,
1057- contains ('The locale specified in @@locale and the arb filename do not match.' ),
1058- )),
1059- );
1060- });
1061-
10621017 testWithoutContext ("throws when arb file's locale could not be determined" , () {
10631018 fs.currentDirectory.childDirectory ('lib' ).childDirectory ('l10n' )
10641019 ..createSync (recursive: true )
@@ -1117,30 +1072,6 @@ flutter:
11171072 );
11181073 });
11191074
1120- testWithoutContext ('throws when the base locale does not exist' , () {
1121- final Directory l10nDirectory = fs.currentDirectory.childDirectory ('lib' ).childDirectory ('l10n' )
1122- ..createSync (recursive: true );
1123- l10nDirectory.childFile ('app_en_US.arb' )
1124- .writeAsStringSync (singleMessageArbFileString);
1125-
1126- expect (
1127- () {
1128- LocalizationsGenerator (
1129- fileSystem: fs,
1130- inputPathString: defaultL10nPathString,
1131- outputPathString: defaultL10nPathString,
1132- templateArbFileName: 'app_en_US.arb' ,
1133- outputFileString: defaultOutputFileString,
1134- classNameString: defaultClassNameString,
1135- ).loadResources ();
1136- },
1137- throwsA (isA <L10nException >().having (
1138- (L10nException e) => e.message,
1139- 'message' ,
1140- contains ('Arb file for a fallback, en, does not exist' ),
1141- )),
1142- );
1143- });
11441075 });
11451076
11461077 group ('writeOutputFiles' , () {
@@ -1262,7 +1193,7 @@ flutter:
12621193 /// **'The price of this item is: \${price}'**''' ));
12631194 });
12641195
1265- testWithoutContext ('should generate a file per language ' , () {
1196+ testWithoutContext ('should generate a file per arb ' , () {
12661197 const String singleEnCaMessageArbFileString = '''
12671198{
12681199 "title": "Canadian Title"
@@ -1283,13 +1214,8 @@ flutter:
12831214 ..writeOutputFiles (BufferLogger .test ());
12841215
12851216 expect (fs.isFileSync (fs.path.join (syntheticL10nPackagePath, 'output-localization-file_en.dart' )), true );
1217+ expect (fs.isFileSync (fs.path.join (syntheticL10nPackagePath, 'output-localization-file_en_CA.dart' )), true );
12861218 expect (fs.isFileSync (fs.path.join (syntheticL10nPackagePath, 'output-localization-file_en_US.dart' )), false );
1287-
1288- final String englishLocalizationsFile = fs.file (
1289- fs.path.join (syntheticL10nPackagePath, 'output-localization-file_en.dart' )
1290- ).readAsStringSync ();
1291- expect (englishLocalizationsFile, contains ('class AppLocalizationsEnCa extends AppLocalizationsEn' ));
1292- expect (englishLocalizationsFile, contains ('class AppLocalizationsEn extends AppLocalizations' ));
12931219 });
12941220
12951221 testWithoutContext ('language imports are sorted when preferredSupportedLocaleString is given' , () {
0 commit comments