diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/tests/non262/Intl/unicode-bcp47-locale-ids-language-mappings.js | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/non262/Intl/unicode-bcp47-locale-ids-language-mappings.js')
-rw-r--r-- | js/src/tests/non262/Intl/unicode-bcp47-locale-ids-language-mappings.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/js/src/tests/non262/Intl/unicode-bcp47-locale-ids-language-mappings.js b/js/src/tests/non262/Intl/unicode-bcp47-locale-ids-language-mappings.js new file mode 100644 index 0000000000..a37cd603a0 --- /dev/null +++ b/js/src/tests/non262/Intl/unicode-bcp47-locale-ids-language-mappings.js @@ -0,0 +1,39 @@ +// |reftest| skip-if(!this.hasOwnProperty("Intl")) + +// For the most part the mappings from IANA are a subset of the CLDR mappings. +// So there are mappings which are consistent across both databases. +assertEq(Intl.getCanonicalLocales("iw")[0], "he"); + +// But some languages are mapped differently. +// +// From the IANA language data registry: +// Type: language +// Subtag: drh +// Description: Darkhat +// Added: 2009-07-29 +// Deprecated: 2010-03-11 +// Preferred-Value: khk +// +// From CLDR: +// <languageAlias type="drh" replacement="mn" reason="deprecated"/> +// +// because CLDR also maps macro-languages: +// <languageAlias type="khk" replacement="mn" reason="macrolanguage"/> +assertEq(Intl.getCanonicalLocales("drh")[0], "mn"); + +// CLDR maps macro-languages: +// <languageAlias type="cmn" replacement="zh" reason="macrolanguage"/> +assertEq(Intl.getCanonicalLocales("cmn")[0], "zh"); + +// CLDR also contains mappings from ISO-639-2 (B/T) to 639-1 codes: +// <languageAlias type="dut" replacement="nl" reason="bibliographic"/> +// <languageAlias type="nld" replacement="nl" reason="overlong"/> +assertEq(Intl.getCanonicalLocales("dut")[0], "nl"); +assertEq(Intl.getCanonicalLocales("nld")[0], "nl"); + +// CLDR has additional mappings for legacy language codes. +// <languageAlias type="no" replacement="nb" reason="legacy"/> +assertEq(Intl.getCanonicalLocales("no")[0], "nb"); + +if (typeof reportCompare === "function") + reportCompare(true, true); |