AwesomeModelTranslations
Short description and motivation.
Usage
Add a translated attribute to your model:
class Project < ApplicationRecord
translates :name
endYou 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:
$ bundleOr install it yourself as:
$ gem install awesome_model_translationsInstall the migrations and run them:
rake railties:install:migrations
rails db:migrateLicense
The gem is available as open source under the terms of the MIT License.