ICU-20639 Add "mol" 3-letter language code to C++ map.
diff --git a/icu4c/source/common/uloc.cpp b/icu4c/source/common/uloc.cpp
index 73b4320..e032229 100644
--- a/icu4c/source/common/uloc.cpp
+++ b/icu4c/source/common/uloc.cpp
@@ -148,7 +148,8 @@
"mad", "maf", "mag", "mai", "mak", "man", "mas", "mde",
"mdf", "mdh", "mdr", "men", "mer", "mfe", "mg", "mga",
"mgh", "mgo", "mh", "mi", "mic", "min", "mis", "mk",
- "ml", "mn", "mnc", "mni", "moh", "mos", "mr", "mrj",
+ "ml", "mn", "mnc", "mni", "mo",
+ "moh", "mos", "mr", "mrj",
"ms", "mt", "mua", "mul", "mus", "mwl", "mwr", "mwv",
"my", "mye", "myv", "mzn",
"na", "nan", "nap", "naq", "nb", "nd", "nds", "ne",
@@ -264,7 +265,8 @@
"mad", "maf", "mag", "mai", "mak", "man", "mas", "mde",
"mdf", "mdh", "mdr", "men", "mer", "mfe", "mlg", "mga",
"mgh", "mgo", "mah", "mri", "mic", "min", "mis", "mkd",
- "mal", "mon", "mnc", "mni", "moh", "mos", "mar", "mrj",
+ "mal", "mon", "mnc", "mni", "mol",
+ "moh", "mos", "mar", "mrj",
"msa", "mlt", "mua", "mul", "mus", "mwl", "mwr", "mwv",
"mya", "mye", "myv", "mzn",
"nau", "nan", "nap", "naq", "nob", "nde", "nds", "nep",
diff --git a/icu4c/source/test/intltest/loctest.cpp b/icu4c/source/test/intltest/loctest.cpp
index 79cb887..356ef64 100644
--- a/icu4c/source/test/intltest/loctest.cpp
+++ b/icu4c/source/test/intltest/loctest.cpp
@@ -221,6 +221,7 @@
TESTCASE_AUTO(Test4147317);
TESTCASE_AUTO(Test4147552);
TESTCASE_AUTO(TestVariantParsing);
+ TESTCASE_AUTO(Test20639_DeprecatesISO3Language);
#if !UCONFIG_NO_FORMATTING
TESTCASE_AUTO(Test4105828);
#endif
@@ -901,8 +902,8 @@
;
/* TODO: Change this test to be more like the cloctst version? */
- if (testCount != 595)
- errln("Expected getISOLanguages() to return 595 languages; it returned %d", testCount);
+ if (testCount != 596)
+ errln("Expected getISOLanguages() to return 596 languages; it returned %d", testCount);
else {
for (i = 0; i < 15; i++) {
int32_t j;
@@ -1577,6 +1578,27 @@
}
}
+void LocaleTest::Test20639_DeprecatesISO3Language() {
+ IcuTestErrorCode status(*this, "Test20639_DeprecatesISO3Language");
+
+ const struct TestCase {
+ const char* localeName;
+ const char* expectedISO3Language;
+ } cases[] = {
+ {"nb", "nob"},
+ {"no", "nor"}, // why not nob?
+ {"he", "heb"},
+ {"iw", "heb"},
+ {"ro", "ron"},
+ {"mo", "mol"},
+ };
+ for (auto& cas : cases) {
+ Locale loc(cas.localeName);
+ const char* actual = loc.getISO3Language();
+ assertEquals(cas.localeName, cas.expectedISO3Language, actual);
+ }
+}
+
#if !UCONFIG_NO_FORMATTING
/**
diff --git a/icu4c/source/test/intltest/loctest.h b/icu4c/source/test/intltest/loctest.h
index 6b6b3a6..72e3a82 100644
--- a/icu4c/source/test/intltest/loctest.h
+++ b/icu4c/source/test/intltest/loctest.h
@@ -69,6 +69,8 @@
void Test4147315(void);
void Test4147317(void);
void Test4147552(void);
+
+ void Test20639_DeprecatesISO3Language();
void TestVariantParsing(void);
diff --git a/icu4c/source/test/testdata/structLocale.txt b/icu4c/source/test/testdata/structLocale.txt
index 466ba9d..c30a534 100644
--- a/icu4c/source/test/testdata/structLocale.txt
+++ b/icu4c/source/test/testdata/structLocale.txt
@@ -5806,6 +5806,7 @@
mn{""}
mnc{""}
mni{""}
+ mo{""}
moh{""}
mos{""}
mr{""}
diff --git a/icu4j/main/tests/localespi/src/com/ibm/icu/dev/test/localespi/LocaleNameTest.java b/icu4j/main/tests/localespi/src/com/ibm/icu/dev/test/localespi/LocaleNameTest.java
index 651f436..c13bc0c 100644
--- a/icu4j/main/tests/localespi/src/com/ibm/icu/dev/test/localespi/LocaleNameTest.java
+++ b/icu4j/main/tests/localespi/src/com/ibm/icu/dev/test/localespi/LocaleNameTest.java
@@ -276,4 +276,21 @@
}
}
}
+
+ @Test
+ public void Test20639_DeprecatesISO3Language() {
+ String[][] cases = new String[][]{
+ {"nb", "nob"},
+ {"no", "nor"}, // why not nob?
+ {"he", "heb"},
+ {"iw", "heb"},
+ {"ro", "ron"},
+ {"mo", "mol"},
+ };
+ for (String[] cas : cases) {
+ ULocale loc = new ULocale(cas[0]);
+ String actual = loc.getISO3Language();
+ assertEquals(cas[0], cas[1], actual);
+ }
+ }
}