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

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

Issue 10827227: Start moving non-platform libraries from lib/ to pkg/ . (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Start moving non-platform libraries from lib/ to pkg/ Created 8 years, 4 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') | lib/i18n/lib/date_format_field.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /**
6 * Message/plural format library with locale support.
7 *
8 *
9 * _message example:
10 * '''I see ${Intl.plural(num_people,
11 * {'0': 'no one at all',
12 * '1': 'one other person',
13 * 'other': '$num_people other people'})} in $place.''''
14 *
15 * Usage examples:
16 * today(date) => intl.message(
17 * "Today's date is $date",
18 * desc: 'Indicate the current date',
19 * examples: {'date' : 'June 8, 2012'});
20 * print(today(new Date.now());
21 *
22 * msg(num_people, place) => intl.message(
23 * '''I see ${Intl.plural(num_people,
24 * {'0': 'no one at all',
25 * '1': 'one other person',
26 * 'other': '$num_people other people'})} in $place.'''',
27 * desc: 'Description of how many people are seen as program start.',
28 * examples: {'num_people': 3, 'place': 'London'});
29 *
30 * Calling `msg({'num_people': 2, 'place': 'Athens'});` would
31 * produce "I see 2 other people in Athens." as output.
32 *
33 * See tests/message_format_test.dart for more examples.
34 */
35 //TODO(efortuna): documentation example involving the offset parameter?
36
37 class IntlMessage {
38
39 /** String describing the use case for this message. */
40 String _messageDescription;
41
42 /**
43 * String that contains the message to be displayed. It may contain
44 * placeholders in the form of string interpolated items (ie 'hello$foo') that
45 * will be substituted in to complete the message.
46 * See tests/message_format_test.dart for more examples.
47 */
48 String _message;
49
50 /**
51 * String indicating the locale code with which the message is to be
52 * formatted (such as en-CA).
53 */
54 String _languageCode;
55
56 /** Examples of the placeholders used in the message string. */
57 Map _messageExamples;
58
59 /**
60 * Accepts a String [_message] that contains the message (that
61 * will be internationalized). A String [_messageDescription] describes the
62 * use case for this string in the program, and [examples] provides a map of
63 * examples for the items (if any) to be subsituted into [_message].
64 * It also optionally accepts a [_languageCode] to specify the particular
65 * language to return content in (necessary if the Dart code is not running in
66 * a browser). The values of [desc] and [examples] *must* be
67 * simple Strings available at compile time: no String interpolation or
68 * concatenation.
69 */
70 IntlMessage(this._message, [final String desc='', final Map examples=const {},
71 final String locale='']) {
72 this._messageDescription = desc;
73 this._messageExamples = examples;
74 this._languageCode = locale;
75 }
76 }
OLDNEW
« no previous file with comments | « lib/i18n/intl.dart ('k') | lib/i18n/lib/date_format_field.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698