numbers_and_words <img src=“https://secure.travis-ci.org/kslazarev/numbers_and_words.png” />

Convert numbers to words using the I18n library.

Перевод чисел в слова при помощи библиотеки I18n.

Supported Languages / Языки

  • English

  • Русский

Examples / Примеры

I18n.with_locale(:en) { 42.to_words }
=> "forty-two"

I18n.with_locale(:ru) { 42.to_words }
=> "сорок два"

21.to_words
=> "twenty-one"
=> "двадцать один"

231.to_words
=> "two hundred thirty-one"
=> "двести тридцать один"

4030.to_words
=> "four thousand thirty"
=> "четыре тысячи тридцать"

1000100.to_words
=> "one million one hundred"
=> "один миллион сто"

1000000000000000000000000000000000.to_words
=> "one decillion"
=> "один дециллион"

[1, 2, 3].to_words
=> ["one", "two", "three"]
=> ["один", "два", "три"]

[11, 22, 133].to_words
=> ["eleven", "twenty-two", "one hundred thirty-three"] 
=> ["одиннадцать", "двадцать два", "сто тридцать три"]

Requirements / Требования

  • 1.8.7 <= Ruby (compatible with/совместимость с Ruby 1.9, JRuby and/и Rubinius);

  • 0.5.0 <= I18n (earlier versions not tested/ранние версии не тестировались);

Installation / Установка

gem install numbers_and_words

License / Лицензия

MIT License

Bugs and Language Support / Поправки и Новые Языки

See CHANGELOG.md for last changes.

Fork the project. Make your feature addition or bug fix with tests.

Send a pull request. Bonus points for topic branches.

Contacts / Контакты