messageformat.net icon indicating copy to clipboard operation
messageformat.net copied to clipboard

`selectordinal` support missing

Open sfuqua opened this issue 3 months ago • 2 comments

I was attempting to format the following string and hit "Format 'selectordinal' could not be resolved":

"{index, selectordinal, other {Slot #}}"

This is a toy example where in English I'd have "Slot 1", "Slot 2", etc - string.Format works fine, but the point would be to support other variants in a more complex string or in non-English cultures.

I believe technically, selectordinal is part of the MF 2.0 spec, I'm not sure if this lib is intended to target the "legacy" spec, MF 2.0, or a hybrid.

Not expecting a magic fix here but wanted to track the issue - is this something that would be solved with a new formatter? I believe the data we need for ordinal rules exists in the CLDR repo along with plurals, but I haven't looked into what integration would take, yet.

sfuqua avatar Oct 16 '25 22:10 sfuqua

Yes, it would require adding a new formatter and using the CLDR rules. We already use those for pluralization as well. Happy to accept a PR for this.

jeffijoe avatar Oct 17 '25 09:10 jeffijoe

Great, thanks for confirming! As I ran into this through my role at Microsoft, I'll see if I can get the necessary approval to build this out.

sfuqua avatar Oct 18 '25 06:10 sfuqua