rack-locale_chooser 1.7 → 1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,6 +14,7 @@ module Rack::LocaleChooser
14
14
 
15
15
  def call(env)
16
16
  @env = env
17
+
17
18
  @request = Rack::Request.new(@env)
18
19
 
19
20
  @original_url = @request.url
@@ -23,19 +24,19 @@ module Rack::LocaleChooser
23
24
  set_locale
24
25
 
25
26
  @logger.debug("Request URL: #{@original_url} | Localized URL: #{localized_url} | URL Locale: #{url_locale} | Cookie Locale: #{cookie_locale} | Geo Locale: #{geo_locale} | Browser Locale: #{browser_locale} | Definitive Locale: #{locale} | City: #{@env['rack.city']}") if @logger
26
-
27
+
27
28
  if @request.post? || @request.put? || @request.delete? then
28
- @app.call(env)
29
+ @app.call(@env)
29
30
  else
30
31
  if @original_url != localized_url then
31
32
  [301, {'Location' => localized_url}, '']
32
33
  else
33
- status, headers, body = @app.call(env)
34
+ status, headers, body = @app.call(@env)
34
35
  response = Rack::Response.new(body, status, headers)
35
36
  response.set_cookie('locale', {
36
- :value => I18n.locale,
37
- :path => '/',
38
- :domain => @env["rack.session.options"][:domain]})
37
+ :value => I18n.locale,
38
+ :path => '/',
39
+ :domain => @env["rack.session.options"][:domain]})
39
40
  response.finish
40
41
  end
41
42
  end
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module LocaleChooser
3
- VERSION = "1.7"
3
+ VERSION = "1.8"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-locale_chooser
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 7
9
- version: "1.7"
8
+ - 8
9
+ version: "1.8"
10
10
  platform: ruby
11
11
  authors:
12
12
  - "Jefferson Jean Martins Gir\xC3\xA3o"
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-24 00:00:00 -03:00
17
+ date: 2011-01-25 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency