]> granicus.if.org Git - icu/commitdiff
ICU-20431 Both und_XX and _XX should fall back to the default locale
authorFredrik Roubert <roubert@google.com>
Fri, 15 Feb 2019 19:42:18 +0000 (20:42 +0100)
committerFredrik Roubert <fredrik@roubert.name>
Wed, 20 Feb 2019 12:06:51 +0000 (13:06 +0100)
icu4c/source/common/uresbund.cpp
icu4c/source/test/intltest/dtptngts.cpp

index 87c813c1777a2b013f29c70b504333ddfeb1cdf7..050746da69773da1f225f616b50f416eb7446354 100644 (file)
@@ -489,6 +489,9 @@ findFirstExisting(const char* path, char* name,
 
         /*Fallback data stuff*/
         *hasChopped = chopLocale(name);
+        if (*hasChopped && *name == '\0') {
+            uprv_strcpy(name, "und");
+        }
     }
     return r;
 }
index 90c85e7bcad05e980a198ba25fa100946c69c315..74c444fd304f23c02e33199aea067a89b008d8fc 100644 (file)
@@ -1120,7 +1120,8 @@ void IntlTestDateTimePatternGeneratorAPI::testC() {
     UErrorCode status = U_ZERO_ERROR;
     int32_t numTests = UPRV_LENGTHOF(tests);
     for (int32_t i = 0; i < numTests; ++i) {
-        DateTimePatternGenerator *gen = DateTimePatternGenerator::createInstance(Locale(tests[i][0]), status);
+        DateTimePatternGenerator *gen = DateTimePatternGenerator::createInstance(
+                Locale::forLanguageTag(tests[i][0], status), status);
         if (gen == NULL) {
             dataerrln("FAIL: DateTimePatternGenerator::createInstance failed for %s", tests[i][0]);
             return;