Centralization of locale data collection for Ruby on Rails.
Include the gem to your Gemfile:
gem 'rails-i18n', '~> 6.0.0.beta1' # For 6.0.0.beta1 or higher
gem 'rails-i18n', '~> 5.1' # For 5.0.x, 5.1.x and 5.2.x
gem 'rails-i18n', '~> 4.0' # For 4.0.x
gem 'rails-i18n', '~> 3.0' # For 3.x
gem 'rails-i18n', github: 'svenfuchs/rails-i18n', branch: 'master' # For 5.x
gem 'rails-i18n', github: 'svenfuchs/rails-i18n', branch: 'rails-4-x' # For 4.x
gem 'rails-i18n', github: 'svenfuchs/rails-i18n', branch: 'rails-3-x' # For 3.x
Alternatively, execute the following command:
gem install rails-i18n -v '~> 6.0.0.beta1' # For 6.0.0.beta1 or higher
gem install rails-i18n -v '~> 5.1' # For For 5.0.x, 5.1.x and 5.2.x
gem install rails-i18n -v '~> 4.0' # For 4.0.x
gem install rails-i18n -v '~> 3.0' # For 3.x
Note that your Ruby on Rails version must be 3.0 or higher in order to install the rails-i18n
gem. For rails 2.x, install it manually as described in the Manual Installation section below.
rails-i18n
gem initially loads all available locale files, pluralization and transliteration rules. This default behaviour can be changed. If you specify in config/environments/*
the locales which have to be loaded via I18n.available_locales
option:
config.i18n.available_locales = ['es-CO', :de]
or
config.i18n.available_locales = :nl
Download desired locale files found in rails/locale directory and move them into the config/locales
directory of your Rails application.
If any translation doesn't suit well to the requirements of your application, edit them or add your own locale files.
For more information, visit Rails Internationalization (I18n) API on the RailsGuides.