| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * This is a program with various [Intl.message] messages. It just prints | 6 * This is a program with various [Intl.message] messages. It just prints |
| 7 * all of them, and is used for testing of message extraction, translation, | 7 * all of them, and is used for testing of message extraction, translation, |
| 8 * and code generation. | 8 * and code generation. |
| 9 */ | 9 */ |
| 10 library sample; | 10 library sample; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 alwaysTranslated() => | 40 alwaysTranslated() => |
| 41 Intl.message("This string is always translated", locale: 'fr', | 41 Intl.message("This string is always translated", locale: 'fr', |
| 42 name: 'alwaysTranslated'); | 42 name: 'alwaysTranslated'); |
| 43 | 43 |
| 44 // Test interpolation with curly braces around the expression, but it must | 44 // Test interpolation with curly braces around the expression, but it must |
| 45 // still be just a variable reference. | 45 // still be just a variable reference. |
| 46 trickyInterpolation(s) => | 46 trickyInterpolation(s) => |
| 47 Intl.message("Interpolation is tricky when it ends a sentence like ${s}.", | 47 Intl.message("Interpolation is tricky when it ends a sentence like ${s}.", |
| 48 name: 'trickyInterpolation', args: [s]); | 48 name: 'trickyInterpolation', args: [s]); |
| 49 | 49 |
| 50 leadingQuotes() => Intl.message("\"So-called\"", name: 'leadingQuotes'); | 50 get leadingQuotes => Intl.message("\"So-called\"", name: 'leadingQuotes'); |
| 51 | 51 |
| 52 // A message with characters not in the basic multilingual plane. | 52 // A message with characters not in the basic multilingual plane. |
| 53 originalNotInBMP() => Intl.message("Ancient Greek hangman characters: 𐅆𐅇.", | 53 originalNotInBMP() => Intl.message("Ancient Greek hangman characters: 𐅆𐅇.", |
| 54 name: "originalNotInBMP"); | 54 name: "originalNotInBMP"); |
| 55 | 55 |
| 56 // A string for which we don't provide all translations. | 56 // A string for which we don't provide all translations. |
| 57 notAlwaysTranslated() => Intl.message("This is missing some translations", | 57 notAlwaysTranslated() => Intl.message("This is missing some translations", |
| 58 name: "notAlwaysTranslated"); | 58 name: "notAlwaysTranslated"); |
| 59 | 59 |
| 60 // This is invalid and should be recognized as such, because the message has | 60 // This is invalid and should be recognized as such, because the message has |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 var messageVariable = message3; | 128 var messageVariable = message3; |
| 129 | 129 |
| 130 printOut("-------------------------------------------"); | 130 printOut("-------------------------------------------"); |
| 131 printOut("Printing messages for ${locale.locale}"); | 131 printOut("Printing messages for ${locale.locale}"); |
| 132 Intl.withLocale(locale.locale, () { | 132 Intl.withLocale(locale.locale, () { |
| 133 printOut(message1()); | 133 printOut(message1()); |
| 134 printOut(message2("hello")); | 134 printOut(message2("hello")); |
| 135 printOut(messageVariable(1,2,3)); | 135 printOut(messageVariable(1,2,3)); |
| 136 printOut(multiLine()); | 136 printOut(multiLine()); |
| 137 printOut(types(1, "b", ["c", "d"])); | 137 printOut(types(1, "b", ["c", "d"])); |
| 138 printOut(leadingQuotes()); | 138 printOut(leadingQuotes); |
| 139 printOut(alwaysTranslated()); | 139 printOut(alwaysTranslated()); |
| 140 printOut(trickyInterpolation("this")); | 140 printOut(trickyInterpolation("this")); |
| 141 var thing = new YouveGotMessages(); | 141 var thing = new YouveGotMessages(); |
| 142 printOut(thing.method()); | 142 printOut(thing.method()); |
| 143 printOut(thing.nonLambda()); | 143 printOut(thing.nonLambda()); |
| 144 var x = YouveGotMessages.staticMessage(); | 144 var x = YouveGotMessages.staticMessage(); |
| 145 printOut(YouveGotMessages.staticMessage()); | 145 printOut(YouveGotMessages.staticMessage()); |
| 146 printOut(notAlwaysTranslated()); | 146 printOut(notAlwaysTranslated()); |
| 147 printOut(originalNotInBMP()); | 147 printOut(originalNotInBMP()); |
| 148 printOut(escapable()); | 148 printOut(escapable()); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 var fr = new Intl("fr"); | 180 var fr = new Intl("fr"); |
| 181 var english = new Intl("en_US"); | 181 var english = new Intl("en_US"); |
| 182 var de = new Intl("de_DE"); | 182 var de = new Intl("de_DE"); |
| 183 // Throw in an initialize of a null locale to make sure it doesn't throw. | 183 // Throw in an initialize of a null locale to make sure it doesn't throw. |
| 184 initializeMessages(null); | 184 initializeMessages(null); |
| 185 var f1 = initializeMessages(fr.locale).then((_) => printStuff(fr)); | 185 var f1 = initializeMessages(fr.locale).then((_) => printStuff(fr)); |
| 186 var f2 = initializeMessages(de.locale).then((_) => printStuff(de)); | 186 var f2 = initializeMessages(de.locale).then((_) => printStuff(de)); |
| 187 printStuff(english); | 187 printStuff(english); |
| 188 return Future.wait([f1, f2]); | 188 return Future.wait([f1, f2]); |
| 189 } | 189 } |
| OLD | NEW |