@@ -68,7 +68,6 @@ Future<void> main(List<String> rawArgs) async {
68
68
final Map <String , File > symbolFiles = _listIntlData (dateSymbolsDirectory);
69
69
final Directory datePatternsDirectory = Directory (path.join (pathToIntl, 'src' , 'data' , 'dates' , 'patterns' ));
70
70
final Map <String , File > patternFiles = _listIntlData (datePatternsDirectory);
71
- final List <String > materialLocales = _materialLocales ().toList ();
72
71
final StringBuffer buffer = StringBuffer ();
73
72
74
73
buffer.writeln (
@@ -88,7 +87,7 @@ Future<void> main(List<String> rawArgs) async {
88
87
/// supported by flutter_localizations.''' );
89
88
buffer.writeln ('const Map<String, dynamic> dateSymbols = <String, dynamic> {' );
90
89
symbolFiles.forEach ((String locale, File data) {
91
- if (materialLocales .contains (locale))
90
+ if (_supportedLocales () .contains (locale))
92
91
buffer.writeln (_jsonToMapEntry (locale, json.decode (data.readAsStringSync ())));
93
92
});
94
93
buffer.writeln ('};' );
@@ -100,7 +99,7 @@ Future<void> main(List<String> rawArgs) async {
100
99
/// supported by flutter_localizations.''' );
101
100
buffer.writeln ('const Map<String, Map<String, String>> datePatterns = <String, Map<String, String>> {' );
102
101
patternFiles.forEach ((String locale, File data) {
103
- if (materialLocales .contains (locale)) {
102
+ if (_supportedLocales () .contains (locale)) {
104
103
final Map <String , dynamic > patterns = json.decode (data.readAsStringSync ());
105
104
buffer.writeln ("'$locale ': <String, String>{" );
106
105
patterns.forEach ((String key, dynamic value) {
@@ -154,14 +153,16 @@ String _jsonToMap(dynamic json) {
154
153
throw 'Unsupported JSON type ${json .runtimeType } of value $json .' ;
155
154
}
156
155
157
- Iterable <String > _materialLocales () sync * {
158
- final RegExp filenameRE = RegExp (r'material_(\w+)\.arb$' );
159
- final Directory materialLocalizationsDirectory = Directory (path.join ('packages' , 'flutter_localizations' , 'lib' , 'src' , 'l10n' ));
160
- for (FileSystemEntity entity in materialLocalizationsDirectory.listSync ()) {
156
+ Set <String > _supportedLocales () {
157
+ final Set <String > supportedLocales = < String > {};
158
+ final RegExp filenameRE = RegExp (r'(?:material|cupertino)_(\w+)\.arb$' );
159
+ final Directory supportedLocalesDirectory = Directory (path.join ('packages' , 'flutter_localizations' , 'lib' , 'src' , 'l10n' ));
160
+ for (FileSystemEntity entity in supportedLocalesDirectory.listSync ()) {
161
161
final String filePath = entity.path;
162
162
if (FileSystemEntity .isFileSync (filePath) && filenameRE.hasMatch (filePath))
163
- yield filenameRE.firstMatch (filePath)[1 ];
163
+ supportedLocales. add ( filenameRE.firstMatch (filePath)[1 ]) ;
164
164
}
165
+ return supportedLocales;
165
166
}
166
167
167
168
Map <String , File > _listIntlData (Directory directory) {
0 commit comments