Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
Papipo committed May 2, 2010
1 parent 0a9f6e6 commit 75c9e98
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion README.rdoc
@@ -1,6 +1,37 @@
= mongoid_i18n

Description goes here.
Mongoid::I18n is a gem that makes localization almost transparent for the developer.
It is under development, so it lacks some features. Check "Known issues" below.

== Usage

class Entry
include Mongoid::Document
include Mongoid::I18n

localized_field :title # Just use localized_field instead of field
field :published, :type => Boolean
end

This will allow you to do stuff like this:

I18n.locale = :en
@entry = Entry.new(:title => 'Title') # will be stored in the 'en' translation

I18n.locale :es
@entry.title = 'Título' # will be stored in the 'es' translation

@entry.title_translations # this returns a hash: {:en => 'Title', :es => 'Title'}
@entry.title_translations = {:en => 'New title', :es => 'Nuevo título} # You can always mass-assign.

Criteria is handled for you:

I18n.locale = :en
Entry.where(:title => 'Title') # This will search automatically for the 'en' translation

== Known issues

* It does not handle translations automatically when using find().

== Note on Patches/Pull Requests

Expand Down

0 comments on commit 75c9e98

Please sign in to comment.