Add an ordinal_form property to Locale #270
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This exposes the rules for selecting ordinal forms in a similar way to the rules for selecting plural forms. In general a languages plural forms and ordinal forms might not be related.
I was hoping to provide a format_ordinal function to do conversions like 1->1st, 2->2nd, 11->11th, 23->23rd etc. unfortunately the CLDR doesn't have any convenient data for this. It does have some in the rbnf data but the language coverage at least in CLDR 26 seems patchy and pretty hard to interpret.
But I think this is useful on it's own because it provides access to the ordinal rules so that you could construct a simplified solution to a reduced problem based on these rules. Indeed that is what I'm doing for the small set of locales that I need to support.