0.0
No commit activity in last 3 years
No release in over 3 years
entry point for federated number-to-words handling
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
 Project Readme

NumberWords

It is not realistic to expect a single maintainer to be sufficiently polyglottous to be able to manage a system for writing numbers as words in a variety of languages. Furthermore, the rules in various languages vary to such an extent that there is little use in attempting to impose a single framework (beyond a collection of utilities).

This gem provides a central point into which locale-specific number-to-word gems can hook.

Installation

The gems for the locales you support should depend on this gem, so under normal circumstances once you've installed those, this is installed also. For example, if you add

gem 'number_words_fr'

to your Gemfile, you'll have this gem too.

Usage

require 'number_words/core_ext'

I18n.locale = :fr
123.to_words  # => "cent vingt-trois"

If you don't want to monkey-patch Integer, you can do this instead:

I18n.locale = :fr
NumberWords.int_to_words 123  # => "cent vingt-trois"

number_words/core_ext isn't required by default

available locales

Contributing

There are two ways to contribute - firstly the usual:

  1. Fork it ( http://github.com/conanite/number_words/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

secondly

  1. if you want to contribute a locale, make your own gem that plugs into this thus:

    class RussianNumberWords
      def int_to_words i, options={}
        # ur code here
      end
    end
    
    NumberWords.add_handler :ru, RussianNumberWords.new
  2. publish the gem

  3. let me know and I'll add a link here under 'available locales'