You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Locale.fromSubtags and support for scriptCode. (#6518)
* Add Locale.fromComponents.
* Change toString from underscores to dashes. Expand the unit tests.
* Rename 'fromComponents' to 'create'. Change variants from String to List<String>.
* Use default for language parameter. Use hashCode/hashList.
* Have toString() stick with old (underscore) behaviour.
* Demonstrate empty-list bug in assert code.
* Fix empty-list assert bug.
* Add ignores for lint issues. Unsure about 71340 though.
* Fix operator== via _listEquals.
* Remove length-checking asserts: we're anyway not checking characters in fields.
* Documentation update.
* Change reasoning for ignore:prefer_initializing_formals.
* Try 'fromSubtags' as new constructor name.
* Documentation improvements based on Pull Request review.
* Assert-fail for invalid-length subtags and drop bad subtags in production code.
* Revert "Assert-fail for invalid-length subtags and drop bad subtags in production code."
This reverts commit d6f06f5e7b3537d60000c47641580475ef16abbe.
* Re-fix Locale.toString() for variants=[].
* Tear out variants, in case we want to have one fewer pointer in the future.
* Make named parameters' names consistent with member names.
* Also remove _listEquals: no longer in use.
* Lint fix.
* Fix code review nits.
* Lint fix for assert, and a couple more not-zero-length-string asserts.
* Code Review: two of three nits addressed...
* Review fix: change 'should' to 'must' for subtag prescriptions.
* Assert-check that countryCode is never ''.
/// [region](http://unicode.org/cldr/latest/common/validity/region.xml). The
154
+
/// primary language subtag must be at least two and at most eight lowercase
155
+
/// letters, but not four letters. The region region subtag must be two
156
+
/// uppercase letters or three digits. See the [Unicode Language
/// [script](http://unicode.org/cldr/latest/common/validity/script.xml) and
183
+
/// [region](http://unicode.org/cldr/latest/common/validity/region.xml) for
184
+
/// each of languageCode, scriptCode and countryCode respectively.
185
+
///
186
+
/// Validity is not checked by default, but some methods may throw away
187
+
/// invalid data.
188
+
constLocale.fromSubtags({
189
+
String languageCode ='und',
190
+
this.scriptCode,
191
+
String countryCode,
192
+
}) :assert(languageCode !=null),
193
+
assert(languageCode !=''),
194
+
_languageCode = languageCode,
195
+
assert(scriptCode !=''),
196
+
assert(countryCode !=''),
197
+
_countryCode = countryCode;
154
198
155
199
/// The primary language subtag for the locale.
156
200
///
157
-
/// This must not be null.
201
+
/// This must not be null. It may be 'und', representing 'undefined'.
158
202
///
159
203
/// This is expected to be string registered in the [IANA Language Subtag
0 commit comments