ICU-11061 Full bcp47 key/type data snychronized with ICU4C trunk.

X-SVN-Rev: 36152
This commit is contained in:
Yoshito Umaoka 2014-08-12 23:14:50 +00:00
parent a16ab10f50
commit 5af6a3d39f
3 changed files with 29 additions and 6 deletions

View file

@ -3714,6 +3714,10 @@ public final class ULocale implements Serializable, Comparable<ULocale> {
String bcpKey = null;
try {
bcpKey = keyMap.getString(key);
if (bcpKey.length() == 0) {
// empty value indicates the BCP47 key is same with the legacy key
bcpKey = key;
}
} catch (MissingResourceException mre) {
// fall through
}
@ -3739,7 +3743,12 @@ public final class ULocale implements Serializable, Comparable<ULocale> {
String key = null;
for (int i = 0; i < keyMap.getSize(); i++) {
UResourceBundle mapData = keyMap.get(i);
if (bcpKey.equals(mapData.getString())) {
String tmpBcpKey = mapData.getString();
if (tmpBcpKey.length() == 0) {
// empty value indicates the BCP47 key is same with the legacy key
tmpBcpKey = mapData.getKey();
}
if (bcpKey.equals(tmpBcpKey)) {
key = mapData.getKey();
break;
}
@ -3758,6 +3767,7 @@ public final class ULocale implements Serializable, Comparable<ULocale> {
UResourceBundle typeMap = keyTypeData.get("typeMap");
// keys are case-insensitive, while types are case-sensitive
// TODO: make types case insensitive
key = AsciiUtil.toLowerString(key);
UResourceBundle typeMapForKey = null;
String bcpType = null;
@ -3765,6 +3775,10 @@ public final class ULocale implements Serializable, Comparable<ULocale> {
try {
typeMapForKey = typeMap.get(key);
bcpType = typeMapForKey.getString(typeResKey);
if (bcpType.length() == 0) {
// empty value indicates the BCP47 type is same with the legacy type
bcpType = type;
}
} catch (MissingResourceException mre) {
// fall through
}
@ -3776,6 +3790,10 @@ public final class ULocale implements Serializable, Comparable<ULocale> {
UResourceBundle typeAliasForKey = typeAlias.get(key);
typeResKey = typeAliasForKey.getString(typeResKey);
bcpType = typeMapForKey.getString(typeResKey.replace('/', ':'));
if (bcpType.length() == 0) {
// empty value indicates the BCP47 type is same with the legacy type
bcpType = typeResKey;
}
} catch (MissingResourceException mre) {
// fall through
}
@ -3813,7 +3831,12 @@ public final class ULocale implements Serializable, Comparable<ULocale> {
for (int i = 0; i < typeMapForKey.getSize(); i++) {
UResourceBundle mapData = typeMapForKey.get(i);
if (bcpType.equals(mapData.getString())) {
String tmpBcpType = mapData.getString();
if (tmpBcpType.length() == 0) {
// empty value indicates the BCP47 type is same with the legacy type
tmpBcpType = mapData.getKey();
}
if (bcpType.equals(tmpBcpType)) {
type = mapData.getKey();
if (key.equals("timezone")) {
type = type.replace(':', '/');

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:01b1bf99d68a3849729b5af75db65bec86496bb43d46f54f6561d63a714de9c1
size 10505773
oid sha256:11004912c7ce72161feb732fdd36dad4d12914d8bfb378eec90eeab91951aef0
size 10507681

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b7a225ee1ed42c0dab0082b046e3be1b2f81d49d866bacd3115aa0b7627b7e4d
size 90848
oid sha256:241db710283f77944c73a1e3061b3adb43195ecb8c8194fea596923cc6f3878b
size 90909