hi all,
I've just released a testing version of my i18n gem for mongoid:
http://github.com/Papipo/mongoid_i18n
It only takes care of the fields persistence and querying. Nothing
about validations for example is done yet. Take a look at the README
if you want examples :-).
This is for Durran:
When a class includes the Mongoid::I18n module, this redefines its
criteria() method, in order to return a LocalizedCriteria object. The
thing is that the original Criteria class instantiates itself
bypassing the Document.criteria method, to be precise this happens in
Criteria.translate().
That's why I had to add a monkey patch to call klass.criteria()
instead of new(klass). Otherwise calls to translate() would yield a
Criteria instead of a LocalizedCriteria.
I think that this patch could be in mongoid master. As far as I know
it won't harm and I will make very easy to hook in custom Criteria
classes. You can see the code here
http://github.com/Papipo/mongoid_i18n/blob/master/lib/mongoid/i18n/patches.rb
lines 7 and 14.
Please test it, and tell me if you find any problems.
Thanks everybody.