#include "unicode/bytestream.h"
#include "unicode/locid.h"
+#include "unicode/localebuilder.h"
#include "unicode/strenum.h"
#include "unicode/stringpiece.h"
#include "unicode/uloc.h"
// Cannot use nullptr for language because that will construct
// the default locale, in that case, use "und" to get the correct
// locale.
- Locale l(language == nullptr ? "und" : language, nullptr, script);
+ Locale l = LocaleBuilder()
+ .setLanguage(language == nullptr ? "und" : language)
+ .setScript(script)
+ .build(status);
l.addLikelySubtags(status);
const char* likelyRegion = l.getCountry();
CharString* item = nullptr;
{ "ja-Latn-hepburn-heploc", "ja-Latn-alalc97"},
{ "aaa-Fooo-SU", "aaa-Fooo-RU"},
+
+ // ICU-21344
+ { "ku-Arab-NT", "ku-Arab-IQ"},
};
int32_t i;
for (i=0; i < UPRV_LENGTHOF(testCases); i++) {
Assert.assertEquals("ja-Latn-alalc97", canonicalTag("ja-Latn-hepburn-heploc"));
Assert.assertEquals("aaa-Fooo-RU", canonicalTag("aaa-Fooo-SU"));
+
+ // ICU-21344
+ Assert.assertEquals("ku-Arab-IQ", canonicalTag("ku-Arab-NT"));
}
@Test