Messages & plurals¶
Format ICU MessageFormat strings — placeholders, numbers, dates, and especially pluralisation and gender/word selection — without hardcoding any language's grammar rules.
Messages¶
One subset, three full implementations
PHP, Python, and Java use ICU's full MessageFormat (all argument types,
plural, selectordinal, select, named and positional args).
JavaScript ships a hand-written subset over
Intl.PluralRules/Intl.NumberFormat (arguments, number, plural,
select) — because it bundles no data, the algorithm is allowed but the
surface is slightly smaller. Python accepts a list (positional) or dict
(named); Java takes a Map (named) or varargs (positional).
Plural category¶
Ask which LDML plural category a number falls into for the locale — the same
decision ICU's MessageFormat makes internally.
Returns one of zero, one, two, few, many, other. Pass ordinal = true
for ordinal rules (1st / 2nd / 3rd …) instead of cardinal. (Java uses real ordinal
PluralRules; PHP and Python derive the ordinal category through a selectordinal
trick — same result.)