From 642929b2a3c4ef3b9be1267cfd157bcf23e08734 Mon Sep 17 00:00:00 2001
From: Frank Yung-Fong Tang <41213225+FrankYFTang@users.noreply.github.com>
Date: Thu, 7 Feb 2019 17:48:40 -0800
Subject: [PATCH] correct value that matches languageAlias in
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Per https://tc39.github.io/ecma402/#sec-canonicalizelanguagetag
6.2.3 CanonicalizeLanguageTag ( locale )
The CanonicalizeLanguageTag abstract operation returns the canonical and case-regularized form of the locale argument (which must be a String value that is a structurally valid Unicode BCP 47 Locale Identifier as verified by the IsStructurallyValidLanguageTag abstract operation). A conforming implementation shall take the steps specified in the “BCP 47 Language Tag to Unicode BCP 47 Locale Identifier” algorithm, from Unicode Technical Standard #35 LDML § 3.3.1 BCP 47 Language Tag Conversion.
And
http://unicode.org/reports/tr35/#BCP_47_Language_Tag_Conversion
"
2. If the BCP 47 primary language subtag matches the type attribute of a languageAlias element in Supplemental Data, replace the language subtag with the replacement value.
If there are additional subtags in the replacement value, add them to the result, but only if there is no corresponding subtag already in the tag.
"
and
https://www.unicode.org/repos/cldr/trunk/common/supplemental/supplementalMetadata.xml
...
...
...
---
.../Locale/constructor-non-iana-canon.js | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/test/intl402/Locale/constructor-non-iana-canon.js b/test/intl402/Locale/constructor-non-iana-canon.js
index fe1a79c375..8bc486dccf 100644
--- a/test/intl402/Locale/constructor-non-iana-canon.js
+++ b/test/intl402/Locale/constructor-non-iana-canon.js
@@ -52,9 +52,19 @@ var testData = [
},
{
tag: "aar-x-private",
- },
+ // "aar" should be canonicalized into "aa" because "aar" matches the type attribute of
+ // a languageAlias element in
+ // https://www.unicode.org/repos/cldr/trunk/common/supplemental/supplementalMetadata.xml
+ canonical: "aa-x-private",
+ maximized: "aa-Latn-ET-x-private",
+ },
{
tag: "heb-x-private",
+ // "heb" should be canonicalized into "he" because "heb" matches the type attribute of
+ // a languageAlias element in
+ // https://www.unicode.org/repos/cldr/trunk/common/supplemental/supplementalMetadata.xml
+ canonical: "he-x-private",
+ maximized: "he-Hebr-IL-x-private",
},
{
tag: "de-u-kf",
@@ -62,6 +72,11 @@ var testData = [
},
{
tag: "ces",
+ // "ces" should be canonicalized into "cs" because "ces" matches the type attribute of
+ // a languageAlias element in
+ // https://www.unicode.org/repos/cldr/trunk/common/supplemental/supplementalMetadata.xml
+ canonical: "cs",
+ maximized: "cs-Latn-CZ",
},
{
tag: "hy-arevela",