Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Convert numbers to words using I18N.

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.rdoc

numbers_and_words

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 / Поправки и Новые Языки

Fork the project. Make your feature addition or bug fix with tests. Send a pull request. Bonus points for topic branches.

Contacts / Контакты

Something went wrong with that request. Please try again.