Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

MongoDB backend implementation for I18n gem.

branch: master

Merge pull request #1 from JamesKyburz/master

Added bundler, bson_ext along with the possibility to delete a key.
latest commit 8ae9fcb356
Alexander Ulizko authored September 29, 2011
Octocat-spinner-32 lib Added support to delete a key September 29, 2011
Octocat-spinner-32 spec Added support to delete a key September 29, 2011
Octocat-spinner-32 .gitignore Initial commit December 28, 2010
Octocat-spinner-32 Gemfile Added gemfile September 26, 2011
Octocat-spinner-32 Gemfile.lock Added gemfile September 26, 2011
Octocat-spinner-32 LICENSE Initial commit December 28, 2010
Octocat-spinner-32 README.rdoc Readme fixes December 28, 2010
Octocat-spinner-32 Rakefile Initial commit December 28, 2010
Octocat-spinner-32 mongo-i18n.gemspec Added bson_ext and removed strict mongo version September 26, 2011
README.rdoc

Mongo-I18n

MongoDB backend implementation for I18n gem.

Supports

  • Ruby 1.8.7 (Ruby 1.9+ untested but should work).

  • I18n 0.5.0

  • Rails 3.0.3

Installation

From command line:

gem install mongo-i18n

At rails' 3 gemfile:

gem 'mongo-i18n'

Usage with Rails 3

I recommend to start with Chain backend while mongodb collection is empty, and move to entirely mongodb-based backend when you populate your database with all I18n messages.

Begin with:

collection = Mongo::Connection.new['my_app_related_db'].collection('i18n')
I18n.backend = I18n::Backend::Chain.new(I18n::Backend::KeyValue.new(MongoI18n::Store.new(collection)), I18n.backend)

And finish with:

collection = Mongo::Connection.new['my_app_related_db'].collection('i18n')
I18n.backend = I18n::Backend::KeyValue.new(MongoI18n::Store.new(collection)

If you are already using a mongodb ORM in your project (and I suppose you are, why else would you be reading this article? :), I recommend using the existing database connection:

collection = MongoMapper.database.collection('i18n')
I18n.backend = I18n::Backend::KeyValue.new(MongoI18n::Store.new(collection))

License

Mongo-I18n is licensed under Apache license. See LICENSE for details.

Something went wrong with that request. Please try again.