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

Side by Side Diff: pkg/intl/lib/intl.dart

Issue 11770004: Rename Date to DateTime. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments and keep Backwards-compatibility class Date. Created 7 years, 11 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 | « pkg/intl/lib/date_format.dart ('k') | pkg/intl/lib/src/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
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 * This library provides internationalization and localization. This includes 6 * This library provides internationalization and localization. This includes
7 * message formatting and replacement, date and number formatting and parsing, 7 * message formatting and replacement, date and number formatting and parsing,
8 * and utilities for working with Bidirectional text. 8 * and utilities for working with Bidirectional text.
9 * 9 *
10 * For things that require locale or other data, there are multiple different 10 * For things that require locale or other data, there are multiple different
(...skipping 27 matching lines...) Expand all
38 * '''I see ${Intl.plural(num_people, 38 * '''I see ${Intl.plural(num_people,
39 * {'0': 'no one at all', 39 * {'0': 'no one at all',
40 * '1': 'one other person', 40 * '1': 'one other person',
41 * 'other': '$num_people other people'})} in $place.'''' 41 * 'other': '$num_people other people'})} in $place.''''
42 * 42 *
43 * Usage examples: 43 * Usage examples:
44 * today(date) => Intl.message( 44 * today(date) => Intl.message(
45 * "Today's date is $date", 45 * "Today's date is $date",
46 * desc: 'Indicate the current date', 46 * desc: 'Indicate the current date',
47 * examples: {'date' : 'June 8, 2012'}); 47 * examples: {'date' : 'June 8, 2012'});
48 * print(today(new Date.now()); 48 * print(today(new DateTime.now());
49 * 49 *
50 * msg({num_people, place}) => Intl.message( 50 * msg({num_people, place}) => Intl.message(
51 * '''I see ${Intl.plural(num_people, 51 * '''I see ${Intl.plural(num_people,
52 * {'0': 'no one at all', 52 * {'0': 'no one at all',
53 * '1': 'one other person', 53 * '1': 'one other person',
54 * 'other': '$num_people other people'})} in $place.'''', 54 * 'other': '$num_people other people'})} in $place.'''',
55 * desc: 'Description of how many people are seen as program start.', 55 * desc: 'Description of how many people are seen as program start.',
56 * examples: {'num_people': 3, 'place': 'London'}); 56 * examples: {'num_people': 3, 'place': 'London'});
57 * 57 *
58 * Calling `msg({'num_people': 2, 'place': 'Athens'});` would 58 * Calling `msg({'num_people': 2, 'place': 'Athens'});` would
59 * produce "I see 2 other people in Athens." as output in the default locale. 59 * produce "I see 2 other people in Athens." as output in the default locale.
60 * 60 *
61 * To use a locale other than the default, use the `withLocale` function. 61 * To use a locale other than the default, use the `withLocale` function.
62 * var todayString = new DateFormat("pt_BR").format(new Date.now()); 62 * var todayString = new DateFormat("pt_BR").format(new DateTime.now());
63 * print(withLocale("pt_BR", () => today(todayString)); 63 * print(withLocale("pt_BR", () => today(todayString));
64 * 64 *
65 * See `tests/message_format_test.dart` for more examples. 65 * See `tests/message_format_test.dart` for more examples.
66 */ 66 */
67 //TODO(efortuna): documentation example involving the offset parameter? 67 //TODO(efortuna): documentation example involving the offset parameter?
68 68
69 class Intl { 69 class Intl {
70 /** 70 /**
71 * String indicating the locale code with which the message is to be 71 * String indicating the locale code with which the message is to be
72 * formatted (such as en-CA). 72 * formatted (such as en-CA).
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 /** 265 /**
266 * Accessor for the current locale. This should always == the default locale, 266 * Accessor for the current locale. This should always == the default locale,
267 * unless for some reason this gets called inside a message that resets the 267 * unless for some reason this gets called inside a message that resets the
268 * locale. 268 * locale.
269 */ 269 */
270 static String getCurrentLocale() { 270 static String getCurrentLocale() {
271 if (_defaultLocale == null) _defaultLocale = systemLocale; 271 if (_defaultLocale == null) _defaultLocale = systemLocale;
272 return _defaultLocale; 272 return _defaultLocale;
273 } 273 }
274 } 274 }
OLDNEW
« no previous file with comments | « pkg/intl/lib/date_format.dart ('k') | pkg/intl/lib/src/date_format_field.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698