PHP NumberFormatter extended with additional ordinals not supported by ICU.
Feel free to add more languages. Fork, pull request and contribute!
- composer.json
{
"require": {
"arius/number-formatter": "1.*"
}
}
- PHP
Use in code just like NumberFormatter class.
use Arius\NumberFormatter;
$formatter = new NumberFormatter('pl', NumberFormatter::SPELLOUT);
$formatter->setTextAttribute(NumberFormatter::DEFAULT_RULESET, "%spellout-ordinal");
$formatter->format(123);
- Polish (pl)
- spellout-ordinal
- spellout-ordinal-feminine
- spellout-ordinal-masculine
- spellout-ordinal-neuter
- Russian (ru)
- spellout-ordinal
- spellout-ordinal-feminine
- spellout-ordinal-masculine
- spellout-ordinal-neuter
- spellout-ordinal-plural (plural isn't part of ICU in all languages)