| 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 * This is part of the [intl package] | 10 * This is part of the [intl package] |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 return new DateFormat(pattern, actualLocale); | 114 return new DateFormat(pattern, actualLocale); |
| 115 } | 115 } |
| 116 | 116 |
| 117 /** | 117 /** |
| 118 * Constructor optionally [aLocale] for specifics of the language | 118 * Constructor optionally [aLocale] for specifics of the language |
| 119 * locale to be used, otherwise, we will attempt to infer it (acceptable if | 119 * locale to be used, otherwise, we will attempt to infer it (acceptable if |
| 120 * Dart is running on the client, we can infer from the browser/client | 120 * Dart is running on the client, we can infer from the browser/client |
| 121 * preferences). | 121 * preferences). |
| 122 */ | 122 */ |
| 123 Intl([String aLocale]) { | 123 Intl([String aLocale]) { |
| 124 _locale = aLocale != null ? aLocale : getCurrentLocale(); | 124 _locale = aLocale != null ? aLocale : getCurrentLocale(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 /** | 127 /** |
| 128 * Use this for a message that will be translated for different locales. The | 128 * Use this for a message that will be translated for different locales. The |
| 129 * expected usage is that this is inside an enclosing function that only | 129 * expected usage is that this is inside an enclosing function that only |
| 130 * returns the value of this call and provides a scope for the variables that | 130 * returns the value of this call and provides a scope for the variables that |
| 131 * will be substituted in the message. | 131 * will be substituted in the message. |
| 132 * | 132 * |
| 133 * The parameters are a | 133 * The parameters are a |
| 134 * [message_str] to be translated, which may be interpolated | 134 * [message_str] to be translated, which may be interpolated |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 * unless for some reason this gets called inside a message that resets the | 360 * unless for some reason this gets called inside a message that resets the |
| 361 * locale. | 361 * locale. |
| 362 */ | 362 */ |
| 363 static String getCurrentLocale() { | 363 static String getCurrentLocale() { |
| 364 if (defaultLocale == null) defaultLocale = systemLocale; | 364 if (defaultLocale == null) defaultLocale = systemLocale; |
| 365 return defaultLocale; | 365 return defaultLocale; |
| 366 } | 366 } |
| 367 | 367 |
| 368 toString() => "Intl($locale)"; | 368 toString() => "Intl($locale)"; |
| 369 } | 369 } |
| OLD | NEW |