Installation Guide
Integrating rails-i18n
into your project is straightforward. The primary method is by adding the gem to your application's Gemfile
.
Requirements
- Ruby: Version 3.2.0 or newer
- Rails (Railties): Version 8.0.0 or newer (for the latest
rails-i18n
version)
Gemfile Installation
Add the rails-i18n
gem to your Gemfile
. The version you should use depends on your Rails version.
gem 'rails-i18n', '~> 8.0.0'
After adding the gem, run Bundler to install it:
bundle install
Version Compatibility
It is crucial to use a version of rails-i18n
that is compatible with your version of Rails to ensure all translation keys match.
Rails Version | Recommended rails-i18n Version |
Gemfile Entry |
---|---|---|
Rails >= 8.0.0 | ~> 8.0.0 |
gem 'rails-i18n', '~> 8.0.0' |
Rails >= 7.0.0 | ~> 7.0.0 |
gem 'rails-i18n', '~> 7.0.0' |
Rails 6.x | ~> 6.0 |
gem 'rails-i18n', '~> 6.0' |
Rails 5.x | ~> 5.1 |
gem 'rails-i18n', '~> 5.1' |
Rails 4.x | ~> 4.0 |
gem 'rails-i18n', '~> 4.0' |
Rails 3.x | ~> 3.0 |
gem 'rails-i18n', '~> 3.0' |
For bleeding-edge, unreleased versions, you can install directly from the GitHub repository's master branch:
gem 'rails-i18n', github: 'svenfuchs/rails-i18n', branch: 'master'
Manual Installation
Alternatively, you can install the gem directly using the command line:
gem install rails-i18n -v '~> 8.0.0'
For older Rails 2.3 applications, you must install the files manually by downloading them from the rails-2-3
branch on GitHub and placing them in your application's config/locales
directory.