1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
// Grandfathered tags without a preferred value in the IANA language
// tag registry. Nonetheless, ICU cooks up a value when canonicalizing.
// v8 works around that ICU issue.
// See https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry .
["cel-gaulish", "cel-gaulish"],
["i-default", "i-default"],
["i-mingo", "i-mingo"],
["i-enochian", "i-enochian"],
["zh-min", "zh-min"],
// Matching should be case-insensitive.
["I-default", "i-default"],
["i-DEFAULT", "i-default"],
["I-DEFAULT", "i-default"],
["i-DEfauLT", "i-default"],
["zh-Min", "zh-min"],
["Zh-min", "zh-min"],
].forEach(([inputLocale, expectedLocale]) => {
const canonicalLocales = Intl.getCanonicalLocales(inputLocale);
assertEquals(canonicalLocales.length, 1);
assertEquals(canonicalLocales[0], expectedLocale);
})
|