]> granicus.if.org Git - icu/commitdiff
ICU-20407 hy-arevela/hy-arevmda can. into hy / hyw
authorFrank Tang <ftang@chromium.org>
Thu, 14 Feb 2019 23:24:15 +0000 (15:24 -0800)
committerFrank Yung-Fong Tang <41213225+FrankYFTang@users.noreply.github.com>
Fri, 15 Feb 2019 20:40:47 +0000 (12:40 -0800)
icu4c/source/common/uloc.cpp
icu4c/source/test/cintltst/cloctst.c
icu4c/source/test/intltest/loctest.cpp
icu4c/source/test/intltest/loctest.h
icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java
icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ULocaleTest.java

index a4902effae5e8dc0c31cf2da1bfb97378c92ac3c..a057491742e7c010571217a921426732e38e9e23 100644 (file)
@@ -465,6 +465,8 @@ typedef struct CanonicalizationMap {
  */
 static const CanonicalizationMap CANONICALIZE_MAP[] = {
     { "art_LOJBAN",     "jbo" }, /* registered name */
+    { "hy__AREVELA",    "hy" }, /* Registered IANA variant */
+    { "hy__AREVMDA",    "hyw" }, /* Registered IANA variant */
     { "zh_GAN",         "gan" }, /* registered name */
     { "zh_GUOYU",       "zh" }, /* registered name */
     { "zh_HAKKA",       "hak" }, /* registered name */
index 6aec8ef47a5b3cc1889213e41cd914e72bbd5420..09de64c874eb682839a3843724e6ff2588e7168e 100644 (file)
@@ -423,9 +423,7 @@ static void TestPrefixes() {
         {"i-hakka", "", "CN", "", "i-hakka_CN", "i-hakka_CN", NULL},
         {"i-hakka", "", "MX", "", "I-hakka_MX", "i-hakka_MX", NULL},
         {"x-klingon", "", "US", "SANJOSE", "X-KLINGON_us_SANJOSE", "x-klingon_US_SANJOSE", NULL},
-        
-        {"hy", "", "", "AREVMDA", "hy_AREVMDA", "hy__AREVMDA", NULL},
-        
+        {"hy", "", "", "AREVMDA", "hy_AREVMDA", "hy__AREVMDA", "hyw"},
         {"de", "", "", "1901", "de-1901", "de__1901", NULL},
         {"mr", "", "", "", "mr.utf8", "mr.utf8", "mr"},
         {"de", "", "TV", "", "de-tv.koi8r", "de_TV.koi8r", "de_TV"},
index 3e0c5cbf5857bc62ad490d70bcb487a70311aa88..e3de596b2eca36554b9ace2d5bb5d92113d3a5ce 100644 (file)
@@ -252,6 +252,7 @@ void LocaleTest::runIndexedTest( int32_t index, UBool exec, const char* &name, c
     TESTCASE_AUTO(TestToLanguageTag);
     TESTCASE_AUTO(TestMoveAssign);
     TESTCASE_AUTO(TestMoveCtor);
+    TESTCASE_AUTO(TestBug20407iVariantPreferredValue);
     TESTCASE_AUTO(TestBug13417VeryLongLanguageTag);
     TESTCASE_AUTO(TestBug11053UnderlineTimeZone);
     TESTCASE_AUTO_END;
@@ -3163,6 +3164,24 @@ void LocaleTest::TestMoveCtor() {
     assertEquals("bogus", l7.isBogus(), l8.isBogus());
 }
 
+void LocaleTest::TestBug20407iVariantPreferredValue() {
+    IcuTestErrorCode status(*this, "TestBug20407iVariantPreferredValue()");
+
+    Locale l = Locale::forLanguageTag("hy-arevela", status);
+    status.errIfFailureAndReset("hy-arevela fail");
+    assertTrue("!l.isBogus()", !l.isBogus());
+
+    std::string result = l.toLanguageTag<std::string>(status);
+    assertEquals(l.getName(), "hy", result.c_str());
+
+    l = Locale::forLanguageTag("hy-arevmda", status);
+    status.errIfFailureAndReset("hy-arevmda");
+    assertTrue("!l.isBogus()", !l.isBogus());
+
+    result = l.toLanguageTag<std::string>(status);
+    assertEquals(l.getName(), "hyw", result.c_str());
+}
+
 void LocaleTest::TestBug13417VeryLongLanguageTag() {
     IcuTestErrorCode status(*this, "TestBug13417VeryLongLanguageTag()");
 
index 1ea9f2d6dfd8b8dc45d35b24532a94222f764eb6..bebb26cebca4d1e7f307a015351a86acad5c3faf 100644 (file)
@@ -124,6 +124,8 @@ public:
     void TestMoveAssign();
     void TestMoveCtor();
 
+    void TestBug20407iVariantPreferredValue();
+
     void TestBug13417VeryLongLanguageTag();
 
     void TestBug11053UnderlineTimeZone();
index 54827e38e534d8549ef78e8de8fee5c64db0ed8a..785e790684fe3936bee3c7fc18547af453876d29 100644 (file)
@@ -342,6 +342,8 @@ public final class ULocale implements Serializable, Comparable<ULocale> {
         { "de_1906",        "de__1906" }, /* registered name */
         { "en_BOONT",       "en__BOONT" }, /* registered name */
         { "en_SCOUSE",      "en__SCOUSE" }, /* registered name */
+        { "hy__AREVELA",    "hy", null, null }, /* Registered IANA variant */
+        { "hy__AREVMDA",    "hyw", null, null }, /* Registered IANA variant */
         { "sl_ROZAJ",       "sl__ROZAJ" }, /* registered name */
         { "zh_GAN",         "zh__GAN" }, /* registered name */
         { "zh_GUOYU",       "zh" }, /* registered name */
index 5b657c8f8ee66710b7ecd5ab25d643c819229f1b..0d5365727a6972d0fdaf0cdb38a2dcafe5d0d55b 100644 (file)
@@ -1489,6 +1489,14 @@ public class ULocaleTest extends TestFmwk {
         assertEquals("foobar", target, name);
     }
 
+    @Test
+    public void TestBug20407iVariantPreferredValue() {
+        ULocale uloc = ULocale.createCanonical("hy-arevela");
+        assertEquals("getName()", "hy", uloc.getName());
+        uloc = ULocale.createCanonical("hy-arevmda");
+        assertEquals("getName()", "hyw", uloc.getName());
+    }
+
     private void initHashtable() {
         h[0] = new HashMap<String, String>();
         h[1] = new HashMap<String, String>();