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

Side by Side Diff: lib/i18n/intl_message.dart

Issue 10692018: Add intl to apidoc, and some minor comment formatting cleanup. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/i18n/intl.dart ('k') | tests/lib/i18n/bidi_format_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 * Message/plural format library with locale support. 6 * Message/plural format library with locale support.
7 * 7 *
8 * 8 *
9 * _message example: 9 * _message example:
10 * '''I see ${Intl.plural(num_people, 10 * '''I see ${Intl.plural(num_people,
11 * {'0': 'no one at all', 11 * {'0': 'no one at all',
12 * '1': 'one other person', 12 * '1': 'one other person',
13 * 'other': '$num_people other people'})} in $place.'''' 13 * 'other': '$num_people other people'})} in $place.''''
14 * 14 *
15 * Usage examples: 15 * Usage examples:
16 * today(date) => intl.message( 16 * today(date) => intl.message(
17 * "Today's date is $date", 17 * "Today's date is $date",
18 * desc: 'Indicate the current date', 18 * desc: 'Indicate the current date',
19 * examples: {'date' : 'June 8, 2012'}); 19 * examples: {'date' : 'June 8, 2012'});
20 * print(today(new Date.now()); 20 * print(today(new Date.now());
21 * 21 *
22 * msg(num_people, place) => intl.message( 22 * msg(num_people, place) => intl.message(
23 * '''I see ${Intl.plural(num_people, 23 * '''I see ${Intl.plural(num_people,
24 * {'0': 'no one at all', 24 * {'0': 'no one at all',
25 * '1': 'one other person', 25 * '1': 'one other person',
26 * 'other': '$num_people other people'})} in $place.'''', 26 * 'other': '$num_people other people'})} in $place.'''',
27 * desc: 'Description of how many people are seen as program start.', 27 * desc: 'Description of how many people are seen as program start.',
28 * examples: {'num_people': 3, 'place': 'London'}); 28 * examples: {'num_people': 3, 'place': 'London'});
29 * 29 *
30 * Calling `msg({'num_people': 2, 'place': 'Athens'});` would 30 * Calling `msg({'num_people': 2, 'place': 'Athens'});` would
31 * produce "I see 2 other people in Athens." as output. 31 * produce "I see 2 other people in Athens." as output.
32 * <!-- TODO(efortuna): documentation example involving the offset parameter.
33 * -->
34 * 32 *
35 * See tests/message_format_test.dart for more examples. 33 * See tests/message_format_test.dart for more examples.
36 */ 34 */
37 35 //TODO(efortuna): documentation example involving the offset parameter?
38 #library('intl_message');
39 36
40 class IntlMessage { 37 class IntlMessage {
41 38
42 /** String describing the use case for this message. */ 39 /** String describing the use case for this message. */
43 String _messageDescription; 40 String _messageDescription;
44 41
45 /** 42 /**
46 * String that contains the message to be displayed. It may contain 43 * String that contains the message to be displayed. It may contain
47 * placeholders in the form of string interpolated items (ie 'hello$foo') that 44 * placeholders in the form of string interpolated items (ie 'hello$foo') that
48 * will be substituted in to complete the message. 45 * will be substituted in to complete the message.
(...skipping 21 matching lines...) Expand all
70 * simple Strings available at compile time: no String interpolation or 67 * simple Strings available at compile time: no String interpolation or
71 * concatenation. 68 * concatenation.
72 */ 69 */
73 IntlMessage(this._message, [final String desc='', final Map examples=const {}, 70 IntlMessage(this._message, [final String desc='', final Map examples=const {},
74 final String locale='']) { 71 final String locale='']) {
75 this._messageDescription = desc; 72 this._messageDescription = desc;
76 this._messageExamples = examples; 73 this._messageExamples = examples;
77 this._languageCode = locale; 74 this._languageCode = locale;
78 } 75 }
79 } 76 }
OLDNEW
« no previous file with comments | « lib/i18n/intl.dart ('k') | tests/lib/i18n/bidi_format_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698