*/
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 */
{"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"},
TESTCASE_AUTO(TestToLanguageTag);
TESTCASE_AUTO(TestMoveAssign);
TESTCASE_AUTO(TestMoveCtor);
+ TESTCASE_AUTO(TestBug20407iVariantPreferredValue);
TESTCASE_AUTO(TestBug13417VeryLongLanguageTag);
TESTCASE_AUTO(TestBug11053UnderlineTimeZone);
TESTCASE_AUTO_END;
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()");
void TestMoveAssign();
void TestMoveCtor();
+ void TestBug20407iVariantPreferredValue();
+
void TestBug13417VeryLongLanguageTag();
void TestBug11053UnderlineTimeZone();
{ "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 */
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>();