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

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

Issue 132963002: Read Intl.message examples argument as a map, not a string (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweaks for the test framework Created 6 years, 11 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
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 * This simulates a translation process, reading the messages generated 7 * This simulates a translation process, reading the messages generated
8 * from extract_message.dart for the files sample_with_messages.dart and 8 * from extract_message.dart for the files sample_with_messages.dart and
9 * part_of_sample_with_messages.dart and writing out hard-coded translations for 9 * part_of_sample_with_messages.dart and writing out hard-coded translations for
10 * German and French locales. 10 * German and French locales.
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 for (var each in originals) { 218 for (var each in originals) {
219 var name = each["name"]; 219 var name = each["name"];
220 translated[name] = translations[name]; 220 translated[name] = translations[name];
221 } 221 }
222 var file = new File(path.join(targetDir, 'translation_$locale.json')); 222 var file = new File(path.join(targetDir, 'translation_$locale.json'));
223 file.writeAsStringSync(JSON.encode(translated)); 223 file.writeAsStringSync(JSON.encode(translated));
224 } 224 }
225 225
226 main(List<String> args) { 226 main(List<String> args) {
227 if (args.length == 0) { 227 if (args.length == 0) {
228 print('Usage: generate_hardcoded_translation [--output-dir=<dir>] ' 228 print('Usage: make_hardcoded_translation [--output-dir=<dir>] '
229 '[originalFile.json]'); 229 '[originalFile.json]');
230 exit(0); 230 exit(0);
231 } 231 }
232 var parser = new ArgParser(); 232 var parser = new ArgParser();
233 parser.addOption("output-dir", defaultsTo: '.', 233 parser.addOption("output-dir", defaultsTo: '.',
234 callback: (value) => targetDir = value); 234 callback: (value) => targetDir = value);
235 parser.parse(args); 235 parser.parse(args);
236 236
237 var fileArgs = args.where((x) => x.contains('.json')); 237 var fileArgs = args.where((x) => x.contains('.json'));
238 238
239 var messages = JSON.decode(new File(fileArgs.first).readAsStringSync()); 239 var messages = JSON.decode(new File(fileArgs.first).readAsStringSync());
240 translate(messages, "fr", french); 240 translate(messages, "fr", french);
241 translate(messages, "de_DE", german); 241 translate(messages, "de_DE", german);
242 } 242 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698