Transmating

Transmating adds i18n information to Mongoid documents. Simply include Transmating::I18n to your model classes which include Mongoid::Document.

class Person
  include Mongoid::Document
  include Transmating::I18n

  field :name
  field :organization
end

Transmating::I18n adds a simple embeds_many relationship to your models, which is placeholder for translated attributes. You can translate your models with calling Transmating::I18n#translate method as presented below.

# Translate your model objects
p = Person.find_by_name("Yuna Kim")
p.translate("ko", :name => "김연아", :organization => "고려대")

After translation, you can utilize it by calling Transmating::I18n#translated method.

<!-- Present translated attributes in your views -->
안녕하세요! <%= @person.translated("ko").name %>님!

That's it. Feel free to fork and add your own features!