This is a follow up on discussion for supporting ordinals in V8
Suggested solution
Suggested solution is use Intl.PluralRules
that has ordinals type and let's you pick up the ordinal key using a number and a locale
Example:
new Intl.PluralRules('ar-EG').select(0);
// → 'zero'
new Intl.PluralRules('ar-EG').select(1);
// → 'one'
new Intl.PluralRules('ar-EG').select(2);
// → 'two'
new Intl.PluralRules('ar-EG').select(6);
// → 'few'
new Intl.PluralRules('ar-EG').select(18);
// → 'many'
We will use this keys produced by it to then select the ordinal display using suffixes schemas for ordinals across different languages that can be found here
One last thing, we will inject this solution into $n to have an 'ordinal' type that returns ${{$n(number)}}${{ordinalConversion(locale,number)}}
Clear and concise description of the problem
This is a follow up on discussion for supporting ordinals in V8
Suggested solution
Suggested solution is use Intl.PluralRules that has ordinals type and let's you pick up the ordinal key using a number and a locale Example:
We will use this keys produced by it to then select the ordinal display using suffixes schemas for ordinals across different languages that can be found here One last thing, we will inject this solution into $n to have an 'ordinal' type that returns
${{$n(number)}}${{ordinalConversion(locale,number)}}
Alternative
No response
Additional context
No response
Validations