|
From: <jdi...@ya...> - 2022-11-01 21:55:14
|
> "{DAY_OF_MONTH,selectordinal, one{Monthly on the #st day}two{Monthly on the #nd day}few{Monthly on the #rd day}other{Monthly on the #th day}}"
It means I should write these rules by myself (example above is for English, and similar rulesets for other languages I need). But I would rather get it automatically from ICU (like {0, ordinal} but it does not seem to work for some languages, "ru" for instance)
On Tuesday, November 1, 2022, 11:57:29 PM GMT+3, Markus Scherer <mar...@gm...> wrote:
A pattern like "{0, ordinal}" uses class RuleBasedNumberFormat which has a lot of variations of rules available, although I am not sure if you can select the variants from inside a MessageFormat pattern.
A more modern usage pattern would be to use the "selectordinal" type and put the number suffixes into the message itself (and into the translations, of course).
For example: "{DAY_OF_MONTH,selectordinal, one{Monthly on the #st day}two{Monthly on the #nd day}few{Monthly on the #rd day}other{Monthly on the #th day}}"
markus |