proposal, add rule based number formatting to ICU message format
Doug Felt <[email protected]> Wed, 28 Jul 2004 10:14:03 -0700 (PDT)
| Newsgroups | gmane.comp.lib.icu.general |
|---|---|
| Message-ID | <[email protected]> |
Please respond by August 11th. This proposal applies to both ICU and ICU4J.
This is for jitterbug #4019.
The proposal is to extend the message format syntax to provide support for
RuleBasedMessageFormat.
MessageFormat currently has a three-argument syntax for subformats, consisting
of an index, a format type keyword, and a subformat style or pattern (which can
be elided). The current format type keywords are number, date, time, and
choice.
RuleBasedNumberFormat has three types of standard rules-- spellout, ordinal,
and duration. Each of these can have multiple 'rulesets', to further customize
the behavior-- for example, some languages require gender or plural forms.
In order to keep the existing MessageFormat three-argument syntax, I propose
adding three new format type keywords-- 'spellout', 'ordinal', and 'duration'--
and allowing the ruleset name to be specified in the subformat pattern. For
example, the pattern "{0,spellout,%masculine}" would obtain the spellout rules
for the MessageFormat's locale, and set the ruleset named '%masculine' on the
formatter. If no ruleset name is specified, the default ruleset would be used.
RuleBasedNumberFormat normally throws an exception if an unrecognized ruleset
name is provided to it. In order to make the use of MessageFormat a bit more
robust in the case case of a data mismatch between the format string and the
locale data for RuleBasedNumberFormat, I propose to catch this exception inside
MessageFormat and use the default ruleset.
Doug
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail