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

Unified Diff: pkg/intl/lib/intl.dart

Issue 11038007: Minor cleanups to take advantage of lazy initialization (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/intl/lib/src/lazy_locale_data.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/intl/lib/intl.dart
===================================================================
--- pkg/intl/lib/intl.dart (revision 13089)
+++ pkg/intl/lib/intl.dart (working copy)
@@ -25,7 +25,7 @@
* can also be set explicitly, and will then apply to any new instances where
* the locale isn't specified.
*/
- static String _defaultLocale;
+ static String _defaultLocale = systemLocale;
Emily Fortuna 2012/10/02 00:17:19 sorry, why are the changes in this file preferable
Alan Knight 2012/10/02 00:24:29 It sets the systemLocale on creation so it can avo
Emily Fortuna 2012/10/02 00:48:35 Seems good if we can initialize systemLocale and _
Alan Knight 2012/10/02 16:21:42 No, we can't, because getting the real value may i
Emily Fortuna 2012/10/02 17:11:37 Right, that's what I figured. So are we going to m
Alan Knight 2012/10/02 20:22:03 I don't want to make withLocale async. The only op
/**
* The system's locale, as obtained from the window.navigator.language
@@ -167,8 +167,7 @@
static String withLocale(String locale, Function msg_function) {
// We have to do this silliness because Locale is not known at compile time,
// but must be a static variable.
- if (_defaultLocale == null) _defaultLocale = systemLocale;
- var oldLocale = _defaultLocale;
+ var oldLocale = _defaultLocale;
Emily Fortuna 2012/10/02 00:17:19 alert alert spurious whitespace
Alan Knight 2012/10/02 00:24:29 Done.
_defaultLocale = locale;
var result = msg_function();
_defaultLocale = oldLocale;
@@ -195,7 +194,6 @@
* locale.
*/
static String getCurrentLocale() {
- if (_defaultLocale == null) _defaultLocale = systemLocale;
return _defaultLocale;
}
}
« no previous file with comments | « no previous file | pkg/intl/lib/src/lazy_locale_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698