Open Reprevise opened 7 months ago
The following works though. I'm confused as to why the text I posted originally doesn't. It also works without the =
sign in front of it, where on sites like this, it requires the =
sign prefix.
import 'package:intl/message_format.dart';
void main() {
final msg = MessageFormat('{count, selectordinal, =1{#st} =2{#nd} =3{#rd} other {#th}}');
print(msg.format({"count": 1})); // 1st
print(msg.format({"count": 2})); // 2nd
print(msg.format({"count": 3})); // 3rd
print(msg.format({"count": 4})); // 4th
}
Just a quick note without having taken a deeper look: The implementation is derived from the Closure one and should be based on the ICU MessageFormat, so that should be the reference to look at.
But this class does not have ordinal support in general, see https://github.com/dart-lang/i18n/blob/316929f6ff4b72e22a52d5cb40bb620f429a8fa4/pkgs/intl/lib/message_format.dart#L770.
Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like There appears to be parsing for
selectordinal
already, but it only works for "one" and I guess "other".Describe alternatives you've considered I could maintain my own ordinal method however it would be difficult to localize myself.