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

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

Issue 11086033: Make verifiedLocale work differently depending on what it's verifying for (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 | « pkg/intl/lib/message_lookup_local.dart ('k') | pkg/intl/test/intl_message_basic_example_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/intl/lib/number_format.dart
===================================================================
--- pkg/intl/lib/number_format.dart (revision 13446)
+++ pkg/intl/lib/number_format.dart (working copy)
@@ -52,7 +52,7 @@
* [locale].
*/
NumberFormat([String newPattern, String locale]):
- _locale = Intl.verifiedLocale(locale) {
+ _locale = Intl.verifiedLocale(locale, localeExists) {
// TODO(alanknight): There will need to be some kind of async setup
// operations so as not to bring along every locale in every program.
_symbols = numberFormatSymbols[_locale];
@@ -65,6 +65,15 @@
String get locale => _locale;
/**
+ * Return true if the locale exists, or if it is null. The null case
+ * is interpreted to mean that we use the default locale.
+ */
+ static bool localeExists(localeName) {
+ if (localeName == null) return false;
+ return numberFormatSymbols.containsKey(localeName);
+ }
+
+ /**
* Return the symbols which are used in our locale. Cache them to avoid
* repeated lookup.
*/
« no previous file with comments | « pkg/intl/lib/message_lookup_local.dart ('k') | pkg/intl/test/intl_message_basic_example_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698