Skip to content

sorich87/numbers_and_words

 
 

Repository files navigation

Convert numbers to words using the I18n library.

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

Supported Languages / Языки

  • English

  • Русский

  • Українська

  • Türkçe

Examples / Примеры

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

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

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

231.to_words
=> "two hundred thirty-one"
=> "двести тридцать один"
=> "двiстi тридцять один"
=> "iki yüz otuz bir"

4030.to_words
=> "four thousand thirty"
=> "четыре тысячи тридцать"
=> "чотири тисячi тридцять"
=> "dört bin otuz"

1000100.to_words
=> "one million one hundred"
=> "один миллион сто"
=> "один мiльйон сто"
=> "bir milyon bir yüz"

1000000000000000000000000000000000.to_words
=> "one decillion"
=> "один дециллион"
=> "один децильйон"
=> "bir desilyon"

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

[11, 22, 133].to_words
=> ["eleven", "twenty-two", "one hundred thirty-three"] 
=> ["одиннадцать", "двадцать два", "сто тридцать три"]
=> ["одинадцять", "двадцять два", "сто тридцять три"]
=> ["on bir", "yirmi iki", "bir yüz otuz üç"]

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 / Контакты

About

Convert numbers to words using I18N.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%