You’d think someone has implemented simple conversion of numbers into English by now? For example 42 becomes “forty-two”.
I found a few interesting posts, a couple of gems and even a competition. All had issues that fit in two buckets: they could only do English or their implementation was scary. While I didn’t really need a converter that worked for different languages, none of the libraries inspired much confidence. Finally, I ran into a I18n implementation that was generic, well implemented and properly tested for Russian. It needed some minor English work, but you can be sure that the Russian version is much more complicated.
A few pull requests later, please welcome a new gem, numbers_and_words. Kirill designed the library with conversion strategies and proper localization in-mind.
These produce “forty-two” and “сорок два”.
And a fun one.
This is obviously “two octillion nine hundred thirty-five septillion one hundred seventy-four sextillion three hundred fifteen quintillion one hundred nineteen quadrillion six hundred fifty-four trillion six hundred fifty-four billion six hundred fifty-four million six hundred fifty-four thousand six hundred fifty-four”.
Can someone please contribute a Spanish version next?