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.part of sample; | 3 // BSD-style license that can be found in the LICENSE file.part of sample; |
4 | 4 |
5 part of sample; | 5 part of sample; |
6 | 6 |
7 class Person { | 7 class Person { |
8 String name; | 8 String name; |
9 String gender; | 9 String gender; |
10 Person(this.name, this.gender); | 10 Person(this.name, this.gender); |
11 } | 11 } |
12 | 12 |
13 class YouveGotMessages { | 13 class YouveGotMessages { |
14 | 14 |
15 // A static message, rather than a standalone function. | 15 // A static message, rather than a standalone function. |
16 static staticMessage() => | 16 static staticMessage() => |
17 Intl.message("This comes from a static method", name: 'staticMessage'); | 17 Intl.message("This comes from a static method", name: 'staticMessage'); |
18 | 18 |
19 // An instance method, rather than a standalone function. | 19 // An instance method, rather than a standalone function. |
20 method() => Intl.message("This comes from a method", | 20 method() => Intl.message("This comes from a method", |
21 name: 'method', desc: 'This is a method with a ' | 21 name: 'YouveGotMessages_method', desc: 'This is a method with a ' |
22 'long description which spans ' | 22 'long description which spans ' |
23 'multiple lines.'); | 23 'multiple lines.'); |
24 | 24 |
25 // A non-lambda, i.e. not using => syntax, and with an additional statement | 25 // A non-lambda, i.e. not using => syntax, and with an additional statement |
26 // before the Intl.message call. | 26 // before the Intl.message call. |
27 nonLambda() { | 27 nonLambda() { |
28 var aTrueValue = true; | 28 var aTrueValue = true; |
29 var msg = Intl.message("This method is not a lambda", name: 'nonLambda'); | 29 var msg = Intl.message("This method is not a lambda", name: 'nonLambda'); |
30 expect(aTrueValue, isTrue, | 30 expect(aTrueValue, isTrue, |
31 reason: 'Parser should not fail with additional code.'); | 31 reason: 'Parser should not fail with additional code.'); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 one: "${names} est allé au $place", | 67 one: "${names} est allé au $place", |
68 other: "${names} sont allés au $place")}', | 68 other: "${names} sont allés au $place")}', |
69 female: '${Intl.plural(number, | 69 female: '${Intl.plural(number, |
70 one: "$names est allée au $place", | 70 one: "$names est allée au $place", |
71 other: "$names sont allées au $place")}' | 71 other: "$names sont allées au $place")}' |
72 )}''', | 72 )}''', |
73 name: "nestedMessage", args: [names, number, combinedGender, place]); | 73 name: "nestedMessage", args: [names, number, combinedGender, place]); |
74 return nestedMessage(names, number, combinedGender, place); | 74 return nestedMessage(names, number, combinedGender, place); |
75 } | 75 } |
76 } | 76 } |
OLD | NEW |