Ruby Internationalization and localization solution.
i18n alternatives and similar gems
Based on the "Internationalization" category.
Alternatively, view i18n alternatives based on common mentions on social networks and blogs.
8.1 3.4 L5 i18n VS GlobalizeRails I18n de-facto standard library for ActiveRecord model/data translation.
5.9 4.9 L5 i18n VS twitter-cldr-rbRuby implementation of the ICU (International Components for Unicode) that uses the Common Locale Data Repository to format dates, plurals, and more.
3.4 2.1 i18n VS LocaleSend and retrieve your ruby i18n localizations to the Locale translation service
3.1 0.6 i18n VS TracoTranslatable columns for Ruby on Rails, stored in the model table itself.
Tired of jumping between language files when translating keys? Stop jumping and have all the languages side by side.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of i18n or a related project?
Ruby internationalization and localization (i18n) solution.
Currently maintained by @radar.
You will most commonly use this library within a Rails app.
See the Rails Guide for an example of its usage.
Ruby (without Rails)
If you want to use this library without Rails, you can simply add
i18n to your
Then configure I18n with some translations, and a default locale:
I18n.load_path << Dir[File.expand_path("config/locales") + "/*.yml"] I18n.default_locale = :en # (note that `en` is already the default!)
A simple translation file in your project might live at
config/locales/en.yml and look like:
en: test: "This is a test"
You can then access this translation by doing:
You can switch locales in your project by setting
I18n.locale to a different value:
I18n.locale = :de I18n.t(:test) # => "Dies ist ein Test"
- Translation and localization
- Interpolation of values to translations
- 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
- Pluralization: lambda pluralizers stored as translation data
- Locale fallbacks, RFC4647 compliant (optionally: RFC4646 locale validation)
- Gettext support
- Translation metadata
- ActiveRecord (optionally: ActiveRecord::Missing and ActiveRecord::StoreProcs)
- KeyValue (uses active_support/json and cannot store procs)
For more information and lots of resources see the 'Resources' page on the wiki.
You can run tests both with
rake testor just
- run any test file directly, e.g.
ruby -Ilib:test test/api/simple_test.rb
You can run all tests against all Gemfiles with
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 definition (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.
Additional documentation can be found here: https://github.com/ruby-i18n/i18n/wiki
- and many more
MIT License. See the included MIT-LICENSE file.
*Note that all licence references and agreements mentioned in the i18n README section above are relevant to that project's source code only.