ICU-6896 Workaround to allow parsing of spellout in Arabic, Hebrew and Maltese. Equivalent to c25971 in C.

X-SVN-Rev: 25972
This commit is contained in:
Yoshito Umaoka 2009-05-01 20:35:37 +00:00
parent 1fffd46beb
commit 5c15722121
2 changed files with 19 additions and 9 deletions

View File

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
* Copyright (C) 1996-2009, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -371,7 +371,22 @@ final class NFRuleSet {
* @return true if the rule set is public
*/
public boolean isPublic() {
return !name.startsWith("%%");
return !name.startsWith("%%");
}
/**
* Return true if the rule set can be used for parsing.
* @return true if the rule set can be used for parsing.
*/
public boolean isParseable() {
//TODO:
// In CLDR 1.7, we have no distinction between
// parseable/unparseable. Rules which have one of
// 3 suffixes below are know as unparseable for now.
// We should add the information in CLDR data.
return !(name.endsWith("-prefixpart")
|| name.endsWith("-postfixpart")
|| name.endsWith("-postfx"));
}
//-----------------------------------------------------------------------

View File

@ -599,12 +599,7 @@ public class RuleBasedNumberFormat extends NumberFormat {
// Temporary workaround - when noParse is true, do noting in parse.
// TODO: We need a real fix - see #6895/#6896
private boolean noParse;
private static final String[] NO_SPELLOUT_PARSE_LANGUAGES = {
"ga", "mt", "ar", "he",
};
// Note: "ar" and "he" do not cause any errors with ICU4J test case,
// but the test coverage is suspicious. These locales trigger stack
// overflow in C. For now, we also include these in the list above.
private static final String[] NO_SPELLOUT_PARSE_LANGUAGES = { "ga" };
//-----------------------------------------------------------------------
// constructors
@ -1207,7 +1202,7 @@ public class RuleBasedNumberFormat extends NumberFormat {
// the result we return
for (int i = ruleSets.length - 1; i >= 0; i--) {
// skip private rule sets
if (ruleSets[i].getName().startsWith("%%")) {
if (!ruleSets[i].isPublic() || !ruleSets[i].isParseable()) {
continue;
}