Canonicalize the locale in Intl.defaultLocale setter

PiperOrigin-RevId: 273643404
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6f12923..d73236a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
  * Add an analysis_options.yaml and fix or suppress all the complaints from it.
  * Add unit tests using dart:ffi to compare formatting output to ICU.
  * Bump SDK requirements up to 2.5.0 for dart:ffi availability.
+ * Canonicalize the locale in the Intl.defaultLocale setter, so e.g. 'en-US'
+   will get turned into the correct 'en_US'
 
 ## 0.16.0
  * Fix 'k' formatting (1 to 24 hours) which incorrectly showed 0 to 23.
diff --git a/lib/intl.dart b/lib/intl.dart
index f4120c7..ec8a00d 100644
--- a/lib/intl.dart
+++ b/lib/intl.dart
@@ -99,7 +99,7 @@
   }
 
   static set defaultLocale(String newLocale) {
-    _defaultLocale = newLocale;
+    _defaultLocale = canonicalizedLocale(newLocale);
   }
 
   static String _defaultLocale;