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

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

Issue 14270009: Explain better than the en_US locale is always available, fix other doc glitches. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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/generate_localized.dart ('k') | pkg/intl/lib/message_lookup_by_library.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 * ## Installing ## 10 * ## Installing ##
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 /** 249 /**
250 * Format the given function with a specific [locale], given a 250 * Format the given function with a specific [locale], given a
251 * [message_function] that takes no parameters. The [message_function] can be 251 * [message_function] that takes no parameters. The [message_function] can be
252 * a simple message function that just returns the result of `Intl.message()` 252 * a simple message function that just returns the result of `Intl.message()`
253 * it can be a wrapper around a message function that takes arguments, or it 253 * it can be a wrapper around a message function that takes arguments, or it
254 * can be something more complex that manipulates multiple message 254 * can be something more complex that manipulates multiple message
255 * functions. 255 * functions.
256 * 256 *
257 * In either case, the purpose of this is to delay calling [message_function] 257 * In either case, the purpose of this is to delay calling [message_function]
258 * until the proper locale has been set. This returns the result of calling 258 * until the proper locale has been set. This returns the result of calling
259 * [msg_function], which could be of an arbitrary type. 259 * [message_function], which could be of an arbitrary type.
260 */ 260 */
261 static withLocale(String locale, Function message_function) { 261 static withLocale(String locale, Function message_function) {
262 // We have to do this silliness because Locale is not known at compile time, 262 // We have to do this silliness because Locale is not known at compile time,
263 // but must be a static variable in order to be visible to the Intl.message 263 // but must be a static variable in order to be visible to the Intl.message
264 // invocation. 264 // invocation.
265 var oldLocale = getCurrentLocale(); 265 var oldLocale = getCurrentLocale();
266 _defaultLocale = locale; 266 _defaultLocale = locale;
267 var result = message_function(); 267 var result = message_function();
268 _defaultLocale = oldLocale; 268 _defaultLocale = oldLocale;
269 return result; 269 return result;
(...skipping 18 matching lines...) Expand all
288 * unless for some reason this gets called inside a message that resets the 288 * unless for some reason this gets called inside a message that resets the
289 * locale. 289 * locale.
290 */ 290 */
291 static String getCurrentLocale() { 291 static String getCurrentLocale() {
292 if (_defaultLocale == null) _defaultLocale = systemLocale; 292 if (_defaultLocale == null) _defaultLocale = systemLocale;
293 return _defaultLocale; 293 return _defaultLocale;
294 } 294 }
295 295
296 toString() => "Intl($locale)"; 296 toString() => "Intl($locale)";
297 } 297 }
OLDNEW
« no previous file with comments | « pkg/intl/lib/generate_localized.dart ('k') | pkg/intl/lib/message_lookup_by_library.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698