Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: pkg/intl/test/message_extraction/generate_from_json.dart

Issue 17113002: Allow translated messages that have no matching original message (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix a typo in help text Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/intl/test/message_extraction/extract_to_json.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 /** 6 /**
7 * A main program that takes as input a source Dart file and a number 7 * A main program that takes as input a source Dart file and a number
8 * of JSON files representing translations of messages from the corresponding 8 * of JSON files representing translations of messages from the corresponding
9 * Dart file. See extract_to_json.dart and make_hardcoded_translation.dart. 9 * Dart file. See extract_to_json.dart and make_hardcoded_translation.dart.
10 * 10 *
(...skipping 25 matching lines...) Expand all
36 var parser = new ArgParser(); 36 var parser = new ArgParser();
37 parser.addFlag("suppress-warnings", defaultsTo: false, 37 parser.addFlag("suppress-warnings", defaultsTo: false,
38 callback: (x) => suppressWarnings = x); 38 callback: (x) => suppressWarnings = x);
39 parser.addOption("output-dir", defaultsTo: '.', 39 parser.addOption("output-dir", defaultsTo: '.',
40 callback: (x) => targetDir = x); 40 callback: (x) => targetDir = x);
41 parser.addOption("generated-file-prefix", defaultsTo: '', 41 parser.addOption("generated-file-prefix", defaultsTo: '',
42 callback: (x) => generatedFilePrefix = x); 42 callback: (x) => generatedFilePrefix = x);
43 parser.parse(args); 43 parser.parse(args);
44 if (args.length == 0) { 44 if (args.length == 0) {
45 print('Usage: generate_from_json [--output-dir=<dir>]' 45 print('Usage: generate_from_json [--output-dir=<dir>]'
46 ' [generated-file-prefix=<prefix>] file1.dart file2.dart ...' 46 ' [--generated-file-prefix=<prefix>] file1.dart file2.dart ...'
47 ' outputFile.json'); 47 ' translation1.json translation2.json ...');
48 exit(0); 48 exit(0);
49 } 49 }
50 50
51 var dartFiles = args.where((x) => x.endsWith("dart")).toList(); 51 var dartFiles = args.where((x) => x.endsWith("dart")).toList();
52 var jsonFiles = args.where((x) => x.endsWith(".json")).toList(); 52 var jsonFiles = args.where((x) => x.endsWith(".json")).toList();
53 53
54 // We're re-parsing the original files to find the corresponding messages, 54 // We're re-parsing the original files to find the corresponding messages,
55 // so if there are warnings extracting the messages, suppress them. 55 // so if there are warnings extracting the messages, suppress them.
56 suppressWarnings = true; 56 suppressWarnings = true;
57 var allMessages = dartFiles.map((each) => parseFile(new File(each))); 57 var allMessages = dartFiles.map((each) => parseFile(new File(each)));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 BasicTranslatedMessage(String name, String translated) : 99 BasicTranslatedMessage(String name, String translated) :
100 super(name, translated); 100 super(name, translated);
101 101
102 IntlMessage get originalMessage => 102 IntlMessage get originalMessage =>
103 (super.originalMessage == null) ? _findOriginal() : super.originalMessage; 103 (super.originalMessage == null) ? _findOriginal() : super.originalMessage;
104 104
105 // We know that our [id] is the name of the message, which is used as the 105 // We know that our [id] is the name of the message, which is used as the
106 //key in [messages]. 106 //key in [messages].
107 IntlMessage _findOriginal() => originalMessage = messages[id]; 107 IntlMessage _findOriginal() => originalMessage = messages[id];
108 } 108 }
OLDNEW
« no previous file with comments | « pkg/intl/test/message_extraction/extract_to_json.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698