OLD | NEW |
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 |
11 * ways of making that data available, which may require importing different | 11 * ways of making that data available, which may require importing different |
12 * libraries. See the class comments for more details. | 12 * libraries. See the class comments for more details. |
13 * | 13 * |
14 * There is also a simple example application that can be found in the | 14 * There is also a simple example application that can be found in the |
15 * `example/basic` directory. | 15 * `example/basic` directory. |
16 */ | 16 */ |
17 library intl; | 17 library intl; |
18 | 18 |
| 19 import 'dart:async'; |
19 import 'src/intl_helpers.dart'; | 20 import 'src/intl_helpers.dart'; |
20 import 'dart:math'; | 21 import 'dart:math'; |
21 import 'date_symbols.dart'; | 22 import 'date_symbols.dart'; |
22 import 'src/date_format_internal.dart'; | 23 import 'src/date_format_internal.dart'; |
23 | 24 |
24 part 'date_format.dart'; | 25 part 'date_format.dart'; |
25 part 'src/date_format_field.dart'; | 26 part 'src/date_format_field.dart'; |
26 part 'src/date_format_helpers.dart'; | 27 part 'src/date_format_helpers.dart'; |
27 part 'bidi_formatter.dart'; | 28 part 'bidi_formatter.dart'; |
28 part 'bidi_utils.dart'; | 29 part 'bidi_utils.dart'; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 * The values of [desc] and [examples] are not used at run-time but are only | 121 * The values of [desc] and [examples] are not used at run-time but are only |
121 * made available to the translators, so they MUST be simple Strings available | 122 * made available to the translators, so they MUST be simple Strings available |
122 * at compile time: no String interpolation or concatenation. | 123 * at compile time: no String interpolation or concatenation. |
123 * The expected usage of this is inside a function that takes as parameters | 124 * The expected usage of this is inside a function that takes as parameters |
124 * the variables used in the interpolated string, and additionally also a | 125 * the variables used in the interpolated string, and additionally also a |
125 * locale (optional). | 126 * locale (optional). |
126 * Ultimately, the information about the enclosing function and its arguments | 127 * Ultimately, the information about the enclosing function and its arguments |
127 * will be extracted automatically but for the time being it must be passed | 128 * will be extracted automatically but for the time being it must be passed |
128 * explicitly in the [name] and [args] arguments. | 129 * explicitly in the [name] and [args] arguments. |
129 */ | 130 */ |
130 static String message(String message_str, {final String desc: '', | 131 static Future<String> message(String message_str, {final String desc: '', |
131 final Map examples: const {}, String locale, String name, | 132 final Map examples: const {}, String locale, String name, |
132 List<String> args}) { | 133 List<String> args}) { |
133 return messageLookup.lookupMessage( | 134 return messageLookup.lookupMessage( |
134 message_str, desc, examples, locale, name, args); | 135 message_str, desc, examples, locale, name, args); |
135 } | 136 } |
136 | 137 |
137 /** | 138 /** |
138 * Return the locale for this instance. If none was set, the locale will | 139 * Return the locale for this instance. If none was set, the locale will |
139 * be the default. | 140 * be the default. |
140 */ | 141 */ |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 264 |
264 /** | 265 /** |
265 * Accessor for the current locale. This should always == the default locale, | 266 * Accessor for the current locale. This should always == the default locale, |
266 * 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 |
267 * locale. | 268 * locale. |
268 */ | 269 */ |
269 static String getCurrentLocale() { | 270 static String getCurrentLocale() { |
270 if (_defaultLocale == null) _defaultLocale = systemLocale; | 271 if (_defaultLocale == null) _defaultLocale = systemLocale; |
271 return _defaultLocale; | 272 return _defaultLocale; |
272 } | 273 } |
273 } | 274 } |
OLD | NEW |