acts_as_translatable is a plugin for easy translation of your Ruby on Rails models and database tables.
Installation
In your Gemfile:
gem 'acts_as_translatable'
Install the new gem:
bundle install
Example
Generate translations for a category model with name and description fields, with default locale set to ‘en’ (English):
$ rails generate acts_as_translatable en category name description
This will create the necessary migration. Then run:
$ rake db:migrate
Then add to app/models/category.rb:
class Category < ActiveRecord::Base acts_as_translatable_on :name, :description ... end
And play around with I18n:
I18n.locale = "en" Category.first.update_attribute :name, "English name" I18n.locale = "de" Category.first.update_attribute :name, "Deutsche Name"
Also try in combination with my translate_acts_as_translatable_models plugin to automatically translate your acts_as_translatable enabled models.
Have fun! Please send comments and suggestions to lassebunk@gmail.com, and issues at GitHub, please :)