i18n 0 Rubygems

Internationalization (i18n) library for Ruby

h1. Ruby I18n

Ruby Internationalization and localization solution.


  • translation and localization
  • interpolation of values to translations (Ruby 1.9 compatible syntax)
  • pluralization (CLDR compatible)
  • customizable transliteration to ASCII
  • flexible defaults
  • bulk lookup
  • lambdas as translation data
  • custom key/scope separator
  • custom exception handlers
  • extensible architecture with a swappable backend

Pluggable features:

  • Cache
  • Pluralization: lambda pluralizers stored as translation data
  • Locale fallbacks, RFC4647 compliant (optionally: RFC4646 locale validation)
  • Gettext support
  • Translation metadata

Alternative backends:

  • Chain
  • ActiveRecord (optionally: ActiveRecord::Missing and ActiveRecord::StoreProcs)
  • KeyValue (uses active_support/json and cannot store procs)

For more information and lots of resources see: “http://rails-i18n.org/wiki”:http://rails-i18n.org/wiki

h2. Installation

gem install i18n

h3. Installation on Rails < 2.3.5 (deprecated)

Up to version 2.3.4 Rails will not accept i18n gems > 0.1.3. There is an unpacked gem inside of active_support/lib/vendor which gets loaded unless gem ‘i18n’, ‘~> 0.1.3’. This requirement is relaxed in “6da03653”:http://github.com/rails/rails/commit/6da03653

The new i18n gem can be loaded from vendor/plugins like this:

def reload_i18n! raise “Move to i18n version 0.2.0 or greater” if Rails.version > “2.3.4”

$:.grep(/i18n/).each { |path| $:.delete(path) }
I18n::Backend.send :remove_const, "Simple"
$: << Rails.root.join('vendor', 'plugins', 'i18n', 'lib').to_s


Then you can reload_i18n! inside an i18n initializer.

h2. Tests

You can run tests both with

  • rake test or just rake
  • run any test file directly, e.g. ruby test/api/simple_test.rb
  • run all tests with ruby test/all.rb

The structure of the test suite is a bit unusual as it uses modules to reuse particular tests in different test cases.

The reason for this is that we need to enforce the I18n API across various combinations of extensions. E.g. the Simple backend alone needs to support the same API as any combination of feature and/or optimization modules included to the Simple backend. We test this by reusing the same API defition (implemented as test methods) in test cases with different setups.

You can find the test cases that enforce the API in test/api. And you can find the API definition test methods in test/api/tests.

All other test cases (e.g. as defined in test/backend, test/core_ext) etc. follow the usual test setup and should be easy to grok.

h2. Authors

h2. Contributors


h2. License

MIT License. See the included MIT-LICENSE file.

Related Repositories



Repository for collecting Locale data for Ruby on Rails I18n as well as other interesting, Rails related I18n stuff ...



i18n library for JavaScript: calendar conversions, timezones, i18n resource bundles, currency rendering ...



Repository for collecting Locale data for Ruby on Rails I18n as well as other interesting, Rails related I18n stuff ...



A Java Library that interfaces with GNU Gettext and Java i18n Facilities to Make i18n Easier ...



Auto i18n is a module for Kohana 3, that will automatically collect internationalization strings and save them to /application/i18n/{I18n::$lang}.php files whenever it can't find one. ...

Top Contributors

josevalim lawrencepit knapo jeremy clemens yaroslav thedarkone joshmh norman abriening mseppae mattetti amatsuda tenderlove fcheung sobrinho jdhuntington josh lucasmncastro m4ssive roidrage sikachu purzelrakete radar spastorino aka47 pietro


-   v0.4.1 zip tar
-   v0.4.0 zip tar
-   v0.3.7 zip tar
-   v0.3.6 zip tar
-   v0.3.4 zip tar
-   v0.3.3 zip tar
-   v0.3.2 zip tar
-   v0.3.1 zip tar
-   v0.3.0 zip tar
-   v0.2.1 zip tar
-   v0.2.0 zip tar