mongoid_i18n 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +2 -2
- data/README.rdoc +6 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/mongoid/i18n.rb +1 -2
- data/mongoid_i18n.gemspec +5 -6
- metadata +7 -8
- data/lib/mongoid/i18n/patches.rb +0 -17
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -3,6 +3,12 @@
|
|
3
3
|
Mongoid::I18n is a gem that makes localization almost transparent for the developer.
|
4
4
|
|
5
5
|
== Usage
|
6
|
+
|
7
|
+
First, include it in your Gemfile. Remeber to add the :require parameter:
|
8
|
+
|
9
|
+
gem 'mongoid_i18n', :require => 'mongoid/i18n'
|
10
|
+
|
11
|
+
Now you can add the module to the documents that need localization:
|
6
12
|
|
7
13
|
class Entry
|
8
14
|
include Mongoid::Document
|
data/Rakefile
CHANGED
@@ -16,7 +16,7 @@ begin
|
|
16
16
|
gem.email = "papipo@gmail.com"
|
17
17
|
gem.homepage = "http://github.com/Papipo/mongoid_i18n"
|
18
18
|
gem.authors = ["Rodrigo Álvarez"]
|
19
|
-
gem.add_dependency "mongoid", '2.0.0.
|
19
|
+
gem.add_dependency "mongoid", '2.0.0.beta6'
|
20
20
|
gem.add_development_dependency "rspec", "2.0.0.beta.8"
|
21
21
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
22
22
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/lib/mongoid/i18n.rb
CHANGED
data/mongoid_i18n.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{mongoid_i18n}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Rodrigo Álvarez"]
|
12
|
-
s.date = %q{2010-05-
|
12
|
+
s.date = %q{2010-05-23}
|
13
13
|
s.description = %q{This gem aims to be a transparent way to deal with localizable fields.
|
14
14
|
Basically use localized_field() instead of field() and that's it.
|
15
15
|
It will take care of locales for you when using find.
|
@@ -30,7 +30,6 @@ Gem::Specification.new do |s|
|
|
30
30
|
"lib/mongoid/i18n.rb",
|
31
31
|
"lib/mongoid/i18n/localized_criteria.rb",
|
32
32
|
"lib/mongoid/i18n/localized_field.rb",
|
33
|
-
"lib/mongoid/i18n/patches.rb",
|
34
33
|
"mongoid_i18n.gemspec",
|
35
34
|
"spec/.rspec",
|
36
35
|
"spec/integration/mongoid/i18n_spec.rb",
|
@@ -55,14 +54,14 @@ Gem::Specification.new do |s|
|
|
55
54
|
s.specification_version = 3
|
56
55
|
|
57
56
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
58
|
-
s.add_runtime_dependency(%q<mongoid>, ["= 2.0.0.
|
57
|
+
s.add_runtime_dependency(%q<mongoid>, ["= 2.0.0.beta6"])
|
59
58
|
s.add_development_dependency(%q<rspec>, ["= 2.0.0.beta.8"])
|
60
59
|
else
|
61
|
-
s.add_dependency(%q<mongoid>, ["= 2.0.0.
|
60
|
+
s.add_dependency(%q<mongoid>, ["= 2.0.0.beta6"])
|
62
61
|
s.add_dependency(%q<rspec>, ["= 2.0.0.beta.8"])
|
63
62
|
end
|
64
63
|
else
|
65
|
-
s.add_dependency(%q<mongoid>, ["= 2.0.0.
|
64
|
+
s.add_dependency(%q<mongoid>, ["= 2.0.0.beta6"])
|
66
65
|
s.add_dependency(%q<rspec>, ["= 2.0.0.beta.8"])
|
67
66
|
end
|
68
67
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 3
|
9
|
+
version: 0.1.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "Rodrigo \xC3\x81lvarez"
|
@@ -14,12 +14,11 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-23 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: mongoid
|
22
|
-
prerelease: false
|
23
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
23
|
requirements:
|
25
24
|
- - "="
|
@@ -28,13 +27,13 @@ dependencies:
|
|
28
27
|
- 2
|
29
28
|
- 0
|
30
29
|
- 0
|
31
|
-
-
|
32
|
-
version: 2.0.0.
|
30
|
+
- beta6
|
31
|
+
version: 2.0.0.beta6
|
33
32
|
type: :runtime
|
33
|
+
prerelease: false
|
34
34
|
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: rspec
|
37
|
-
prerelease: false
|
38
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
38
|
requirements:
|
40
39
|
- - "="
|
@@ -47,6 +46,7 @@ dependencies:
|
|
47
46
|
- 8
|
48
47
|
version: 2.0.0.beta.8
|
49
48
|
type: :development
|
49
|
+
prerelease: false
|
50
50
|
version_requirements: *id002
|
51
51
|
description: "This gem aims to be a transparent way to deal with localizable fields.\n Basically use localized_field() instead of field() and that's it.\n It will take care of locales for you when using find.\n "
|
52
52
|
email: papipo@gmail.com
|
@@ -68,7 +68,6 @@ files:
|
|
68
68
|
- lib/mongoid/i18n.rb
|
69
69
|
- lib/mongoid/i18n/localized_criteria.rb
|
70
70
|
- lib/mongoid/i18n/localized_field.rb
|
71
|
-
- lib/mongoid/i18n/patches.rb
|
72
71
|
- mongoid_i18n.gemspec
|
73
72
|
- spec/.rspec
|
74
73
|
- spec/integration/mongoid/i18n_spec.rb
|
data/lib/mongoid/i18n/patches.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
module Mongoid
|
2
|
-
class Criteria
|
3
|
-
def self.translate(*args)
|
4
|
-
klass = args[0]
|
5
|
-
params = args[1] || {}
|
6
|
-
unless params.is_a?(Hash)
|
7
|
-
return klass.criteria.id_criteria(params)
|
8
|
-
end
|
9
|
-
conditions = params.delete(:conditions) || {}
|
10
|
-
if conditions.include?(:id)
|
11
|
-
conditions[:_id] = conditions[:id]
|
12
|
-
conditions.delete(:id)
|
13
|
-
end
|
14
|
-
return klass.criteria.where(conditions).extras(params)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|