rack-locale_chooser 0.0.11 → 0.0.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-locale_chooser (0.0.10)
4
+ rack-locale_chooser (0.0.11)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -21,7 +21,7 @@ module Rack::LocaleChooser
21
21
 
22
22
  set_locale
23
23
 
24
- @logger.debug("Request URL: #{@request.url} | URL Locale: #{url_locale} | Cookie Locale: #{cookie_locale} | Geo Locale: #{geo_locale} | Browser Locale: #{browser_locale} | Definitive Locale: #{locale}") if @logger
24
+ @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}") if @logger
25
25
 
26
26
  @app.call(env) if @request.post? || @request.put? || @request.delete?
27
27
 
@@ -89,7 +89,7 @@ module Rack::LocaleChooser
89
89
  end
90
90
 
91
91
  def localized_url
92
- current_host = @request.url.gsub(/http\:\/\/(\D*)[\/]|http\:\/\/(\D*)/).first().gsub(/:$|\/$/, '')
92
+ current_host = @request.host.gsub(/http:\/\//, '')
93
93
  return @request.url.gsub(current_host, @options[:host_mappings][locale.to_sym]) if @options[:host_mappings][locale.to_sym]
94
94
  @original_url
95
95
  end
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module LocaleChooser
3
- VERSION = "0.0.11"
3
+ VERSION = "0.0.12"
4
4
  end
5
5
  end
@@ -3,8 +3,8 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
  describe Rack::LocaleChooser do
4
4
  def app
5
5
  app = Rack::Builder.new {
6
- use Rack::LocaleChooser::Chooser, :host_mappings => { :en => 'http://us.example.com',
7
- :es => 'http://es.example.com' },
6
+ use Rack::LocaleChooser::Chooser, :host_mappings => { :en => 'us.example.com',
7
+ :es => 'es.example.com' },
8
8
  :country_mappings => { 'VE' => :es }
9
9
  run BasicRackApp.new
10
10
  }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-locale_chooser
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 11
10
- version: 0.0.11
9
+ - 12
10
+ version: 0.0.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Jefferson Jean Martins Gir\xC3\xA3o"