mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 22:44:49 +00:00
ICU-11061 Import full bcp47 keys/types from CLDR. This change is corresponding to cldrbug:7249
X-SVN-Rev: 36151
This commit is contained in:
parent
ecf1e2f627
commit
a16ab10f50
3 changed files with 465 additions and 16 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 2009-2012, International Business Machines
|
||||
* Copyright (C) 2009-2014, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
*/
|
||||
|
@ -659,9 +659,16 @@ _ldmlKeyToBCP47(const char* key, int32_t keyLen,
|
|||
|
||||
uBcpKey = ures_getStringByKey(rb, keyBuf, &bcpKeyLen, &tmpStatus);
|
||||
if (U_SUCCESS(tmpStatus)) {
|
||||
u_UCharsToChars(uBcpKey, bcpKeyBuf, bcpKeyLen);
|
||||
bcpKeyBuf[bcpKeyLen] = 0;
|
||||
resultLen = bcpKeyLen;
|
||||
if (bcpKeyLen == 0) {
|
||||
/* empty value indicates the BCP47 key is same with the legacy key */
|
||||
uprv_memcpy(bcpKeyBuf, key, keyLen);
|
||||
bcpKeyBuf[keyLen] = 0;
|
||||
resultLen = keyLen;
|
||||
} else {
|
||||
u_UCharsToChars(uBcpKey, bcpKeyBuf, bcpKeyLen);
|
||||
bcpKeyBuf[bcpKeyLen] = 0;
|
||||
resultLen = bcpKeyLen;
|
||||
}
|
||||
} else {
|
||||
if (_isLDMLKey(key, keyLen)) {
|
||||
uprv_memcpy(bcpKeyBuf, key, keyLen);
|
||||
|
@ -722,14 +729,20 @@ _bcp47ToLDMLKey(const char* bcpKey, int32_t bcpKeyLen,
|
|||
const UChar *uBcpKey;
|
||||
char tmpBcpKeyBuf[MAX_BCP47_SUBTAG_LEN];
|
||||
int32_t tmpBcpKeyLen;
|
||||
const char *tmpBcpKey = tmpBcpKeyBuf;
|
||||
|
||||
uBcpKey = ures_getString(mapData, &tmpBcpKeyLen, status);
|
||||
if (U_FAILURE(*status)) {
|
||||
break;
|
||||
}
|
||||
u_UCharsToChars(uBcpKey, tmpBcpKeyBuf, tmpBcpKeyLen);
|
||||
tmpBcpKeyBuf[tmpBcpKeyLen] = 0;
|
||||
if (uprv_compareInvCharsAsAscii(bcpKeyBuf, tmpBcpKeyBuf) == 0) {
|
||||
if (tmpBcpKeyLen == 0) {
|
||||
/* empty value indicates the BCP47 key is same with the legacy key */
|
||||
tmpBcpKey = ures_getKey(mapData);
|
||||
} else {
|
||||
u_UCharsToChars(uBcpKey, tmpBcpKeyBuf, tmpBcpKeyLen);
|
||||
tmpBcpKeyBuf[tmpBcpKeyLen] = 0;
|
||||
}
|
||||
if (uprv_compareInvCharsAsAscii(bcpKeyBuf, tmpBcpKey) == 0) {
|
||||
/* found a matching BCP47 key */
|
||||
resKey = ures_getKey(mapData);
|
||||
resultLen = (int32_t)uprv_strlen(resKey);
|
||||
|
@ -823,8 +836,14 @@ _ldmlTypeToBCP47(const char* key, int32_t keyLen,
|
|||
typeMapForKey = ures_getByKey(rb, keyBuf, NULL, &tmpStatus);
|
||||
uBcpType = ures_getStringByKey(typeMapForKey, type, &bcpTypeLen, &tmpStatus);
|
||||
if (U_SUCCESS(tmpStatus)) {
|
||||
u_UCharsToChars(uBcpType, bcpTypeBuf, bcpTypeLen);
|
||||
resultLen = bcpTypeLen;
|
||||
if (bcpTypeLen == 0) {
|
||||
/* empty value indicates the BCP47 type is same with the legacy type */
|
||||
uprv_memcpy(bcpTypeBuf, type, typeLen);
|
||||
resultLen = typeLen;
|
||||
} else {
|
||||
u_UCharsToChars(uBcpType, bcpTypeBuf, bcpTypeLen);
|
||||
resultLen = bcpTypeLen;
|
||||
}
|
||||
} else if (tmpStatus == U_MISSING_RESOURCE_ERROR) {
|
||||
/* is this type alias? */
|
||||
tmpStatus = U_ZERO_ERROR;
|
||||
|
@ -846,8 +865,14 @@ _ldmlTypeToBCP47(const char* key, int32_t keyLen,
|
|||
/* look up the canonical type */
|
||||
uBcpType = ures_getStringByKey(typeMapForKey, typeBuf, &bcpTypeLen, &tmpStatus);
|
||||
if (U_SUCCESS(tmpStatus)) {
|
||||
u_UCharsToChars(uBcpType, bcpTypeBuf, bcpTypeLen);
|
||||
resultLen = bcpTypeLen;
|
||||
if (bcpTypeLen == 0) {
|
||||
/* empty value indicates the BCP47 type is same with the legacy type */
|
||||
uprv_memcpy(bcpTypeBuf, typeBuf, canonicalTypeLen);
|
||||
resultLen = canonicalTypeLen;
|
||||
} else {
|
||||
u_UCharsToChars(uBcpType, bcpTypeBuf, bcpTypeLen);
|
||||
resultLen = bcpTypeLen;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tmpStatus == U_MISSING_RESOURCE_ERROR) {
|
||||
|
@ -945,14 +970,20 @@ _bcp47ToLDMLType(const char* key, int32_t keyLen,
|
|||
const UChar *uBcpType;
|
||||
char tmpBcpTypeBuf[MAX_BCP47_SUBTAG_LEN];
|
||||
int32_t tmpBcpTypeLen;
|
||||
const char *tmpBcpType = tmpBcpTypeBuf;
|
||||
|
||||
uBcpType = ures_getString(mapData, &tmpBcpTypeLen, &tmpStatus);
|
||||
if (U_FAILURE(tmpStatus)) {
|
||||
break;
|
||||
}
|
||||
u_UCharsToChars(uBcpType, tmpBcpTypeBuf, tmpBcpTypeLen);
|
||||
tmpBcpTypeBuf[tmpBcpTypeLen] = 0;
|
||||
if (uprv_compareInvCharsAsAscii(bcpTypeBuf, tmpBcpTypeBuf) == 0) {
|
||||
if (tmpBcpTypeLen == 0) {
|
||||
/* empty value indicates the BCP47 type is same with the legacy type */
|
||||
tmpBcpType = ures_getKey(mapData);
|
||||
} else {
|
||||
u_UCharsToChars(uBcpType, tmpBcpTypeBuf, tmpBcpTypeLen);
|
||||
tmpBcpTypeBuf[tmpBcpTypeLen] = 0;
|
||||
}
|
||||
if (uprv_compareInvCharsAsAscii(bcpTypeBuf, tmpBcpType) == 0) {
|
||||
/* found a matching BCP47 type */
|
||||
resType = ures_getKey(mapData);
|
||||
resultLen = (int32_t)uprv_strlen(resType);
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
// *
|
||||
// ***************************************************************************
|
||||
keyTypeData:table(nofallback){
|
||||
bcpTypeAlias{
|
||||
ca{
|
||||
islamicc{"islamic-civil"}
|
||||
}
|
||||
}
|
||||
keyMap{
|
||||
calendar{"ca"}
|
||||
colalternate{"ka"}
|
||||
|
@ -20,7 +25,7 @@ keyTypeData:table(nofallback){
|
|||
colreorder{"kr"}
|
||||
colstrength{"ks"}
|
||||
currency{"cu"}
|
||||
kv{"kv"}
|
||||
kv{""}
|
||||
numbers{"nu"}
|
||||
timezone{"tz"}
|
||||
variabletop{"vt"}
|
||||
|
@ -33,19 +38,37 @@ keyTypeData:table(nofallback){
|
|||
}
|
||||
typeMap{
|
||||
calendar{
|
||||
buddhist{""}
|
||||
chinese{""}
|
||||
coptic{""}
|
||||
dangi{""}
|
||||
ethiopic{""}
|
||||
ethiopic-amete-alem{"ethioaa"}
|
||||
gregorian{"gregory"}
|
||||
islamic-civil{"islamicc"}
|
||||
hebrew{""}
|
||||
indian{""}
|
||||
islamic{""}
|
||||
islamic-civil{""}
|
||||
islamic-rgsa{""}
|
||||
islamic-tbla{""}
|
||||
islamic-umalqura{""}
|
||||
iso8601{""}
|
||||
japanese{""}
|
||||
persian{""}
|
||||
roc{""}
|
||||
}
|
||||
colalternate{
|
||||
non-ignorable{"noignore"}
|
||||
shifted{""}
|
||||
}
|
||||
colbackwards{
|
||||
no{"false"}
|
||||
yes{"true"}
|
||||
}
|
||||
colcasefirst{
|
||||
lower{""}
|
||||
no{"false"}
|
||||
upper{""}
|
||||
}
|
||||
colcaselevel{
|
||||
no{"false"}
|
||||
|
@ -56,10 +79,24 @@ keyTypeData:table(nofallback){
|
|||
yes{"true"}
|
||||
}
|
||||
collation{
|
||||
big5han{""}
|
||||
compat{""}
|
||||
dictionary{"dict"}
|
||||
direct{""}
|
||||
ducet{""}
|
||||
eor{""}
|
||||
gb2312han{"gb2312"}
|
||||
phonebook{"phonebk"}
|
||||
phonetic{""}
|
||||
pinyin{""}
|
||||
reformed{""}
|
||||
search{""}
|
||||
searchjl{""}
|
||||
standard{""}
|
||||
stroke{""}
|
||||
traditional{"trad"}
|
||||
unihan{""}
|
||||
zhuyin{""}
|
||||
}
|
||||
colnormalization{
|
||||
no{"false"}
|
||||
|
@ -69,6 +106,9 @@ keyTypeData:table(nofallback){
|
|||
no{"false"}
|
||||
yes{"true"}
|
||||
}
|
||||
colreorder{
|
||||
REORDER_CODE{""}
|
||||
}
|
||||
colstrength{
|
||||
identical{"identic"}
|
||||
primary{"level1"}
|
||||
|
@ -76,9 +116,378 @@ keyTypeData:table(nofallback){
|
|||
secondary{"level2"}
|
||||
tertiary{"level3"}
|
||||
}
|
||||
currency{
|
||||
adp{""}
|
||||
aed{""}
|
||||
afa{""}
|
||||
afn{""}
|
||||
alk{""}
|
||||
all{""}
|
||||
amd{""}
|
||||
ang{""}
|
||||
aoa{""}
|
||||
aok{""}
|
||||
aon{""}
|
||||
aor{""}
|
||||
ara{""}
|
||||
arl{""}
|
||||
arm{""}
|
||||
arp{""}
|
||||
ars{""}
|
||||
ats{""}
|
||||
aud{""}
|
||||
awg{""}
|
||||
azm{""}
|
||||
azn{""}
|
||||
bad{""}
|
||||
bam{""}
|
||||
ban{""}
|
||||
bbd{""}
|
||||
bdt{""}
|
||||
bec{""}
|
||||
bef{""}
|
||||
bel{""}
|
||||
bgl{""}
|
||||
bgm{""}
|
||||
bgn{""}
|
||||
bgo{""}
|
||||
bhd{""}
|
||||
bif{""}
|
||||
bmd{""}
|
||||
bnd{""}
|
||||
bob{""}
|
||||
bol{""}
|
||||
bop{""}
|
||||
bov{""}
|
||||
brb{""}
|
||||
brc{""}
|
||||
bre{""}
|
||||
brl{""}
|
||||
brn{""}
|
||||
brr{""}
|
||||
brz{""}
|
||||
bsd{""}
|
||||
btn{""}
|
||||
buk{""}
|
||||
bwp{""}
|
||||
byb{""}
|
||||
byr{""}
|
||||
bzd{""}
|
||||
cad{""}
|
||||
cdf{""}
|
||||
che{""}
|
||||
chf{""}
|
||||
chw{""}
|
||||
cle{""}
|
||||
clf{""}
|
||||
clp{""}
|
||||
cnx{""}
|
||||
cny{""}
|
||||
cop{""}
|
||||
cou{""}
|
||||
crc{""}
|
||||
csd{""}
|
||||
csk{""}
|
||||
cuc{""}
|
||||
cup{""}
|
||||
cve{""}
|
||||
cyp{""}
|
||||
czk{""}
|
||||
ddm{""}
|
||||
dem{""}
|
||||
djf{""}
|
||||
dkk{""}
|
||||
dop{""}
|
||||
dzd{""}
|
||||
ecs{""}
|
||||
ecv{""}
|
||||
eek{""}
|
||||
egp{""}
|
||||
ern{""}
|
||||
esa{""}
|
||||
esb{""}
|
||||
esp{""}
|
||||
etb{""}
|
||||
eur{""}
|
||||
fim{""}
|
||||
fjd{""}
|
||||
fkp{""}
|
||||
frf{""}
|
||||
gbp{""}
|
||||
gek{""}
|
||||
gel{""}
|
||||
ghc{""}
|
||||
ghs{""}
|
||||
gip{""}
|
||||
gmd{""}
|
||||
gnf{""}
|
||||
gns{""}
|
||||
gqe{""}
|
||||
grd{""}
|
||||
gtq{""}
|
||||
gwe{""}
|
||||
gwp{""}
|
||||
gyd{""}
|
||||
hkd{""}
|
||||
hnl{""}
|
||||
hrd{""}
|
||||
hrk{""}
|
||||
htg{""}
|
||||
huf{""}
|
||||
idr{""}
|
||||
iep{""}
|
||||
ilp{""}
|
||||
ilr{""}
|
||||
ils{""}
|
||||
inr{""}
|
||||
iqd{""}
|
||||
irr{""}
|
||||
isj{""}
|
||||
isk{""}
|
||||
itl{""}
|
||||
jmd{""}
|
||||
jod{""}
|
||||
jpy{""}
|
||||
kes{""}
|
||||
kgs{""}
|
||||
khr{""}
|
||||
kmf{""}
|
||||
kpw{""}
|
||||
krh{""}
|
||||
kro{""}
|
||||
krw{""}
|
||||
kwd{""}
|
||||
kyd{""}
|
||||
kzt{""}
|
||||
lak{""}
|
||||
lbp{""}
|
||||
lkr{""}
|
||||
lrd{""}
|
||||
lsl{""}
|
||||
ltl{""}
|
||||
ltt{""}
|
||||
luc{""}
|
||||
luf{""}
|
||||
lul{""}
|
||||
lvl{""}
|
||||
lvr{""}
|
||||
lyd{""}
|
||||
mad{""}
|
||||
maf{""}
|
||||
mcf{""}
|
||||
mdc{""}
|
||||
mdl{""}
|
||||
mga{""}
|
||||
mgf{""}
|
||||
mkd{""}
|
||||
mkn{""}
|
||||
mlf{""}
|
||||
mmk{""}
|
||||
mnt{""}
|
||||
mop{""}
|
||||
mro{""}
|
||||
mtl{""}
|
||||
mtp{""}
|
||||
mur{""}
|
||||
mvp{""}
|
||||
mvr{""}
|
||||
mwk{""}
|
||||
mxn{""}
|
||||
mxp{""}
|
||||
mxv{""}
|
||||
myr{""}
|
||||
mze{""}
|
||||
mzm{""}
|
||||
mzn{""}
|
||||
nad{""}
|
||||
ngn{""}
|
||||
nic{""}
|
||||
nio{""}
|
||||
nlg{""}
|
||||
nok{""}
|
||||
npr{""}
|
||||
nzd{""}
|
||||
omr{""}
|
||||
pab{""}
|
||||
pei{""}
|
||||
pen{""}
|
||||
pes{""}
|
||||
pgk{""}
|
||||
php{""}
|
||||
pkr{""}
|
||||
pln{""}
|
||||
plz{""}
|
||||
pte{""}
|
||||
pyg{""}
|
||||
qar{""}
|
||||
rhd{""}
|
||||
rol{""}
|
||||
ron{""}
|
||||
rsd{""}
|
||||
rub{""}
|
||||
rur{""}
|
||||
rwf{""}
|
||||
sar{""}
|
||||
sbd{""}
|
||||
scr{""}
|
||||
sdd{""}
|
||||
sdg{""}
|
||||
sdp{""}
|
||||
sek{""}
|
||||
sgd{""}
|
||||
shp{""}
|
||||
sit{""}
|
||||
skk{""}
|
||||
sll{""}
|
||||
sos{""}
|
||||
srd{""}
|
||||
srg{""}
|
||||
ssp{""}
|
||||
std{""}
|
||||
sur{""}
|
||||
svc{""}
|
||||
syp{""}
|
||||
szl{""}
|
||||
thb{""}
|
||||
tjr{""}
|
||||
tjs{""}
|
||||
tmm{""}
|
||||
tmt{""}
|
||||
tnd{""}
|
||||
top{""}
|
||||
tpe{""}
|
||||
trl{""}
|
||||
try{""}
|
||||
ttd{""}
|
||||
twd{""}
|
||||
tzs{""}
|
||||
uah{""}
|
||||
uak{""}
|
||||
ugs{""}
|
||||
ugx{""}
|
||||
usd{""}
|
||||
usn{""}
|
||||
uss{""}
|
||||
uyi{""}
|
||||
uyp{""}
|
||||
uyu{""}
|
||||
uzs{""}
|
||||
veb{""}
|
||||
vef{""}
|
||||
vnd{""}
|
||||
vnn{""}
|
||||
vuv{""}
|
||||
wst{""}
|
||||
xaf{""}
|
||||
xag{""}
|
||||
xau{""}
|
||||
xba{""}
|
||||
xbb{""}
|
||||
xbc{""}
|
||||
xbd{""}
|
||||
xcd{""}
|
||||
xdr{""}
|
||||
xeu{""}
|
||||
xfo{""}
|
||||
xfu{""}
|
||||
xof{""}
|
||||
xpd{""}
|
||||
xpf{""}
|
||||
xpt{""}
|
||||
xre{""}
|
||||
xsu{""}
|
||||
xts{""}
|
||||
xua{""}
|
||||
xxx{""}
|
||||
ydd{""}
|
||||
yer{""}
|
||||
yud{""}
|
||||
yum{""}
|
||||
yun{""}
|
||||
yur{""}
|
||||
zal{""}
|
||||
zar{""}
|
||||
zmk{""}
|
||||
zmw{""}
|
||||
zrn{""}
|
||||
zrz{""}
|
||||
zwd{""}
|
||||
zwl{""}
|
||||
zwr{""}
|
||||
}
|
||||
kv{
|
||||
currency{""}
|
||||
punct{""}
|
||||
space{""}
|
||||
symbol{""}
|
||||
}
|
||||
numbers{
|
||||
arab{""}
|
||||
arabext{""}
|
||||
armn{""}
|
||||
armnlow{""}
|
||||
bali{""}
|
||||
beng{""}
|
||||
brah{""}
|
||||
cakm{""}
|
||||
cham{""}
|
||||
deva{""}
|
||||
ethi{""}
|
||||
finance{""}
|
||||
fullwide{""}
|
||||
geor{""}
|
||||
grek{""}
|
||||
greklow{""}
|
||||
gujr{""}
|
||||
guru{""}
|
||||
hanidays{""}
|
||||
hanidec{""}
|
||||
hans{""}
|
||||
hansfin{""}
|
||||
hant{""}
|
||||
hantfin{""}
|
||||
hebr{""}
|
||||
java{""}
|
||||
jpan{""}
|
||||
jpanfin{""}
|
||||
kali{""}
|
||||
khmr{""}
|
||||
knda{""}
|
||||
lana{""}
|
||||
lanatham{""}
|
||||
laoo{""}
|
||||
latn{""}
|
||||
lepc{""}
|
||||
limb{""}
|
||||
mlym{""}
|
||||
mong{""}
|
||||
mtei{""}
|
||||
mymr{""}
|
||||
mymrshan{""}
|
||||
native{""}
|
||||
nkoo{""}
|
||||
olck{""}
|
||||
orya{""}
|
||||
osma{""}
|
||||
roman{""}
|
||||
romanlow{""}
|
||||
saur{""}
|
||||
shrd{""}
|
||||
sora{""}
|
||||
sund{""}
|
||||
takr{""}
|
||||
talu{""}
|
||||
taml{""}
|
||||
tamldec{""}
|
||||
telu{""}
|
||||
thai{""}
|
||||
tibt{""}
|
||||
traditional{"traditio"}
|
||||
vaii{""}
|
||||
}
|
||||
timezone:alias{"/ICUDATA/timezoneTypes/typeMap/timezone"}
|
||||
variabletop{
|
||||
CODEPOINTS{""}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,15 @@
|
|||
// *
|
||||
// ***************************************************************************
|
||||
timezoneTypes:table(nofallback){
|
||||
bcpTypeAlias{
|
||||
tz{
|
||||
aqams{"nzakl"}
|
||||
cnckg{"cnsha"}
|
||||
cnhrb{"cnsha"}
|
||||
cnkhg{"cnurc"}
|
||||
usnavajo{"usden"}
|
||||
}
|
||||
}
|
||||
typeAlias{
|
||||
timezone{
|
||||
"Africa:Asmara"{"Africa/Asmera"}
|
||||
|
|
Loading…
Add table
Reference in a new issue