lalala 4.0.0.dev.134 → 4.0.0.dev.135
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.
- checksums.yaml +4 -4
- data/app/models/lalala/page.rb +18 -10
- data/lib/lalala/ext_i18n/negotiation_adapter.rb +4 -0
- data/lib/lalala/ext_rack/i18n_negotiator.rb +10 -2
- data/lib/lalala/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 243cacf07c63af7e7b293d9ac4d341903e4e635a
|
4
|
+
data.tar.gz: 127e4de1d99878c5400a7117c6f9973ba39f40bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f1363d1cefdeb22512b2c470cba48175aeee45f24f31be73f4daa844fcb42528a9049919159e6cf280f7cdcf198b05ac914692da4fead81047a5c0e7b910ae0
|
7
|
+
data.tar.gz: 53678295db3e381c351b1e0b84bb44ac5eec4b96a60ff9a39c4fa409a5be65bc9ad0ebf9138f0926b1b343a67fbd4fb4000e778025b6896246b047ba1dad02c9
|
data/app/models/lalala/page.rb
CHANGED
@@ -249,6 +249,7 @@ private
|
|
249
249
|
# update translated attributes
|
250
250
|
begin
|
251
251
|
_locale = I18n.locale
|
252
|
+
|
252
253
|
I18n.available_locales.each do |locale|
|
253
254
|
I18n.locale = locale
|
254
255
|
|
@@ -277,17 +278,24 @@ private
|
|
277
278
|
end
|
278
279
|
|
279
280
|
def set_path_component
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
281
|
+
_locale = I18n.locale
|
282
|
+
I18n.available_locales.each do |locale|
|
283
|
+
|
284
|
+
r = self.route
|
285
|
+
case r
|
286
|
+
when NilClass
|
287
|
+
self.path_component = self.class.default_route.call(self)
|
288
|
+
when Proc
|
289
|
+
self.path_component = r.call(self)
|
290
|
+
when String
|
291
|
+
self.path_component = r
|
292
|
+
else
|
293
|
+
raise "Unexpected path_component value: #{r.inspect}"
|
294
|
+
end
|
295
|
+
|
290
296
|
end
|
297
|
+
ensure
|
298
|
+
I18n.locale = _locale
|
291
299
|
end
|
292
300
|
|
293
301
|
end
|
@@ -19,7 +19,11 @@ protected
|
|
19
19
|
_locale = I18n.locale
|
20
20
|
|
21
21
|
if @adapter.ignored?(env)
|
22
|
-
|
22
|
+
I18n.locale = locale_for_ignored.to_sym
|
23
|
+
@env['rack.locale'] = I18n.locale
|
24
|
+
status, headers, body = @app.call(env)
|
25
|
+
headers['Content-Language'] = I18n.locale.to_s
|
26
|
+
return [status, headers, body]
|
23
27
|
end
|
24
28
|
|
25
29
|
return determine_routing_path
|
@@ -72,7 +76,7 @@ private
|
|
72
76
|
case action
|
73
77
|
|
74
78
|
when :call
|
75
|
-
I18n.locale = new_env['rack.locale']
|
79
|
+
I18n.locale = new_env['rack.locale'].to_sym
|
76
80
|
|
77
81
|
status, headers, body = @app.call(new_env)
|
78
82
|
headers['Content-Language'] = I18n.locale.to_s
|
@@ -194,6 +198,10 @@ private
|
|
194
198
|
@_locales_for_hostname_set ||= locales_for_hostname.map(&:to_s)
|
195
199
|
end
|
196
200
|
|
201
|
+
def locale_for_ignored
|
202
|
+
@_locale_for_ignored ||= @adapter.locale_for_ignored
|
203
|
+
end
|
204
|
+
|
197
205
|
def hostname
|
198
206
|
@_hostname ||= @env['HTTP_HOST'].split(':').first
|
199
207
|
end
|
data/lib/lalala/version.rb
CHANGED