From 168c97f32ab669a5787898d2b01399a15edf6176 Mon Sep 17 00:00:00 2001 From: Fredrik Roubert Date: Fri, 15 Feb 2019 20:42:18 +0100 Subject: [PATCH] ICU-20431 Both und_XX and _XX should fall back to the default locale --- icu4c/source/common/uresbund.cpp | 3 +++ icu4c/source/test/intltest/dtptngts.cpp | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/icu4c/source/common/uresbund.cpp b/icu4c/source/common/uresbund.cpp index 87c813c1777..050746da697 100644 --- a/icu4c/source/common/uresbund.cpp +++ b/icu4c/source/common/uresbund.cpp @@ -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; } diff --git a/icu4c/source/test/intltest/dtptngts.cpp b/icu4c/source/test/intltest/dtptngts.cpp index 90c85e7bcad..74c444fd304 100644 --- a/icu4c/source/test/intltest/dtptngts.cpp +++ b/icu4c/source/test/intltest/dtptngts.cpp @@ -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; -- 2.40.0