ICU-12801 Fixing TestLocaleStructure failure triggered by the new locale 'ckb'.

X-SVN-Rev: 39447
This commit is contained in:
Yoshito Umaoka 2016-10-13 18:57:12 +00:00
parent 5abe054173
commit 4e96e53a07

View File

@ -215,11 +215,8 @@ ILCID_POSIX_ELEMENT_ARRAY(0x045c, chr,chr_US)
ILCID_POSIX_SUBTABLE(ckb) {
{0x92, "ckb"},
{0x92, "ku"},
{0x7c92, "ckb_Arab"},
{0x7c92, "ku_Arab"},
{0x0492, "ckb_Arab_IQ"},
{0x0492, "ku_Arab_IQ"}
{0x0492, "ckb_Arab_IQ"}
};
/* Declared as cs_CZ to get around compiler errors on z/OS, which defines cs as a function */
@ -1021,33 +1018,40 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr
const char *pPosixID = NULL;
#ifdef USE_WINDOWS_LOCALE_API
int32_t tmpLen = 0;
char locName[157]; /* ULOC_FULLNAME_CAPACITY */
// Note: Windows primary lang ID 0x92 in LCID is used for Central Kurdish and
// GetLocaleInfo() maps such LCID to "ku". However, CLDR uses "ku" for
// Northern Kurdish and "ckb" for Central Kurdish. For this reason, we cannot
// use the Windows API to resolve locale ID for this specific case.
if (hostid & 0x3FF != 0x92) {
int32_t tmpLen = 0;
char locName[157]; /* ULOC_FULLNAME_CAPACITY */
tmpLen = GetLocaleInfoA(hostid, LOCALE_SNAME, (LPSTR)locName, UPRV_LENGTHOF(locName));
if (tmpLen > 1) {
/* Windows locale name may contain sorting variant, such as "es-ES_tradnl".
In such case, we need special mapping data found in the hardcoded table
in this source file. */
char *p = uprv_strchr(locName, '_');
if (p) {
/* Keep the base locale, without variant */
*p = 0;
tmpLen = uprv_strlen(locName);
} else {
/* No hardcoded table lookup necessary */
bLookup = FALSE;
}
/* Change the tag separator from '-' to '_' */
p = locName;
while (*p) {
if (*p == '-') {
*p = '_';
tmpLen = GetLocaleInfoA(hostid, LOCALE_SNAME, (LPSTR)locName, UPRV_LENGTHOF(locName));
if (tmpLen > 1) {
/* Windows locale name may contain sorting variant, such as "es-ES_tradnl".
In such case, we need special mapping data found in the hardcoded table
in this source file. */
char *p = uprv_strchr(locName, '_');
if (p) {
/* Keep the base locale, without variant */
*p = 0;
tmpLen = uprv_strlen(locName);
}
p++;
else {
/* No hardcoded table lookup necessary */
bLookup = FALSE;
}
/* Change the tag separator from '-' to '_' */
p = locName;
while (*p) {
if (*p == '-') {
*p = '_';
}
p++;
}
FIX_LANGUAGE_ID_TAG(locName, tmpLen);
pPosixID = locName;
}
FIX_LANGUAGE_ID_TAG(locName, tmpLen);
pPosixID = locName;
}
#endif
if (bLookup) {