AwesomeModelTranslations
Short description and motivation.
Usage
Add a translated attribute to your model:
class Project < ApplicationRecord
translates :name
end
You can set the name in the current locale like this:
I18n.locale = :en
project.name = "English name"
project.name #=> "English name"
Or set the name for a specific locale like this:
I18n.locale = :en
project.name_da = "Dansk navn"
project.name #=> "Dansk navn"
Installation
Add this line to your application's Gemfile:
gem "awesome_model_translations"
And then execute:
$ bundle
Or install it yourself as:
$ gem install awesome_model_translations
Install the migrations and run them:
rake railties:install:migrations
rails db:migrate
License
The gem is available as open source under the terms of the MIT License.