mongo-i18n 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.rdoc +22 -4
  2. data/lib/mongo-i18n/version.rb +1 -1
  3. metadata +4 -4
@@ -8,13 +8,31 @@ MongoDB backend implementation for I18n gem.
8
8
  * I18n 0.5.0
9
9
  * Rails 3.0.3
10
10
 
11
+ == Installation
12
+
13
+ From command line:
14
+
15
+ gem install mongo-i18n
16
+
17
+ At rails' 3 gemfile:
18
+
19
+ gem 'mongo-i18n'
20
+
11
21
  == Usage with Rails 3
12
22
 
13
- connection = Mongo::Connection.new['my_app_related_db'].collection('i18n')
14
- I18n.backend = I18n::Backend::KeyValue.new(MongoI18n::Store.new(collection))
23
+ I recommend to start with Chain[https://github.com/svenfuchs/i18n/blob/master/lib/i18n/backend/chain.rb] backend while mongodb collection is empty, and move to entirely mongodb-based backend when you populate your database with all I18n messages.
24
+
25
+ Begin with:
26
+
27
+ collection = Mongo::Connection.new['my_app_related_db'].collection('i18n')
28
+ I18n.backend = I18n::Backend::Chain.new(I18n::Backend::KeyValue.new(MongoI18n::Store.new(collection)), I18n.backend)
29
+
30
+ And finish with:
31
+
32
+ collection = Mongo::Connection.new['my_app_related_db'].collection('i18n')
33
+ I18n.backend = I18n::Backend::KeyValue.new(MongoI18n::Store.new(collection)
15
34
 
16
- Or if you already use mongodb in your app, say, via MongoMapper[https://github.com/jnunemaker/mongomapper] I recommend to reuse already existed connection.
17
- Like this (assume that MongoMapper version is 0.8.6 and it is already initialized):
35
+ 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:
18
36
 
19
37
  collection = MongoMapper.database.collection('i18n')
20
38
  I18n.backend = I18n::Backend::KeyValue.new(MongoI18n::Store.new(collection))
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  module MongoI18n
3
- Version = '0.0.1'
3
+ Version = '0.0.2'
4
4
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo-i18n
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alexander Ulizko
@@ -50,7 +50,7 @@ dependencies:
50
50
  version: 2.3.0
51
51
  type: :development
52
52
  version_requirements: *id002
53
- description:
53
+ description: MongoDB backend implementation for I18n gem.
54
54
  email:
55
55
  - alexander@ulizko.com
56
56
  executables: []