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

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

Issue 23033028: Make defaultLocale public (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/intl/lib/intl.dart
diff --git a/pkg/intl/lib/intl.dart b/pkg/intl/lib/intl.dart
index a15abedd8f47405c9276b54336f64c117af59a55..4f17a827fabaaa613a4b5403a1990771adde988e 100644
--- a/pkg/intl/lib/intl.dart
+++ b/pkg/intl/lib/intl.dart
@@ -81,6 +81,11 @@ part 'number_format.dart';
* produce "I see 2 other people in Athens." as output in the default locale.
*
* To use a locale other than the default, use the `withLocale` function.
+ * You can set the default locale.
+ * Intl.defaultLocale = "pt_BR";
+ *
+ * To temporarily use a locale other than the default, use the `withLocale`
+ * function.
* var todayString = new DateFormat("pt_BR").format(new DateTime.now());
* print(withLocale("pt_BR", () => today(todayString));
*
@@ -99,7 +104,7 @@ class Intl {
* 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;
/**
* The system's locale, as obtained from the window.navigator.language
@@ -345,9 +350,9 @@ class Intl {
// but must be a static variable in order to be visible to the Intl.message
// invocation.
var oldLocale = getCurrentLocale();
- _defaultLocale = locale;
+ defaultLocale = locale;
var result = message_function();
- _defaultLocale = oldLocale;
+ defaultLocale = oldLocale;
return result;
}
@@ -357,8 +362,8 @@ class Intl {
* locale.
*/
static String getCurrentLocale() {
- if (_defaultLocale == null) _defaultLocale = systemLocale;
- return _defaultLocale;
+ if (defaultLocale == null) defaultLocale = systemLocale;
+ return defaultLocale;
}
toString() => "Intl($locale)";
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698