ICU-8031 Support for parent locales
X-SVN-Rev: 29444
This commit is contained in:
parent
4b8773457a
commit
9e2ef1c35b
@ -881,12 +881,10 @@ public class ICUResourceBundle extends UResourceBundle {
|
||||
|
||||
b = (ICUResourceBundle)addToCache(root, fullName, defaultLocale, b);
|
||||
|
||||
boolean ParentIsRoot = false;
|
||||
if (b.getTableResource("%%ParentIsRoot") != RES_BOGUS) {
|
||||
ParentIsRoot = true;
|
||||
}
|
||||
|
||||
if (i != -1 && !ParentIsRoot) {
|
||||
if (b.getTableResource("%%Parent") != RES_BOGUS) {
|
||||
String parentLocaleName = b.getString("%%Parent");
|
||||
parent = instantiateBundle(baseName, parentLocaleName, root, disableFallback);
|
||||
} else if (i != -1) {
|
||||
parent = instantiateBundle(baseName, localeName.substring(0, i), root, disableFallback);
|
||||
} else if (!localeName.equals(rootLocale)){
|
||||
parent = instantiateBundle(baseName, rootLocale, root, true);
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ce8367c713b49eb76fed06f2e755bc8d314a02ecd7c34e26faa6661300338c28
|
||||
size 6738590
|
||||
oid sha256:c320693dbba59f308a1de06b1af4ac31ea1df95349473ce174183a3378c5c9ec
|
||||
size 6739289
|
||||
|
@ -2714,4 +2714,30 @@ public class NumberFormatTest extends com.ibm.icu.dev.test.TestFmwk {
|
||||
errln("Comparison should return false.");
|
||||
}
|
||||
}
|
||||
public void TestExplicitParents() {
|
||||
// We use these for testing because decimal and grouping separators will be inherited from es_419
|
||||
// starting with CLDR 2.0
|
||||
String[] DATA = {
|
||||
"es", "CO", "", "1.250,75",
|
||||
"es", "CR", "", "1.250,75",
|
||||
"es", "ES", "", "1.250,75",
|
||||
"es", "GQ", "", "1.250,75",
|
||||
"es", "MX", "", "1,250.75",
|
||||
"es", "US", "", "1,250.75",
|
||||
"es", "VE", "", "1.250,75",
|
||||
|
||||
};
|
||||
|
||||
for (int i=0; i<DATA.length; i+=4) {
|
||||
Locale locale = new Locale(DATA[i], DATA[i+1], DATA[i+2]);
|
||||
NumberFormat fmt = NumberFormat.getInstance(locale);
|
||||
String s = fmt.format(1250.75);
|
||||
if (s.equals(DATA[i+3])) {
|
||||
logln("Ok: 1250.75 x " + locale + " => " + s);
|
||||
} else {
|
||||
errln("FAIL: 1250.75 x " + locale + " => " + s +
|
||||
", expected " + DATA[i+3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user