ICU-6750 Allow aliases in numbering system descriptions

X-SVN-Rev: 25469
This commit is contained in:
John Emmons 2009-02-23 22:41:41 +00:00
parent 27ce5a3df5
commit ec9921c61c
3 changed files with 63 additions and 9 deletions

View File

@ -55,32 +55,32 @@ numberingSystems:table(nofallback){
}
hanjfin{
algorithmic:int{1}
desc{"%ja/SpelloutRules/financial"}
desc{"ja/SpelloutRules/%financial"}
radix:int{10}
}
hanjstd{
algorithmic:int{1}
desc{"%ja/SpelloutRules/spellout"}
desc{"ja/SpelloutRules/%spellout"}
radix:int{10}
}
hansfin{
algorithmic:int{1}
desc{"%zh/SpelloutRules/financial"}
desc{"zh/SpelloutRules/%financial"}
radix:int{10}
}
hansstd{
algorithmic:int{1}
desc{"%zh/SpelloutRules/spellout"}
desc{"zh/SpelloutRules/%spellout"}
radix:int{10}
}
hantfin{
algorithmic:int{1}
desc{"%zh_Hant/SpelloutRules/financial"}
desc{"zh_Hant/SpelloutRules/%financial"}
radix:int{10}
}
hantstd{
algorithmic:int{1}
desc{"%zh_Hant/SpelloutRules/spellout"}
desc{"zh_Hant/SpelloutRules/%spellout"}
radix:int{10}
}
hebrew{

View File

@ -278,6 +278,29 @@ root{
"3000: mmm[>>];\n",
"4000: =#,##0=;\n",
"-x: >>n;\n",
"%tamil:\n",
"0: =#,##,##0=;\n",
"1: \u0BE7;\n",
"2: \u0BE8;\n",
"3: \u0BE9;\n",
"4: \u0BEA;\n",
"5: \u0BEB;\n",
"6: \u0BEC;\n",
"7: \u0BED;\n",
"8: \u0BEE;\n",
"9: \u0BEF;\n",
"10: \u0BF0[>>];\n",
"20: <<\u0BF0[>>];\n",
"100: \u0BF1[>>];\n",
"200: <<\u0BF1[>>];\n",
"1000: \u0BF2[>>];\n",
"2000: <<\u0BF2[>>];\n",
"1000000/100000: <<\u0BF1\u0BF2[>%%tamil_thousands>];\n",
"100000000: =#,##,##0=;\n",
"-x: =#,##,##0=;\n",
"%%tamil_thousands:\n",
"0: =%tamil=;\n",
"1000: <<\u0BF2[>>];\n",
"%upper-roman:\n",
"0: N; I; II; III; IV; V; VI; VII; VIII; IX;\n",
"10: X[>>];\n",
@ -322,5 +345,5 @@ root{
"0: =#,##0.#=;\n",
}
}
Version{"1.6"}
Version{"1.7"}
}

View File

@ -84,6 +84,8 @@ static const UChar gLastResortPluralCurrencyPat[] = {
static const UChar gSingleCurrencySign[] = {0xA4, 0};
static const UChar gDoubleCurrencySign[] = {0xA4, 0xA4, 0};
static const UChar gSlash = 0x2f;
// If the maximum base 10 exponent were 4, then the largest number would
// be 99,999 which has 5 digits.
// On IEEE754 systems gMaxIntegerDigits is 308 + possible denormalized 15 digits + rounding digit
@ -931,12 +933,41 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
}
if (ns->isAlgorithmic()) {
RuleBasedNumberFormat *r = new RuleBasedNumberFormat(URBNF_NUMBERING_SYSTEM,desiredLocale,status);
UnicodeString nsDesc;
UnicodeString nsRuleSetGroup;
UnicodeString nsRuleSetName;
Locale nsLoc;
URBNFRuleSetTag desiredRulesType = URBNF_NUMBERING_SYSTEM;
nsDesc.setTo(ns->getDescription());
int32_t firstSlash = nsDesc.indexOf(gSlash);
int32_t lastSlash = nsDesc.lastIndexOf(gSlash);
if ( lastSlash > firstSlash ) {
char nsLocID[ULOC_FULLNAME_CAPACITY];
nsDesc.extract(0,firstSlash,nsLocID,ULOC_FULLNAME_CAPACITY,US_INV);
nsRuleSetGroup.setTo(nsDesc,firstSlash+1,lastSlash-firstSlash-1);
nsRuleSetName.setTo(nsDesc,lastSlash+1);
nsLoc = Locale::createFromName(nsLocID);
UnicodeString SpelloutRules = UNICODE_STRING_SIMPLE("SpelloutRules");
if ( nsRuleSetGroup.compare(SpelloutRules) == 0 ) {
desiredRulesType = URBNF_SPELLOUT;
}
} else {
nsLoc = desiredLocale;
nsRuleSetName.setTo(nsDesc);
}
RuleBasedNumberFormat *r = new RuleBasedNumberFormat(desiredRulesType,nsLoc,status);
if (U_FAILURE(status) || r == NULL) {
goto cleanup;
}
r->setDefaultRuleSet(ns->getDescription(),status);
r->setDefaultRuleSet(nsRuleSetName,status);
f = (NumberFormat *) r;
} else {
// replace single currency sign in the pattern with double currency sign
// if the style is kIsoCurrencyStyle