Re: proposal, add rule based number formatting to ICU message format
"Mark Davis" <[email protected]> Wed, 28 Jul 2004 10:28:02 -0700
| Newsgroups | gmane.comp.lib.icu.general |
|---|---|
| Message-ID | <[email protected]> |
I like the direction, but I'd like this to be somewhat broader; in particular, allow some way for ordinals to be used date formats, e.g. for "January 20th, 2005" Mark ----- Original Message ----- From: "Doug Felt" <[email protected]> To: <[email protected]> Sent: Wednesday, July 28, 2004 10:14 Subject: proposal, add rule based number formatting to ICU message format > 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 > _______________________________________________ > icu mailing list > [email protected] > http://oss.software.ibm.com/developerworks/oss/mailman/listinfo/icu >