| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 "dollars \${ (les accolades sont ok), et xml/html réservés <& et " | 46 "dollars \${ (les accolades sont ok), et xml/html réservés <& et " |
| 47 "des citations \" " | 47 "des citations \" " |
| 48 "avec quelques paramètres ainsi \$a, \$b, et \$c", | 48 "avec quelques paramètres ainsi \$a, \$b, et \$c", |
| 49 "method" : "Cela vient d'une méthode", | 49 "method" : "Cela vient d'une méthode", |
| 50 "nonLambda" : "Cette méthode n'est pas un lambda", | 50 "nonLambda" : "Cette méthode n'est pas un lambda", |
| 51 "staticMessage" : "Cela vient d'une méthode statique", | 51 "staticMessage" : "Cela vient d'une méthode statique", |
| 52 "notAlwaysTranslated" : "Ce manque certaines traductions", | 52 "notAlwaysTranslated" : "Ce manque certaines traductions", |
| 53 "thisNameIsNotInTheOriginal" : "Could this lead to something malicious?", | 53 "thisNameIsNotInTheOriginal" : "Could this lead to something malicious?", |
| 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 "sameContentsDifferentName" : "Bonjour tout le monde", |
| 57 "differentNameSameContents" : "Bonjour tout le monde", |
| 56 "plurals" : writer.write(new Plural.from("num", | 58 "plurals" : writer.write(new Plural.from("num", |
| 57 [ | 59 [ |
| 58 ["zero", "Est-ce que nulle est pluriel?"], | 60 ["zero", "Est-ce que nulle est pluriel?"], |
| 59 ["one", "C'est singulier"], | 61 ["one", "C'est singulier"], |
| 60 ["other", "C'est pluriel (\$num)."] | 62 ["other", "C'est pluriel (\$num)."] |
| 61 ], null)), | 63 ], null)), |
| 62 // TODO(alanknight): These are pretty horrible to write out manually. Provide | 64 // 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. | 65 // a better way of reading/writing translations. A real format would be good. |
| 64 "whereTheyWentMessage" : writer.write(new Gender.from("gender", | 66 "whereTheyWentMessage" : writer.write(new Gender.from("gender", |
| 65 [ | 67 [ |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 "trickyInterpolation" : | 138 "trickyInterpolation" : |
| 137 r"Interpolation ist schwierig, wenn es einen Satz wie dieser endet ${s}.", | 139 r"Interpolation ist schwierig, wenn es einen Satz wie dieser endet ${s}.", |
| 138 "message3" : "Zeichen, die Flucht benötigen, zB Schrägstriche \\ Dollar " | 140 "message3" : "Zeichen, die Flucht benötigen, zB Schrägstriche \\ Dollar " |
| 139 "\${ (geschweiften Klammern sind ok) und xml reservierte Zeichen <& und " | 141 "\${ (geschweiften Klammern sind ok) und xml reservierte Zeichen <& und " |
| 140 "Zitate \" Parameter \$a, \$b und \$c", | 142 "Zitate \" Parameter \$a, \$b und \$c", |
| 141 "method" : "Dies ergibt sich aus einer Methode", | 143 "method" : "Dies ergibt sich aus einer Methode", |
| 142 "nonLambda" : "Diese Methode ist nicht eine Lambda", | 144 "nonLambda" : "Diese Methode ist nicht eine Lambda", |
| 143 "staticMessage" : "Dies ergibt sich aus einer statischen Methode", | 145 "staticMessage" : "Dies ergibt sich aus einer statischen Methode", |
| 144 "originalNotInBMP" : "Antike griechische Galgenmännchen Zeichen: 𐅆𐅇", | 146 "originalNotInBMP" : "Antike griechische Galgenmännchen Zeichen: 𐅆𐅇", |
| 145 "escapable" : "Escapes: \n\r\f\b\t\v.", | 147 "escapable" : "Escapes: \n\r\f\b\t\v.", |
| 148 "sameContentsDifferentName" : "Hallo Welt", |
| 149 "differentNameSameContents" : "Hallo Welt", |
| 146 "plurals" : writer.write(new Plural.from("num", | 150 "plurals" : writer.write(new Plural.from("num", |
| 147 [ | 151 [ |
| 148 ["zero", "Ist Null Plural?"], | 152 ["zero", "Ist Null Plural?"], |
| 149 ["one", "Dies ist einmalig"], | 153 ["one", "Dies ist einmalig"], |
| 150 ["other", "Dies ist Plural (\$num)."] | 154 ["other", "Dies ist Plural (\$num)."] |
| 151 ], null)), | 155 ], null)), |
| 152 // TODO(alanknight): These are pretty horrible to write out manually. Provide | 156 // TODO(alanknight): These are pretty horrible to write out manually. Provide |
| 153 // a better way of reading/writing translations. A real format would be good. | 157 // a better way of reading/writing translations. A real format would be good. |
| 154 "whereTheyWentMessage" : writer.write(new Gender.from("gender", | 158 "whereTheyWentMessage" : writer.write(new Gender.from("gender", |
| 155 [ | 159 [ |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 parser.addOption("output-dir", defaultsTo: '.', | 247 parser.addOption("output-dir", defaultsTo: '.', |
| 244 callback: (value) => targetDir = value); | 248 callback: (value) => targetDir = value); |
| 245 parser.parse(args); | 249 parser.parse(args); |
| 246 | 250 |
| 247 var fileArgs = args.where((x) => x.contains('.json')); | 251 var fileArgs = args.where((x) => x.contains('.json')); |
| 248 | 252 |
| 249 var messages = JSON.decode(new File(fileArgs.first).readAsStringSync()); | 253 var messages = JSON.decode(new File(fileArgs.first).readAsStringSync()); |
| 250 translate(messages, "fr", french); | 254 translate(messages, "fr", french); |
| 251 translate(messages, "de_DE", german); | 255 translate(messages, "de_DE", german); |
| 252 } | 256 } |
| OLD | NEW |