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

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

Issue 11265028: Tolerate null from finding browser locale, re-enable tests (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 | « no previous file | pkg/pkg.status » ('j') | pkg/pkg.status » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/intl/lib/intl.dart
===================================================================
--- pkg/intl/lib/intl.dart (revision 14088)
+++ pkg/intl/lib/intl.dart (working copy)
@@ -193,8 +193,10 @@
}
/**
- * Return a locale name turned into xx_YY where it might possibly be
- * in the wrong case or with a hyphen instead of an underscore.
+ * Return the name [aLocale] turned into xx_YY where it might possibly be
+ * in the wrong case or with a hyphen instead of an underscore. If
+ * [aLocale] is null, for example, if you tried to get it from IE,
+ * return the current system locale.
*/
static String canonicalizedLocale(String aLocale) {
// Locales of length < 5 are presumably two-letter forms, or else malformed.
@@ -203,6 +205,7 @@
// We treat C as a special case, and assume it wants en_ISO for formatting.
// TODO(alanknight): en_ISO is probably not quite right for the C/Posix
// locale for formatting. Consider adding C to the formats database.
+ if (aLocale == null) return systemLocale;
if (aLocale == "C") return "en_ISO";
if ((aLocale.length < 5) || (aLocale.length > 6)) return aLocale;
if (aLocale[2] != '-' && (aLocale[2] != '_')) return aLocale;
« no previous file with comments | « no previous file | pkg/pkg.status » ('j') | pkg/pkg.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698