hstore_translate 0.0.5 → 0.0.6
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.lock +17 -75
- data/README.md +23 -0
- data/lib/hstore_translate/translates.rb +9 -1
- data/lib/hstore_translate/version.rb +1 -1
- metadata +21 -4
data/Gemfile.lock
CHANGED
@@ -1,95 +1,37 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hstore_translate (0.0.
|
4
|
+
hstore_translate (0.0.5)
|
5
5
|
activerecord (>= 3.1.0)
|
6
|
-
activerecord-postgres-hstore (~> 0.
|
6
|
+
activerecord-postgres-hstore (~> 0.7.0)
|
7
|
+
pg
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: http://rubygems.org/
|
10
11
|
specs:
|
11
|
-
|
12
|
-
|
13
|
-
mail (~> 2.4.4)
|
14
|
-
actionpack (3.2.10)
|
15
|
-
activemodel (= 3.2.10)
|
16
|
-
activesupport (= 3.2.10)
|
17
|
-
builder (~> 3.0.0)
|
18
|
-
erubis (~> 2.7.0)
|
19
|
-
journey (~> 1.0.4)
|
20
|
-
rack (~> 1.4.0)
|
21
|
-
rack-cache (~> 1.2)
|
22
|
-
rack-test (~> 0.6.1)
|
23
|
-
sprockets (~> 2.2.1)
|
24
|
-
activemodel (3.2.10)
|
25
|
-
activesupport (= 3.2.10)
|
12
|
+
activemodel (3.2.13)
|
13
|
+
activesupport (= 3.2.13)
|
26
14
|
builder (~> 3.0.0)
|
27
|
-
activerecord (3.2.
|
28
|
-
activemodel (= 3.2.
|
29
|
-
activesupport (= 3.2.
|
15
|
+
activerecord (3.2.13)
|
16
|
+
activemodel (= 3.2.13)
|
17
|
+
activesupport (= 3.2.13)
|
30
18
|
arel (~> 3.0.2)
|
31
19
|
tzinfo (~> 0.3.29)
|
32
|
-
activerecord-postgres-hstore (0.
|
33
|
-
|
34
|
-
|
20
|
+
activerecord-postgres-hstore (0.7.6)
|
21
|
+
activerecord (>= 3.1)
|
22
|
+
pg-hstore (>= 1.1.5)
|
35
23
|
rake
|
36
|
-
|
37
|
-
|
38
|
-
activesupport (= 3.2.10)
|
39
|
-
activesupport (3.2.10)
|
40
|
-
i18n (~> 0.6)
|
24
|
+
activesupport (3.2.13)
|
25
|
+
i18n (= 0.6.1)
|
41
26
|
multi_json (~> 1.0)
|
42
27
|
arel (3.0.2)
|
43
28
|
builder (3.0.4)
|
44
|
-
erubis (2.7.0)
|
45
|
-
hike (1.2.1)
|
46
29
|
i18n (0.6.1)
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
i18n (>= 0.4.0)
|
51
|
-
mime-types (~> 1.16)
|
52
|
-
treetop (~> 1.4.8)
|
53
|
-
mime-types (1.21)
|
54
|
-
multi_json (1.6.1)
|
55
|
-
pg (0.14.1)
|
56
|
-
polyglot (0.3.3)
|
57
|
-
rack (1.4.5)
|
58
|
-
rack-cache (1.2)
|
59
|
-
rack (>= 0.4)
|
60
|
-
rack-ssl (1.3.2)
|
61
|
-
rack
|
62
|
-
rack-test (0.6.2)
|
63
|
-
rack (>= 1.0)
|
64
|
-
rails (3.2.10)
|
65
|
-
actionmailer (= 3.2.10)
|
66
|
-
actionpack (= 3.2.10)
|
67
|
-
activerecord (= 3.2.10)
|
68
|
-
activeresource (= 3.2.10)
|
69
|
-
activesupport (= 3.2.10)
|
70
|
-
bundler (~> 1.0)
|
71
|
-
railties (= 3.2.10)
|
72
|
-
railties (3.2.10)
|
73
|
-
actionpack (= 3.2.10)
|
74
|
-
activesupport (= 3.2.10)
|
75
|
-
rack-ssl (~> 1.3.2)
|
76
|
-
rake (>= 0.8.7)
|
77
|
-
rdoc (~> 3.4)
|
78
|
-
thor (>= 0.14.6, < 2.0)
|
30
|
+
multi_json (1.7.4)
|
31
|
+
pg (0.15.1)
|
32
|
+
pg-hstore (1.1.7)
|
79
33
|
rake (10.0.3)
|
80
|
-
|
81
|
-
json (~> 1.4)
|
82
|
-
sprockets (2.2.2)
|
83
|
-
hike (~> 1.2)
|
84
|
-
multi_json (~> 1.0)
|
85
|
-
rack (~> 1.0)
|
86
|
-
tilt (~> 1.1, != 1.3.0)
|
87
|
-
thor (0.16.0)
|
88
|
-
tilt (1.3.3)
|
89
|
-
treetop (1.4.12)
|
90
|
-
polyglot
|
91
|
-
polyglot (>= 0.3.1)
|
92
|
-
tzinfo (0.3.35)
|
34
|
+
tzinfo (0.3.37)
|
93
35
|
|
94
36
|
PLATFORMS
|
95
37
|
ruby
|
data/README.md
CHANGED
@@ -88,3 +88,26 @@ config.i18n.fallbacks = true
|
|
88
88
|
|
89
89
|
Sven Fuchs wrote a [detailed explanation of the fallback
|
90
90
|
mechanism](https://github.com/svenfuchs/i18n/wiki/Fallbacks).
|
91
|
+
|
92
|
+
## Temporary disable fallbacks
|
93
|
+
|
94
|
+
If you've enabled fallbacks for missing translations, you probably want to disable
|
95
|
+
them in the admin interface to display which translations the user still has to
|
96
|
+
fill in.
|
97
|
+
|
98
|
+
From:
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
I18n.locale = :en
|
102
|
+
post.title # => This database rocks!
|
103
|
+
post.title_nl # => This database rocks!
|
104
|
+
```
|
105
|
+
|
106
|
+
To:
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
I18n.locale = :en
|
110
|
+
post.title # => This database rocks!
|
111
|
+
post.disable_fallback
|
112
|
+
post.title_nl # => nil
|
113
|
+
```
|
@@ -25,13 +25,21 @@ module HstoreTranslate
|
|
25
25
|
end
|
26
26
|
|
27
27
|
module InstanceMethods
|
28
|
+
def disable_fallback
|
29
|
+
@disable_fallback = true
|
30
|
+
end
|
31
|
+
|
32
|
+
def enable_fallback
|
33
|
+
@disable_fallback = false
|
34
|
+
end
|
35
|
+
|
28
36
|
protected
|
29
37
|
|
30
38
|
def read_hstore_translation(attr_name, locale = I18n.locale)
|
31
39
|
translations = send("#{attr_name}_translations") || {}
|
32
40
|
translation = translations[locale.to_s]
|
33
41
|
|
34
|
-
if translation.nil? && I18n.respond_to?(:fallbacks) && (fallbacks = I18n.fallbacks[locale])
|
42
|
+
if (@disable_fallback == nil || @disable_fallback == false) && translation.nil? && I18n.respond_to?(:fallbacks) && (fallbacks = I18n.fallbacks[locale])
|
35
43
|
fallbacks.find { |f| translation = translations[f.to_s] }
|
36
44
|
end
|
37
45
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hstore_translate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 3.1.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: pg
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: activerecord-postgres-hstore
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -34,7 +50,7 @@ dependencies:
|
|
34
50
|
requirements:
|
35
51
|
- - ~>
|
36
52
|
- !ruby/object:Gem::Version
|
37
|
-
version: 0.
|
53
|
+
version: 0.7.0
|
38
54
|
type: :runtime
|
39
55
|
prerelease: false
|
40
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +58,7 @@ dependencies:
|
|
42
58
|
requirements:
|
43
59
|
- - ~>
|
44
60
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.
|
61
|
+
version: 0.7.0
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: rake
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,3 +117,4 @@ specification_version: 3
|
|
101
117
|
summary: Rails I18n library for ActiveRecord model/data translation using PostgreSQL's
|
102
118
|
hstore datatype.
|
103
119
|
test_files: []
|
120
|
+
has_rdoc:
|