I18n::Complements

<img src=“https://badge.fury.io/rb/i18n-complements.png” alt=“Gem Version” /> <img src=“https://api.travis-ci.org/ekylibre/i18n-complements.png?branch=master”/> <img src=“https://gemnasium.com/ekylibre/i18n-complements.png”/> <img src=“https://codeclimate.com/github/ekylibre/i18n-complements.png” /> <img src=“https://coveralls.io/repos/ekylibre/i18n-complements/badge.png?branch=master” alt=“Coverage Status” />

I18n complements provides:

  • Numbers localization

  • Moneys localization (through ISO4217 codes)

  • Boolean localization

  • String localization (do nothing but permits to generalize use of localization)

Localize numbers

I18n.localize(2015.2, :locale => :eng) # => "2,015.200"
I18n.localize(2015.2, :locale => :fra) # => "2 015,200"

With extensions:

2015.2.l(:locale => :eng) # => "2,015.200"
2015.2.l(:locale => :fra) # => "2 015,200"

Localize money

I18n.localize(13500, :currency => :JPY, :locale => :eng) # => "¥13,500"
I18n.localize(13500, :currency => :JPY, :locale => :fra) # => "13 500 ¥"
I18n.localize(13500, :currency => :JPY, :locale => :jpn) # => "13,500円"

I18n.localize(13500, :currency => :EUR, :locale => :eng) # => "€13,500.00"
I18n.localize(13500, :currency => :EUR, :locale => :fra) # => "13 500,00 €"

With extensions:

13500.l(:currency => :JPY, :locale => :jpn) # => "13,500円"

Extensions

Moreover it extends String, and Symbol for translations:

I18n.t("my.example", options..)
# is equivalent to
"my.example".t(options...)

Or

I18n.t(:this_is_another_example, options..)
# is equivalent to
:this_is_another_example.t(options...)

And it extends Date, DateTime and Time for localization:

Date.civil(2012, 1, 1).l(:locale => :fra) # => "1 janvier 2012"

Manipulating currencies

To find existing currencies:

I18n.active_currencies # returns the list of used currencies
I18n.available_currencies # returns all known currencies
I18n.currency(<currency_code>) # returns a Currency object with its properties

To do

  • Enhance numerals localization using systems (decimal, vigesimal…) and characters of the language for numerals. Ex: Abjad numerals (ا, ب, ج, د…), Roman numbers (Ⅰ, Ⅱ, Ⅲ, Ⅳ…), traditional chinese/japanese numbers (一, 二, 三, 四…),