@@ -16,8 +16,8 @@ import 'package:path/path.dart' as path;
16
16
17
17
class IntlTranslationHelper {
18
18
void aaa (String outputDirectoryPath, String localizationFileName) {
19
- var extraction = new MessageExtraction ();
20
- var generation = new MessageGeneration ();
19
+ var extraction = MessageExtraction ();
20
+ var generation = MessageGeneration ();
21
21
22
22
generation.generatedFilePrefix = "_" ;
23
23
@@ -33,27 +33,26 @@ class IntlTranslationHelper {
33
33
var targetDir = outputDirectoryPath;
34
34
35
35
extraction.suppressWarnings = true ;
36
- var allMessages =
37
- dartFiles.map ((each) => extraction.parseFile (new File (each)));
36
+ var allMessages = dartFiles.map ((each) => extraction.parseFile (File (each)));
38
37
39
- messages = new Map ();
38
+ messages = Map ();
40
39
for (var eachMap in allMessages) {
41
40
eachMap.forEach (
42
41
(key, value) => messages.putIfAbsent (key, () => []).add (value));
43
42
}
44
43
for (var arg in jsonFiles) {
45
- var file = new File (arg);
44
+ var file = File (arg);
46
45
generateLocaleFile (file, targetDir, generation);
47
46
}
48
47
49
- var mainImportFile = new File (path.join (
48
+ var mainImportFile = File (path.join (
50
49
targetDir, '${generation .generatedFilePrefix }messages_all.dart' ));
51
50
mainImportFile.writeAsStringSync (generation.generateMainImportFile ());
52
51
}
53
52
54
- final pluralAndGenderParser = new IcuParser ().message;
53
+ final pluralAndGenderParser = IcuParser ().message;
55
54
56
- final plainParser = new IcuParser ().nonIcuMessage;
55
+ final plainParser = IcuParser ().nonIcuMessage;
57
56
58
57
/// Keeps track of all the messages we have processed so far, keyed by message
59
58
/// name.
@@ -70,15 +69,15 @@ class IntlTranslationHelper {
70
69
File file, String targetDir, MessageGeneration generation) {
71
70
var src = file.readAsStringSync ();
72
71
var data = jsonDecoder.decode (src);
73
- var locale = data[" @@locale" ] ?? data[" _locale" ];
72
+ var locale = data[' @@locale' ] ?? data[' _locale' ];
74
73
if (locale == null ) {
75
74
// Get the locale from the end of the file name. This assumes that the file
76
75
// name doesn't contain any underscores except to begin the language tag
77
76
// and to separate language from country. Otherwise we can't tell if
78
77
// my_file_fr.arb is locale "fr" or "file_fr".
79
78
var name = path.basenameWithoutExtension (file.path);
80
- locale = name.split ("_" ).skip (1 ).join ("_" );
81
- Log .i (" No @@locale or _locale field found in $name , "
79
+ locale = name.split ('_' ).skip (1 ).join ('_' );
80
+ Log .i (' No @@locale or _locale field found in $name , '
82
81
"assuming '$locale ' based on the file name." );
83
82
}
84
83
generation.allLocales.add (locale);
0 commit comments