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 * 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 "originalNotInBMP" : "Anciens caractères grecs jeux du pendu: 𐅆𐅇.", | 54 "originalNotInBMP" : "Anciens caractères grecs jeux du pendu: 𐅆𐅇.", |
55 "escapable" : "Escapes: \n\r\f\b\t\v.", | 55 "escapable" : "Escapes: \n\r\f\b\t\v.", |
56 "plurals" : writer.write(new Plural.from("num", | 56 "plurals" : writer.write(new Plural.from("num", |
57 [ | 57 [ |
58 ["zero", "Est-ce que nulle est pluriel?"], | 58 ["zero", "Est-ce que nulle est pluriel?"], |
59 ["one", "C'est singulier"], | 59 ["one", "C'est singulier"], |
60 ["other", "C'est pluriel (\$num)."] | 60 ["other", "C'est pluriel (\$num)."] |
61 ], null)), | 61 ], null)), |
62 // TODO(alanknight): These are pretty horrible to write out manually. Provide | 62 // TODO(alanknight): These are pretty horrible to write out manually. Provide |
63 // a better way of reading/writing translations. A real format would be good. | 63 // a better way of reading/writing translations. A real format would be good. |
64 "whereTheyWent" : writer.write(new Gender.from("gender", | 64 "whereTheyWentMessage" : writer.write(new Gender.from("gender", |
65 [ | 65 [ |
66 ["male", [0, " est allé à sa ", 2]], | 66 ["male", [0, " est allé à sa ", 2]], |
67 ["female", [0, " est allée à sa ", 2]], | 67 ["female", [0, " est allée à sa ", 2]], |
68 ["other", [0, " est allé à sa ", 2]] | 68 ["other", [0, " est allé à sa ", 2]] |
69 ], null)), | 69 ], null)), |
70 // Gratuitously different translation for testing. Ignoring gender of place. | 70 // Gratuitously different translation for testing. Ignoring gender of place. |
71 "nestedMessage" : writer.write(new Gender.from("combinedGender", | 71 "nestedMessage" : writer.write(new Gender.from("combinedGender", |
72 [ | 72 [ |
73 ["other", new Plural.from("number", | 73 ["other", new Plural.from("number", |
74 [ | 74 [ |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 "originalNotInBMP" : "Antike griechische Galgenmännchen Zeichen: 𐅆𐅇", | 124 "originalNotInBMP" : "Antike griechische Galgenmännchen Zeichen: 𐅆𐅇", |
125 "escapable" : "Escapes: \n\r\f\b\t\v.", | 125 "escapable" : "Escapes: \n\r\f\b\t\v.", |
126 "plurals" : writer.write(new Plural.from("num", | 126 "plurals" : writer.write(new Plural.from("num", |
127 [ | 127 [ |
128 ["zero", "Ist Null Plural?"], | 128 ["zero", "Ist Null Plural?"], |
129 ["one", "Dies ist einmalig"], | 129 ["one", "Dies ist einmalig"], |
130 ["other", "Dies ist Plural (\$num)."] | 130 ["other", "Dies ist Plural (\$num)."] |
131 ], null)), | 131 ], null)), |
132 // TODO(alanknight): These are pretty horrible to write out manually. Provide | 132 // TODO(alanknight): These are pretty horrible to write out manually. Provide |
133 // a better way of reading/writing translations. A real format would be good. | 133 // a better way of reading/writing translations. A real format would be good. |
134 "whereTheyWent" : writer.write(new Gender.from("gender", | 134 "whereTheyWentMessage" : writer.write(new Gender.from("gender", |
135 [ | 135 [ |
136 ["male", [0, " ging zu seinem ", 2]], | 136 ["male", [0, " ging zu seinem ", 2]], |
137 ["female", [0, " ging zu ihrem ", 2]], | 137 ["female", [0, " ging zu ihrem ", 2]], |
138 ["other", [0, " ging zu seinem ", 2]] | 138 ["other", [0, " ging zu seinem ", 2]] |
139 ], null)), | 139 ], null)), |
140 //Note that we're only using the gender of the people. The gender of the | 140 //Note that we're only using the gender of the people. The gender of the |
141 //place also matters, but we're not dealing with that here. | 141 //place also matters, but we're not dealing with that here. |
142 "nestedMessage" : writer.write(new Gender.from("combinedGender", | 142 "nestedMessage" : writer.write(new Gender.from("combinedGender", |
143 [ | 143 [ |
144 ["other", new Plural.from("number", | 144 ["other", new Plural.from("number", |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 parser.addOption("output-dir", defaultsTo: '.', | 204 parser.addOption("output-dir", defaultsTo: '.', |
205 callback: (value) => targetDir = value); | 205 callback: (value) => targetDir = value); |
206 parser.parse(args); | 206 parser.parse(args); |
207 | 207 |
208 var fileArgs = args.where((x) => x.contains('.json')); | 208 var fileArgs = args.where((x) => x.contains('.json')); |
209 | 209 |
210 var messages = json.parse(new File(fileArgs.first).readAsStringSync()); | 210 var messages = json.parse(new File(fileArgs.first).readAsStringSync()); |
211 translate(messages, "fr", french); | 211 translate(messages, "fr", french); |
212 translate(messages, "de_DE", german); | 212 translate(messages, "de_DE", german); |
213 } | 213 } |
OLD | NEW |