| OLD | NEW |
| 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 * |
| 11 * This produces a series of files named | 11 * This produces a series of files named |
| 12 * "messages_<locale>.dart" containing messages for a particular locale | 12 * "messages_<locale>.dart" containing messages for a particular locale |
| 13 * and a main import file named "messages_all.dart" which has imports all of | 13 * and a main import file named "messages_all.dart" which has imports all of |
| 14 * them and provides an initializeMessages function. | 14 * them and provides an initializeMessages function. |
| 15 */ | 15 */ |
| 16 library generate_from_json; | 16 library generate_from_json; |
| 17 | 17 |
| 18 import 'dart:io'; | 18 import 'dart:io'; |
| 19 import 'package:intl/extract_messages.dart'; | 19 import 'package:intl/extract_messages.dart'; |
| 20 import 'package:intl/src/intl_message.dart'; | 20 import 'package:intl/src/intl_message.dart'; |
| 21 import 'extract_to_json.dart'; | |
| 22 import 'package:intl/generate_localized.dart'; | 21 import 'package:intl/generate_localized.dart'; |
| 23 import 'dart:json' as json; | 22 import 'dart:json' as json; |
| 24 import 'package:path/path.dart' as path; | 23 import 'package:path/path.dart' as path; |
| 25 import 'package:args/args.dart'; | 24 import 'package:args/args.dart'; |
| 26 import 'package:serialization/serialization.dart'; | 25 import 'package:serialization/serialization.dart'; |
| 27 | 26 |
| 28 /** | 27 /** |
| 29 * Keeps track of all the messages we have processed so far, keyed by message | 28 * Keeps track of all the messages we have processed so far, keyed by message |
| 30 * name. | 29 * name. |
| 31 */ | 30 */ |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 BasicTranslatedMessage(String name, translated) : | 113 BasicTranslatedMessage(String name, translated) : |
| 115 super(name, translated); | 114 super(name, translated); |
| 116 | 115 |
| 117 MainMessage get originalMessage => | 116 MainMessage get originalMessage => |
| 118 (super.originalMessage == null) ? _findOriginal() : super.originalMessage; | 117 (super.originalMessage == null) ? _findOriginal() : super.originalMessage; |
| 119 | 118 |
| 120 // We know that our [id] is the name of the message, which is used as the | 119 // We know that our [id] is the name of the message, which is used as the |
| 121 //key in [messages]. | 120 //key in [messages]. |
| 122 MainMessage _findOriginal() => originalMessage = messages[id]; | 121 MainMessage _findOriginal() => originalMessage = messages[id]; |
| 123 } | 122 } |
| OLD | NEW |