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

Unified Diff: pkg/intl/test/message_extraction/extract_to_json.dart

Issue 18543009: Plurals and Genders (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typo 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/intl/pubspec.yaml ('k') | pkg/intl/test/message_extraction/generate_from_json.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/intl/test/message_extraction/extract_to_json.dart
diff --git a/pkg/intl/test/message_extraction/extract_to_json.dart b/pkg/intl/test/message_extraction/extract_to_json.dart
index ce5c907704f8ff188469c7757f1134231384dd96..fd601804c67b8a2a2f3d0511eddc90aa546f1a97 100644
--- a/pkg/intl/test/message_extraction/extract_to_json.dart
+++ b/pkg/intl/test/message_extraction/extract_to_json.dart
@@ -57,18 +57,20 @@ main() {
* store it to the file in Dart interpolation syntax, so the transformation
* is trivial.
*/
-String leaveTheInterpolationsInDartForm(IntlMessage msg, chunk) =>
- (chunk is String) ? chunk : "\$${msg.arguments[chunk]}";
+String leaveTheInterpolationsInDartForm(MainMessage msg, chunk) {
+ if (chunk is String) return chunk;
+ if (chunk is int) return "\$${msg.arguments[chunk]}";
+ return chunk.toCode();
+}
/**
- * Convert the [IntlMessage] to a trivial JSON format.
+ * Convert the [MainMessage] to a trivial JSON format.
*/
-Map toJson(IntlMessage message) {
- return {
- "name" : message.name,
- "description" : message.description,
- "message" : message.fullMessage(leaveTheInterpolationsInDartForm),
- "examples" : message.examples,
- "arguments" : message.arguments
- };
+Map toJson(MainMessage message) {
+ var result = new Map<String, Object>();
+ for (var attribute in message.attributeNames) {
+ result[attribute] = message[attribute];
+ }
+ result["message"] = message.expanded(leaveTheInterpolationsInDartForm);
+ return result;
}
« no previous file with comments | « pkg/intl/pubspec.yaml ('k') | pkg/intl/test/message_extraction/generate_from_json.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698