mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 17:01:16 +00:00
ICU-3925 separate RBNF resources to their own tree
X-SVN-Rev: 16008
This commit is contained in:
parent
6f0b32223c
commit
6aa4b3db3e
7 changed files with 33 additions and 19 deletions
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5ccca147782d76b171123528333afe484fa2a8456e8f900c4e5a54ae192c461c
|
||||
size 647340
|
||||
oid sha256:da9a53b868c8a710bbf0165c82f3b0b2f82e70f2410000e8bfbe0c64e02fd025
|
||||
size 641615
|
||||
|
|
|
@ -172,6 +172,7 @@ public class RbnfTest extends TestFmwk {
|
|||
errln("sdrf %%foo didn't fail");
|
||||
}
|
||||
catch (Exception e) {
|
||||
logln("Got the expected exception");
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -179,6 +180,7 @@ public class RbnfTest extends TestFmwk {
|
|||
errln("sdrf %bogus didn't fail");
|
||||
}
|
||||
catch (Exception e) {
|
||||
logln("Got the expected exception");
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -188,6 +190,7 @@ public class RbnfTest extends TestFmwk {
|
|||
errln("format double %%foo didn't fail");
|
||||
}
|
||||
catch (Exception e) {
|
||||
logln("Got the expected exception");
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -197,6 +200,7 @@ public class RbnfTest extends TestFmwk {
|
|||
errln("format double %%foo didn't fail");
|
||||
}
|
||||
catch (Exception e) {
|
||||
logln("Got the expected exception");
|
||||
}
|
||||
|
||||
RuleBasedNumberFormat fmt4 = new RuleBasedNumberFormat(fracRules, Locale.ENGLISH);
|
||||
|
|
|
@ -492,7 +492,7 @@ public final class ICUResourceBundleTest extends TestFmwk {
|
|||
}
|
||||
}
|
||||
// should not get an exception
|
||||
rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME,"fr_BE");
|
||||
rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_RBNF_BASE_NAME,"fr_BE");
|
||||
String str = rb.getString("SpelloutRules");
|
||||
if(str !=null || str.length()>0){
|
||||
logln("Alias mechanism works");
|
||||
|
|
|
@ -51,6 +51,7 @@ public abstract class ICUResourceBundle extends UResourceBundle{
|
|||
*/
|
||||
public static final String ICU_COLLATION_BASE_NAME = ICU_BASE_NAME + "/coll";
|
||||
|
||||
public static final String ICU_RBNF_BASE_NAME = ICU_BASE_NAME + "/rbnf";
|
||||
/**
|
||||
* The class loader constant to be used with getBundleInstance API
|
||||
* @draft ICU 3.0
|
||||
|
|
|
@ -74,20 +74,23 @@ public class ICUResourceBundleImpl extends ICUResourceBundle {
|
|||
private ICUResourceBundle getBundle() {
|
||||
int type = RES_GET_TYPE(rootResource);
|
||||
if (type == TABLE) {
|
||||
// %%ALIAS is such a hack! I can understand the
|
||||
// ICU4C legacy .. do we need to port it?
|
||||
ResourceTable table = new ResourceTable(null, rootResource, "", true);
|
||||
|
||||
ICUResourceBundle b = table.handleGet(0);
|
||||
String itemKey = b.getKey();
|
||||
if (itemKey.equals("%%ALIAS")) {
|
||||
String locale = b.getString();
|
||||
ICUResourceBundle actual = (ICUResourceBundle) UResourceBundle
|
||||
.getBundleInstance(baseName, locale);
|
||||
return (ResourceTable) actual;
|
||||
} else {
|
||||
return table;
|
||||
}
|
||||
if(table.countItems()>0){
|
||||
ICUResourceBundle b = table.handleGet(0);
|
||||
String itemKey = b.getKey();
|
||||
|
||||
// %%ALIAS is such a hack! I can understand the
|
||||
// ICU4C legacy .. do we need to port it?
|
||||
if (itemKey.equals("%%ALIAS")) {
|
||||
String locale = b.getString();
|
||||
ICUResourceBundle actual = (ICUResourceBundle) UResourceBundle.getBundleInstance(baseName, locale);
|
||||
return (ResourceTable) actual;
|
||||
}else{
|
||||
return table;
|
||||
}
|
||||
}else {
|
||||
return table;
|
||||
}
|
||||
|
||||
} else if (type == TABLE32) {
|
||||
|
||||
|
@ -200,6 +203,9 @@ public class ICUResourceBundleImpl extends ICUResourceBundle {
|
|||
return handleGet(key, null);
|
||||
}
|
||||
protected ICUResourceBundle handleGet(String key, HashMap table) {
|
||||
if(size<=0){
|
||||
return null;
|
||||
}
|
||||
int offset = RES_GET_OFFSET(resource);
|
||||
// offset+0 contains number of entries
|
||||
// offset+1 contains the keyOffset
|
||||
|
@ -280,6 +286,9 @@ public class ICUResourceBundleImpl extends ICUResourceBundle {
|
|||
private class ResourceTable32 extends ICUResourceBundle implements Resource {
|
||||
|
||||
public ICUResourceBundle get(String key) {
|
||||
if(size<=0){
|
||||
return null;
|
||||
}
|
||||
return get(key, null);
|
||||
}
|
||||
public ICUResourceBundle get(String key, HashMap table) {
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1d3c431f2c995f8668d466a60fceedf953118074f0ea9fe45f17b775eecdf8f5
|
||||
size 1680909
|
||||
oid sha256:591653615e884f9d765c702ef63896b76a4e342166fcfc8aa97f0961e05d6670
|
||||
size 1687123
|
||||
|
|
|
@ -666,7 +666,7 @@ public class RuleBasedNumberFormat extends NumberFormat {
|
|||
// load up the resource bundle containing the description
|
||||
// from the specified locale
|
||||
// ResourceBundle bundle = ICULocaleData.getResourceBundle("NumberFormatRules", locale);
|
||||
ICUResourceBundle bundle = (ICUResourceBundle)UResourceBundle.getBundleInstance(new ULocale(locale));
|
||||
ICUResourceBundle bundle = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_RBNF_BASE_NAME, new ULocale(locale));
|
||||
|
||||
// TODO: determine correct actual/valid locale. Note ambiguity
|
||||
// here -- do actual/valid refer to pattern, DecimalFormatSymbols,
|
||||
|
|
Loading…
Add table
Reference in a new issue