globalize 4.0.2 → 4.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +13 -7
- data/Gemfile.lock +25 -227
- data/lib/globalize.rb +4 -4
- data/lib/globalize/active_record/class_methods.rb +4 -1
- data/lib/globalize/active_record/instance_methods.rb +9 -2
- data/lib/globalize/version.rb +1 -1
- metadata +50 -77
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1d86330a6d33c2690020a923b34f33212f334d33
|
4
|
+
data.tar.gz: c4295ec69aed48ffa104e98384b57fedd8e627f8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 969f5f26a04dc4ee0a79d569cb771bac063198f2fe9624ca627e4fe602298b4a204237eba4a08e470d70856eeb955fed65d2b4d5b62281dd8a4ade974cc71b66
|
7
|
+
data.tar.gz: e4de5115385b47cc9c699421dd53b3348377133e3b47ea2606b59945d9c3983bad1911efb5e5b8a6885ad2149517ff54ca45a780316126fcfdee3031ba56a67c
|
data/CHANGELOG.md
CHANGED
@@ -1,21 +1,27 @@
|
|
1
1
|
# Globalize Changelog
|
2
2
|
|
3
|
-
## 4.0.
|
3
|
+
## 4.0.3 (2014-11-24)
|
4
|
+
* Fixes a problem where after dup the dup'd model and the original model shared a translation instance, which means that if you mutate a translated field on the dup and save it, the original becomes a clone of the dup. [#352](https://github.com/globalize/globalize/pull/352).
|
5
|
+
* Deprecated `with_required_attributes`, `required_attributes`, and `required_translated_attributes`. `with_translations` no longer invokes `with_required_attributes`. [#355](https://github.com/globalize/globalize/pull/355).
|
6
|
+
* Removed all usages of `Thread.local`. [#374](https://github.com/globalize/globalize/pull/374). (thanks [Hubert Lee](https://github.com/hube)).
|
7
|
+
* Added `available_locales` method. This duplicates `translated_locales` method, but it doesn't use a separate `DISTINCT` query. [#339](https://github.com/globalize/globalize/pull/339). (thanks [Andrew Volozhanin](https://github.com/scarfacedeb)).
|
8
|
+
|
9
|
+
## 4.0.2 (2014-06-29)
|
4
10
|
* Use `reflections` class method so `ensure_foreign_key_for` works in AR >= 4.1.2, fixes [#353](https://github.com/globalize/globalize/pull/353).
|
5
11
|
* Set `touch:true` on `belongs_to` for the globalized model, fixes [#330](https://github.com/globalize/globalize/pull/330) (thanks [shlensky](https://github.com/shlensky)).
|
6
12
|
* Accept optional arguments passed to `where_values_hash`, fixes [#354](https://github.com/globalize/globalize/pull/354) (thanks [felixbuenemann](https://github.com/felixbuenemann)).
|
7
13
|
|
8
|
-
## 4.0.1 (2014-
|
14
|
+
## 4.0.1 (2014-03-29)
|
9
15
|
* Fix bug where `with_translations` only works if called after `where` in relation chain, fixes [#343](https://github.com/globalize/globalize/issues/343).
|
10
16
|
* Use `preload` and `joins` instead of `includes` in `with_translations`, fixes [#329](https://github.com/globalize/globalize/issues/329) (thanks [Andrew Volozhanin](https://github.com/scarfacedeb)).
|
11
17
|
* Update `database_cleaner` dependency to 1.2.0.
|
12
18
|
* Support use of `first`/`take`/`last` with limit on queries with translated attributes, fixes [#322](https://github.com/globalize/globalize/issues/322) (thanks [prusswan](https://github.com/prusswan)).
|
13
19
|
* Ensure that options are always extracted from `attr_names` in `Globalize::ActiveRecord::ActMacro#translates`, PR [#319](https://github.com/globalize/globalize/pull/319) (thanks [Marek](https://github.com/keram)).
|
14
20
|
|
15
|
-
## 4.0.0 (2014-
|
21
|
+
## 4.0.0 (2014-01-04)
|
16
22
|
* Extract all versioning-related code to separate [globalize-versioning](https://github.com/globalize/globalize-versioning) gem.
|
17
23
|
|
18
|
-
## 4.0.0.alpha.5 (2014-
|
24
|
+
## 4.0.0.alpha.5 (2014-01-04)
|
19
25
|
* Fix issue where globalize breaks has_many through when model called with `where` (thanks [Paul McMahon](https://github.com/pwim)).
|
20
26
|
* Modify dup so that translations are copied, and remove custom clone code to conform to Rails/AR semantics (thanks [Paul McMahon](https://github.com/pwim)).
|
21
27
|
|
@@ -52,15 +58,15 @@
|
|
52
58
|
* Duplicate arguments in query finders before modifying them, fixes [#284](https://github.com/globalize/globalize/issues/284).
|
53
59
|
* Add test for `find_or_create_by` with translated attribute.
|
54
60
|
|
55
|
-
## 4.0.0.alpha.1 (2013-10-
|
61
|
+
## 4.0.0.alpha.1 (2013-10-09)
|
56
62
|
|
57
63
|
* Initial release of Rails 4-compatible gem.
|
58
64
|
|
59
|
-
## 3.1.0 (2014-
|
65
|
+
## 3.1.0 (2014-01-25)
|
60
66
|
|
61
67
|
* Backport scope support on uniqueness validation from 4.0, drop support for ActiveRecord < 3.1, fixes [#324](https://github.com/globalize/globalize/issues/324).
|
62
68
|
|
63
|
-
## 3.0.4 (2014-
|
69
|
+
## 3.0.4 (2014-01-08)
|
64
70
|
* Extract all versioning-related code to separate [globalize-versioning](https://github.com/globalize/globalize-versioning) gem.
|
65
71
|
|
66
72
|
## 3.0.3 (2013-12-26)
|
data/Gemfile.lock
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
globalize (4.0.
|
5
|
-
activemodel (
|
6
|
-
activerecord (
|
4
|
+
globalize (4.0.3)
|
5
|
+
activemodel (>= 4.0.0, < 5)
|
6
|
+
activerecord (>= 4.0.0, < 5)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (4.1.
|
12
|
-
activesupport (= 4.1.
|
11
|
+
activemodel (4.1.8)
|
12
|
+
activesupport (= 4.1.8)
|
13
13
|
builder (~> 3.1)
|
14
|
-
activerecord (4.1.
|
15
|
-
activemodel (= 4.1.
|
16
|
-
activesupport (= 4.1.
|
14
|
+
activerecord (4.1.8)
|
15
|
+
activemodel (= 4.1.8)
|
16
|
+
activesupport (= 4.1.8)
|
17
17
|
arel (~> 5.0.0)
|
18
|
-
activesupport (4.1.
|
18
|
+
activesupport (4.1.8)
|
19
19
|
i18n (~> 0.6, >= 0.6.9)
|
20
20
|
json (~> 1.7, >= 1.7.7)
|
21
21
|
minitest (~> 5.1)
|
@@ -25,240 +25,38 @@ GEM
|
|
25
25
|
arel (5.0.1.20140414130214)
|
26
26
|
builder (3.2.2)
|
27
27
|
coderay (1.1.0)
|
28
|
-
database_cleaner (1.
|
29
|
-
|
30
|
-
i18n (0.6.9)
|
28
|
+
database_cleaner (1.3.0)
|
29
|
+
i18n (0.6.11)
|
31
30
|
json (1.8.1)
|
32
31
|
method_source (0.8.2)
|
33
|
-
minitest (5.3
|
34
|
-
minitest-reporters (1.0.
|
32
|
+
minitest (5.4.3)
|
33
|
+
minitest-reporters (1.0.7)
|
35
34
|
ansi
|
36
35
|
builder
|
37
36
|
minitest (>= 5.0)
|
38
37
|
ruby-progressbar
|
39
|
-
pry (0.
|
40
|
-
coderay (~> 1.0)
|
41
|
-
method_source (~> 0.8)
|
38
|
+
pry (0.10.1)
|
39
|
+
coderay (~> 1.1.0)
|
40
|
+
method_source (~> 0.8.1)
|
42
41
|
slop (~> 3.4)
|
43
|
-
pry-nav (0.2.
|
44
|
-
pry (
|
42
|
+
pry-nav (0.2.4)
|
43
|
+
pry (>= 0.9.10, < 0.11.0)
|
45
44
|
rake (10.3.2)
|
46
|
-
rdoc (4.1.
|
45
|
+
rdoc (4.1.2)
|
47
46
|
json (~> 1.4)
|
48
|
-
ruby-progressbar (1.
|
49
|
-
|
50
|
-
|
51
|
-
rubysl-base64 (~> 2.0)
|
52
|
-
rubysl-benchmark (~> 2.0)
|
53
|
-
rubysl-bigdecimal (~> 2.0)
|
54
|
-
rubysl-cgi (~> 2.0)
|
55
|
-
rubysl-cgi-session (~> 2.0)
|
56
|
-
rubysl-cmath (~> 2.0)
|
57
|
-
rubysl-complex (~> 2.0)
|
58
|
-
rubysl-continuation (~> 2.0)
|
59
|
-
rubysl-coverage (~> 2.0)
|
60
|
-
rubysl-csv (~> 2.0)
|
61
|
-
rubysl-curses (~> 2.0)
|
62
|
-
rubysl-date (~> 2.0)
|
63
|
-
rubysl-delegate (~> 2.0)
|
64
|
-
rubysl-digest (~> 2.0)
|
65
|
-
rubysl-drb (~> 2.0)
|
66
|
-
rubysl-e2mmap (~> 2.0)
|
67
|
-
rubysl-english (~> 2.0)
|
68
|
-
rubysl-enumerator (~> 2.0)
|
69
|
-
rubysl-erb (~> 2.0)
|
70
|
-
rubysl-etc (~> 2.0)
|
71
|
-
rubysl-expect (~> 2.0)
|
72
|
-
rubysl-fcntl (~> 2.0)
|
73
|
-
rubysl-fiber (~> 2.0)
|
74
|
-
rubysl-fileutils (~> 2.0)
|
75
|
-
rubysl-find (~> 2.0)
|
76
|
-
rubysl-forwardable (~> 2.0)
|
77
|
-
rubysl-getoptlong (~> 2.0)
|
78
|
-
rubysl-gserver (~> 2.0)
|
79
|
-
rubysl-io-console (~> 2.0)
|
80
|
-
rubysl-io-nonblock (~> 2.0)
|
81
|
-
rubysl-io-wait (~> 2.0)
|
82
|
-
rubysl-ipaddr (~> 2.0)
|
83
|
-
rubysl-irb (~> 2.0)
|
84
|
-
rubysl-logger (~> 2.0)
|
85
|
-
rubysl-mathn (~> 2.0)
|
86
|
-
rubysl-matrix (~> 2.0)
|
87
|
-
rubysl-mkmf (~> 2.0)
|
88
|
-
rubysl-monitor (~> 2.0)
|
89
|
-
rubysl-mutex_m (~> 2.0)
|
90
|
-
rubysl-net-ftp (~> 2.0)
|
91
|
-
rubysl-net-http (~> 2.0)
|
92
|
-
rubysl-net-imap (~> 2.0)
|
93
|
-
rubysl-net-pop (~> 2.0)
|
94
|
-
rubysl-net-protocol (~> 2.0)
|
95
|
-
rubysl-net-smtp (~> 2.0)
|
96
|
-
rubysl-net-telnet (~> 2.0)
|
97
|
-
rubysl-nkf (~> 2.0)
|
98
|
-
rubysl-observer (~> 2.0)
|
99
|
-
rubysl-open-uri (~> 2.0)
|
100
|
-
rubysl-open3 (~> 2.0)
|
101
|
-
rubysl-openssl (~> 2.0)
|
102
|
-
rubysl-optparse (~> 2.0)
|
103
|
-
rubysl-ostruct (~> 2.0)
|
104
|
-
rubysl-pathname (~> 2.0)
|
105
|
-
rubysl-prettyprint (~> 2.0)
|
106
|
-
rubysl-prime (~> 2.0)
|
107
|
-
rubysl-profile (~> 2.0)
|
108
|
-
rubysl-profiler (~> 2.0)
|
109
|
-
rubysl-pstore (~> 2.0)
|
110
|
-
rubysl-pty (~> 2.0)
|
111
|
-
rubysl-rational (~> 2.0)
|
112
|
-
rubysl-readline (~> 2.0)
|
113
|
-
rubysl-resolv (~> 2.0)
|
114
|
-
rubysl-rexml (~> 2.0)
|
115
|
-
rubysl-rinda (~> 2.0)
|
116
|
-
rubysl-rss (~> 2.0)
|
117
|
-
rubysl-scanf (~> 2.0)
|
118
|
-
rubysl-securerandom (~> 2.0)
|
119
|
-
rubysl-set (~> 2.0)
|
120
|
-
rubysl-shellwords (~> 2.0)
|
121
|
-
rubysl-singleton (~> 2.0)
|
122
|
-
rubysl-socket (~> 2.0)
|
123
|
-
rubysl-stringio (~> 2.0)
|
124
|
-
rubysl-strscan (~> 2.0)
|
125
|
-
rubysl-sync (~> 2.0)
|
126
|
-
rubysl-syslog (~> 2.0)
|
127
|
-
rubysl-tempfile (~> 2.0)
|
128
|
-
rubysl-thread (~> 2.0)
|
129
|
-
rubysl-thwait (~> 2.0)
|
130
|
-
rubysl-time (~> 2.0)
|
131
|
-
rubysl-timeout (~> 2.0)
|
132
|
-
rubysl-tmpdir (~> 2.0)
|
133
|
-
rubysl-tsort (~> 2.0)
|
134
|
-
rubysl-un (~> 2.0)
|
135
|
-
rubysl-uri (~> 2.0)
|
136
|
-
rubysl-weakref (~> 2.0)
|
137
|
-
rubysl-webrick (~> 2.0)
|
138
|
-
rubysl-xmlrpc (~> 2.0)
|
139
|
-
rubysl-yaml (~> 2.0)
|
140
|
-
rubysl-zlib (~> 2.0)
|
141
|
-
rubysl-abbrev (2.0.4)
|
142
|
-
rubysl-base64 (2.0.0)
|
143
|
-
rubysl-benchmark (2.0.1)
|
144
|
-
rubysl-bigdecimal (2.0.2)
|
145
|
-
rubysl-cgi (2.0.1)
|
146
|
-
rubysl-cgi-session (2.0.1)
|
147
|
-
rubysl-cmath (2.0.0)
|
148
|
-
rubysl-complex (2.0.0)
|
149
|
-
rubysl-continuation (2.0.0)
|
150
|
-
rubysl-coverage (2.0.3)
|
151
|
-
rubysl-csv (2.0.2)
|
152
|
-
rubysl-english (~> 2.0)
|
153
|
-
rubysl-curses (2.0.1)
|
154
|
-
rubysl-date (2.0.6)
|
155
|
-
rubysl-delegate (2.0.1)
|
156
|
-
rubysl-digest (2.0.3)
|
157
|
-
rubysl-drb (2.0.1)
|
158
|
-
rubysl-e2mmap (2.0.0)
|
159
|
-
rubysl-english (2.0.0)
|
160
|
-
rubysl-enumerator (2.0.0)
|
161
|
-
rubysl-erb (2.0.1)
|
162
|
-
rubysl-etc (2.0.3)
|
163
|
-
ffi2-generators (~> 0.1)
|
164
|
-
rubysl-expect (2.0.0)
|
165
|
-
rubysl-fcntl (2.0.4)
|
166
|
-
ffi2-generators (~> 0.1)
|
167
|
-
rubysl-fiber (2.0.0)
|
168
|
-
rubysl-fileutils (2.0.3)
|
169
|
-
rubysl-find (2.0.1)
|
170
|
-
rubysl-forwardable (2.0.1)
|
171
|
-
rubysl-getoptlong (2.0.0)
|
172
|
-
rubysl-gserver (2.0.0)
|
173
|
-
rubysl-socket (~> 2.0)
|
174
|
-
rubysl-thread (~> 2.0)
|
175
|
-
rubysl-io-console (2.0.0)
|
176
|
-
rubysl-io-nonblock (2.0.0)
|
177
|
-
rubysl-io-wait (2.0.0)
|
178
|
-
rubysl-ipaddr (2.0.0)
|
179
|
-
rubysl-irb (2.0.4)
|
180
|
-
rubysl-e2mmap (~> 2.0)
|
181
|
-
rubysl-mathn (~> 2.0)
|
182
|
-
rubysl-readline (~> 2.0)
|
183
|
-
rubysl-thread (~> 2.0)
|
184
|
-
rubysl-logger (2.0.0)
|
185
|
-
rubysl-mathn (2.0.0)
|
186
|
-
rubysl-matrix (2.1.0)
|
187
|
-
rubysl-e2mmap (~> 2.0)
|
188
|
-
rubysl-mkmf (2.0.1)
|
189
|
-
rubysl-fileutils (~> 2.0)
|
190
|
-
rubysl-shellwords (~> 2.0)
|
191
|
-
rubysl-monitor (2.0.0)
|
192
|
-
rubysl-mutex_m (2.0.0)
|
193
|
-
rubysl-net-ftp (2.0.1)
|
194
|
-
rubysl-net-http (2.0.4)
|
195
|
-
rubysl-cgi (~> 2.0)
|
196
|
-
rubysl-erb (~> 2.0)
|
197
|
-
rubysl-singleton (~> 2.0)
|
198
|
-
rubysl-net-imap (2.0.1)
|
199
|
-
rubysl-net-pop (2.0.1)
|
200
|
-
rubysl-net-protocol (2.0.1)
|
201
|
-
rubysl-net-smtp (2.0.1)
|
202
|
-
rubysl-net-telnet (2.0.0)
|
203
|
-
rubysl-nkf (2.0.1)
|
204
|
-
rubysl-observer (2.0.0)
|
205
|
-
rubysl-open-uri (2.0.0)
|
206
|
-
rubysl-open3 (2.0.0)
|
207
|
-
rubysl-openssl (2.1.0)
|
208
|
-
rubysl-optparse (2.0.1)
|
209
|
-
rubysl-shellwords (~> 2.0)
|
210
|
-
rubysl-ostruct (2.0.4)
|
211
|
-
rubysl-pathname (2.0.0)
|
212
|
-
rubysl-prettyprint (2.0.3)
|
213
|
-
rubysl-prime (2.0.1)
|
214
|
-
rubysl-profile (2.0.0)
|
215
|
-
rubysl-profiler (2.0.1)
|
216
|
-
rubysl-pstore (2.0.0)
|
217
|
-
rubysl-pty (2.0.2)
|
218
|
-
rubysl-rational (2.0.1)
|
219
|
-
rubysl-readline (2.0.2)
|
220
|
-
rubysl-resolv (2.1.0)
|
221
|
-
rubysl-rexml (2.0.2)
|
222
|
-
rubysl-rinda (2.0.1)
|
223
|
-
rubysl-rss (2.0.0)
|
224
|
-
rubysl-scanf (2.0.0)
|
225
|
-
rubysl-securerandom (2.0.0)
|
226
|
-
rubysl-set (2.0.1)
|
227
|
-
rubysl-shellwords (2.0.0)
|
228
|
-
rubysl-singleton (2.0.0)
|
229
|
-
rubysl-socket (2.0.1)
|
230
|
-
rubysl-stringio (2.0.0)
|
231
|
-
rubysl-strscan (2.0.0)
|
232
|
-
rubysl-sync (2.0.0)
|
233
|
-
rubysl-syslog (2.0.1)
|
234
|
-
ffi2-generators (~> 0.1)
|
235
|
-
rubysl-tempfile (2.0.1)
|
236
|
-
rubysl-thread (2.0.2)
|
237
|
-
rubysl-thwait (2.0.0)
|
238
|
-
rubysl-time (2.0.3)
|
239
|
-
rubysl-timeout (2.0.0)
|
240
|
-
rubysl-tmpdir (2.0.1)
|
241
|
-
rubysl-tsort (2.0.1)
|
242
|
-
rubysl-un (2.0.0)
|
243
|
-
rubysl-fileutils (~> 2.0)
|
244
|
-
rubysl-optparse (~> 2.0)
|
245
|
-
rubysl-uri (2.0.0)
|
246
|
-
rubysl-weakref (2.0.0)
|
247
|
-
rubysl-webrick (2.0.0)
|
248
|
-
rubysl-xmlrpc (2.0.0)
|
249
|
-
rubysl-yaml (2.0.4)
|
250
|
-
rubysl-zlib (2.0.1)
|
251
|
-
slop (3.5.0)
|
252
|
-
sqlite3 (1.3.9)
|
47
|
+
ruby-progressbar (1.7.0)
|
48
|
+
slop (3.6.0)
|
49
|
+
sqlite3 (1.3.10)
|
253
50
|
thread_safe (0.3.4)
|
254
|
-
tzinfo (1.2.
|
51
|
+
tzinfo (1.2.2)
|
255
52
|
thread_safe (~> 0.1)
|
256
53
|
|
257
54
|
PLATFORMS
|
55
|
+
java
|
258
56
|
ruby
|
259
57
|
|
260
58
|
DEPENDENCIES
|
261
|
-
database_cleaner (~> 1.
|
59
|
+
database_cleaner (~> 1.3.0)
|
262
60
|
globalize!
|
263
61
|
minitest
|
264
62
|
minitest-reporters
|
data/lib/globalize.rb
CHANGED
@@ -52,15 +52,15 @@ module Globalize
|
|
52
52
|
protected
|
53
53
|
|
54
54
|
def read_locale
|
55
|
-
|
55
|
+
@globalize_locale
|
56
56
|
end
|
57
57
|
|
58
58
|
def set_locale(locale)
|
59
|
-
|
59
|
+
@globalize_locale = locale.try(:to_sym)
|
60
60
|
end
|
61
61
|
|
62
62
|
def read_fallbacks
|
63
|
-
|
63
|
+
@fallbacks || HashWithIndifferentAccess.new
|
64
64
|
end
|
65
65
|
|
66
66
|
def set_fallbacks(locales)
|
@@ -70,7 +70,7 @@ module Globalize
|
|
70
70
|
fallback_hash[key] = value.presence || [key]
|
71
71
|
end if locales.present?
|
72
72
|
|
73
|
-
|
73
|
+
@fallbacks = fallback_hash
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
@@ -9,10 +9,11 @@ module Globalize
|
|
9
9
|
|
10
10
|
def with_translations(*locales)
|
11
11
|
locales = translated_locales if locales.empty?
|
12
|
-
preload(:translations).joins(:translations).readonly(false).with_locales(locales)
|
12
|
+
preload(:translations).joins(:translations).readonly(false).with_locales(locales)
|
13
13
|
end
|
14
14
|
|
15
15
|
def with_required_attributes
|
16
|
+
warn 'with_required_attributes is deprecated and will be removed in the next release of Globalize.'
|
16
17
|
required_translated_attributes.inject(all) do |scope, name|
|
17
18
|
scope.where("#{translated_column_name(name)} IS NOT NULL")
|
18
19
|
end
|
@@ -30,10 +31,12 @@ module Globalize
|
|
30
31
|
end
|
31
32
|
|
32
33
|
def required_attributes
|
34
|
+
warn 'required_attributes is deprecated and will be removed in the next release of Globalize.'
|
33
35
|
validators.map { |v| v.attributes if v.is_a?(ActiveModel::Validations::PresenceValidator) }.flatten
|
34
36
|
end
|
35
37
|
|
36
38
|
def required_translated_attributes
|
39
|
+
warn 'required_translated_attributes is deprecated and will be removed in the next release of Globalize.'
|
37
40
|
translated_attribute_names & required_attributes
|
38
41
|
end
|
39
42
|
|
@@ -99,6 +99,8 @@ module Globalize
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def initialize_dup(other)
|
102
|
+
@globalize = nil
|
103
|
+
@translation_caches = nil
|
102
104
|
super
|
103
105
|
other.each_locale_and_translated_attribute do |locale, name|
|
104
106
|
globalize.write(locale, name, other.globalize.fetch(locale, name) )
|
@@ -124,9 +126,9 @@ module Globalize
|
|
124
126
|
@translation_caches ||= {}
|
125
127
|
end
|
126
128
|
|
127
|
-
def translations_by_locale
|
129
|
+
def translations_by_locale
|
128
130
|
translations.each_with_object(HashWithIndifferentAccess.new) do |t, hash|
|
129
|
-
hash[t.locale] = block_given? ?
|
131
|
+
hash[t.locale] = block_given? ? yield(t) : t
|
130
132
|
end
|
131
133
|
end
|
132
134
|
|
@@ -134,6 +136,11 @@ module Globalize
|
|
134
136
|
translations_by_locale(&:"#{name}")
|
135
137
|
end
|
136
138
|
|
139
|
+
# Get available locales from translations association, without a separate distinct query
|
140
|
+
def available_locales
|
141
|
+
translations.map(&:locale).uniq
|
142
|
+
end
|
143
|
+
|
137
144
|
def globalize_fallbacks(locale)
|
138
145
|
Globalize.fallbacks(locale)
|
139
146
|
end
|
data/lib/globalize/version.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: globalize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
5
|
-
prerelease:
|
4
|
+
version: 4.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Sven Fuchs
|
@@ -15,146 +14,130 @@ authors:
|
|
15
14
|
autorequire:
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
|
-
date: 2014-
|
17
|
+
date: 2014-11-25 00:00:00.000000000 Z
|
19
18
|
dependencies:
|
20
19
|
- !ruby/object:Gem::Dependency
|
21
20
|
name: activerecord
|
22
21
|
requirement: !ruby/object:Gem::Requirement
|
23
|
-
none: false
|
24
22
|
requirements:
|
25
|
-
- -
|
23
|
+
- - ">="
|
26
24
|
- !ruby/object:Gem::Version
|
27
25
|
version: 4.0.0
|
28
|
-
- - <
|
26
|
+
- - "<"
|
29
27
|
- !ruby/object:Gem::Version
|
30
28
|
version: '5'
|
31
29
|
type: :runtime
|
32
30
|
prerelease: false
|
33
31
|
version_requirements: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
32
|
requirements:
|
36
|
-
- -
|
33
|
+
- - ">="
|
37
34
|
- !ruby/object:Gem::Version
|
38
35
|
version: 4.0.0
|
39
|
-
- - <
|
36
|
+
- - "<"
|
40
37
|
- !ruby/object:Gem::Version
|
41
38
|
version: '5'
|
42
39
|
- !ruby/object:Gem::Dependency
|
43
40
|
name: activemodel
|
44
41
|
requirement: !ruby/object:Gem::Requirement
|
45
|
-
none: false
|
46
42
|
requirements:
|
47
|
-
- -
|
43
|
+
- - ">="
|
48
44
|
- !ruby/object:Gem::Version
|
49
45
|
version: 4.0.0
|
50
|
-
- - <
|
46
|
+
- - "<"
|
51
47
|
- !ruby/object:Gem::Version
|
52
48
|
version: '5'
|
53
49
|
type: :runtime
|
54
50
|
prerelease: false
|
55
51
|
version_requirements: !ruby/object:Gem::Requirement
|
56
|
-
none: false
|
57
52
|
requirements:
|
58
|
-
- -
|
53
|
+
- - ">="
|
59
54
|
- !ruby/object:Gem::Version
|
60
55
|
version: 4.0.0
|
61
|
-
- - <
|
56
|
+
- - "<"
|
62
57
|
- !ruby/object:Gem::Version
|
63
58
|
version: '5'
|
64
59
|
- !ruby/object:Gem::Dependency
|
65
60
|
name: database_cleaner
|
66
61
|
requirement: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
62
|
requirements:
|
69
|
-
- - ~>
|
63
|
+
- - "~>"
|
70
64
|
- !ruby/object:Gem::Version
|
71
|
-
version: 1.
|
65
|
+
version: 1.3.0
|
72
66
|
type: :development
|
73
67
|
prerelease: false
|
74
68
|
version_requirements: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
69
|
requirements:
|
77
|
-
- - ~>
|
70
|
+
- - "~>"
|
78
71
|
- !ruby/object:Gem::Version
|
79
|
-
version: 1.
|
72
|
+
version: 1.3.0
|
80
73
|
- !ruby/object:Gem::Dependency
|
81
74
|
name: minitest
|
82
75
|
requirement: !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
76
|
requirements:
|
85
|
-
- -
|
77
|
+
- - ">="
|
86
78
|
- !ruby/object:Gem::Version
|
87
79
|
version: '0'
|
88
80
|
type: :development
|
89
81
|
prerelease: false
|
90
82
|
version_requirements: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
83
|
requirements:
|
93
|
-
- -
|
84
|
+
- - ">="
|
94
85
|
- !ruby/object:Gem::Version
|
95
86
|
version: '0'
|
96
87
|
- !ruby/object:Gem::Dependency
|
97
88
|
name: minitest-reporters
|
98
89
|
requirement: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
90
|
requirements:
|
101
|
-
- -
|
91
|
+
- - ">="
|
102
92
|
- !ruby/object:Gem::Version
|
103
93
|
version: '0'
|
104
94
|
type: :development
|
105
95
|
prerelease: false
|
106
96
|
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
97
|
requirements:
|
109
|
-
- -
|
98
|
+
- - ">="
|
110
99
|
- !ruby/object:Gem::Version
|
111
100
|
version: '0'
|
112
101
|
- !ruby/object:Gem::Dependency
|
113
102
|
name: sqlite3
|
114
103
|
requirement: !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
104
|
requirements:
|
117
|
-
- -
|
105
|
+
- - ">="
|
118
106
|
- !ruby/object:Gem::Version
|
119
107
|
version: '0'
|
120
108
|
type: :development
|
121
109
|
prerelease: false
|
122
110
|
version_requirements: !ruby/object:Gem::Requirement
|
123
|
-
none: false
|
124
111
|
requirements:
|
125
|
-
- -
|
112
|
+
- - ">="
|
126
113
|
- !ruby/object:Gem::Version
|
127
114
|
version: '0'
|
128
115
|
- !ruby/object:Gem::Dependency
|
129
116
|
name: rdoc
|
130
117
|
requirement: !ruby/object:Gem::Requirement
|
131
|
-
none: false
|
132
118
|
requirements:
|
133
|
-
- -
|
119
|
+
- - ">="
|
134
120
|
- !ruby/object:Gem::Version
|
135
121
|
version: '0'
|
136
122
|
type: :development
|
137
123
|
prerelease: false
|
138
124
|
version_requirements: !ruby/object:Gem::Requirement
|
139
|
-
none: false
|
140
125
|
requirements:
|
141
|
-
- -
|
126
|
+
- - ">="
|
142
127
|
- !ruby/object:Gem::Version
|
143
128
|
version: '0'
|
144
129
|
- !ruby/object:Gem::Dependency
|
145
130
|
name: rake
|
146
131
|
requirement: !ruby/object:Gem::Requirement
|
147
|
-
none: false
|
148
132
|
requirements:
|
149
|
-
- -
|
133
|
+
- - ">="
|
150
134
|
- !ruby/object:Gem::Version
|
151
135
|
version: '0'
|
152
136
|
type: :development
|
153
137
|
prerelease: false
|
154
138
|
version_requirements: !ruby/object:Gem::Requirement
|
155
|
-
none: false
|
156
139
|
requirements:
|
157
|
-
- -
|
140
|
+
- - ">="
|
158
141
|
- !ruby/object:Gem::Version
|
159
142
|
version: '0'
|
160
143
|
description: Rails I18n de-facto standard library for ActiveRecord model/data translation.
|
@@ -163,75 +146,65 @@ executables: []
|
|
163
146
|
extensions: []
|
164
147
|
extra_rdoc_files: []
|
165
148
|
files:
|
149
|
+
- CHANGELOG.md
|
150
|
+
- CONTRIBUTING.md
|
151
|
+
- Gemfile
|
152
|
+
- Gemfile.lock
|
153
|
+
- LICENSE
|
154
|
+
- Rakefile
|
166
155
|
- lib/globalize.rb
|
167
|
-
- lib/patches/active_record/xml_attribute_serializer.rb
|
168
|
-
- lib/patches/active_record/uniqueness_validator.rb
|
169
|
-
- lib/patches/active_record/query_method.rb
|
170
156
|
- lib/globalize/active_record.rb
|
171
|
-
- lib/globalize/active_record/adapter.rb
|
172
|
-
- lib/globalize/active_record/query_methods.rb
|
173
|
-
- lib/globalize/active_record/migration.rb
|
174
157
|
- lib/globalize/active_record/act_macro.rb
|
175
|
-
- lib/globalize/active_record/
|
176
|
-
- lib/globalize/active_record/
|
158
|
+
- lib/globalize/active_record/adapter.rb
|
159
|
+
- lib/globalize/active_record/attributes.rb
|
177
160
|
- lib/globalize/active_record/class_methods.rb
|
178
161
|
- lib/globalize/active_record/exceptions.rb
|
179
|
-
- lib/globalize/active_record/
|
180
|
-
- lib/globalize/
|
162
|
+
- lib/globalize/active_record/instance_methods.rb
|
163
|
+
- lib/globalize/active_record/migration.rb
|
164
|
+
- lib/globalize/active_record/query_methods.rb
|
165
|
+
- lib/globalize/active_record/translation.rb
|
181
166
|
- lib/globalize/interpolation.rb
|
182
|
-
- lib/
|
167
|
+
- lib/globalize/version.rb
|
183
168
|
- lib/i18n/missing_translations_log_handler.rb
|
184
|
-
-
|
185
|
-
-
|
186
|
-
-
|
187
|
-
-
|
188
|
-
- Gemfile
|
189
|
-
- Gemfile.lock
|
169
|
+
- lib/i18n/missing_translations_raise_handler.rb
|
170
|
+
- lib/patches/active_record/query_method.rb
|
171
|
+
- lib/patches/active_record/uniqueness_validator.rb
|
172
|
+
- lib/patches/active_record/xml_attribute_serializer.rb
|
190
173
|
homepage: http://github.com/globalize/globalize
|
191
174
|
licenses:
|
192
175
|
- MIT
|
193
|
-
|
176
|
+
metadata: {}
|
177
|
+
post_install_message: |2+
|
194
178
|
|
195
179
|
Globalize has extracted versioning support to a separate gem named
|
196
|
-
|
197
180
|
globalize-versioning. If you are using versioning (with paper_trail
|
198
|
-
|
199
181
|
or any other versioning gem), please add the line
|
200
|
-
|
201
|
-
"gem ''globalize-versioning''" to your Gemfile and go to the github
|
202
|
-
|
182
|
+
"gem 'globalize-versioning'" to your Gemfile and go to the github
|
203
183
|
page at globalize/globalize-versioning if you encounter any problems.
|
204
184
|
|
205
|
-
|
206
185
|
Note that the globalize-versioning gem does not delegate versions to
|
207
|
-
|
208
186
|
the translation table, so you will have to update your syntax to
|
209
|
-
|
210
187
|
the form: `post.translation.versions`. See the globalize-versioning
|
211
|
-
|
212
188
|
readme for details.
|
213
189
|
|
214
|
-
|
215
|
-
'
|
216
190
|
rdoc_options: []
|
217
191
|
require_paths:
|
218
192
|
- lib
|
219
193
|
required_ruby_version: !ruby/object:Gem::Requirement
|
220
|
-
none: false
|
221
194
|
requirements:
|
222
|
-
- -
|
195
|
+
- - ">="
|
223
196
|
- !ruby/object:Gem::Version
|
224
197
|
version: '0'
|
225
198
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
226
|
-
none: false
|
227
199
|
requirements:
|
228
|
-
- -
|
200
|
+
- - ">="
|
229
201
|
- !ruby/object:Gem::Version
|
230
202
|
version: '0'
|
231
203
|
requirements: []
|
232
|
-
rubyforge_project:
|
233
|
-
rubygems_version:
|
204
|
+
rubyforge_project: "[none]"
|
205
|
+
rubygems_version: 2.2.2
|
234
206
|
signing_key:
|
235
|
-
specification_version:
|
207
|
+
specification_version: 4
|
236
208
|
summary: Rails I18n de-facto standard library for ActiveRecord model/data translation
|
237
209
|
test_files: []
|
210
|
+
has_rdoc:
|