rails_locale_detection 2.1.0 → 2.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4ef48a5c499b6e9a8da66926f5d9cca930e4d24
4
- data.tar.gz: 37bcb6e85096e563494c3d022c7485247365501c
3
+ metadata.gz: ea1092ade8043f0b2f88515a629a04345173d59c
4
+ data.tar.gz: 864516b1d69f76f2ebc46afaee91e05324f334e9
5
5
  SHA512:
6
- metadata.gz: d7f1a95d8eeb1aa084e5f672bd886e3fc32797b2d8caeb984a15dbfef60a09c4e2d401187742945fb4183406cee690ae2c5c78d4855de40dc86b423cc988d295
7
- data.tar.gz: c3374a4b12d24be47e3528152fd34fa2eda2b693d721ada42c683241074e8de8a3f63a472b4869101bd3db430d61de5e0b08aa6bf0a5fb2f79d1d16e99acc928
6
+ metadata.gz: 6b182282c9d7eac0afe67471a137364e3c1acde803f0755fcf0eb4f7ff72d4e19b220d8e01f8ec2bd768b0ff62028278369aea50e1980c9da5497f4686201699
7
+ data.tar.gz: fa878bfee4fae246b13efd5a8ff5f32bceea6cbb698b9cbc0d6d4cc7ab66872731a881836f12391be583f3bfc9ebd7672b200849463992d8cb16c4b9acbcf9c0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_locale_detection (2.0.0)
4
+ rails_locale_detection (2.2.0)
5
5
  http_accept_language (~> 2.0.5)
6
6
  rails (>= 3.2.0)
7
7
 
@@ -142,7 +142,7 @@ PLATFORMS
142
142
 
143
143
  DEPENDENCIES
144
144
  appraisal (~> 2.1.0)
145
- bundler (~> 1.12.5)
145
+ bundler (~> 1.14.6)
146
146
  gem-release (~> 0.5.3)
147
147
  i18n (~> 0.7.0)
148
148
  rails_locale_detection!
@@ -152,4 +152,4 @@ DEPENDENCIES
152
152
  timecop (~> 0.6.1)
153
153
 
154
154
  BUNDLED WITH
155
- 1.12.5
155
+ 1.14.6
data/README.md CHANGED
@@ -9,16 +9,6 @@ In turn, it checks the value of `params[:locale]`, `cookies[:locale]` and `HTTP_
9
9
  corresponds to the available locales, then stores the locale in a cookie for future requests. If a `user_locale` method
10
10
  is provided, any valid return value will be used, with preference over the other locale detection methods except for `params[:locale]`.
11
11
 
12
-
13
- ## Changes to version 2
14
-
15
- * Rails 4 compatibility
16
- * Namespace has been changed from Rails::LocaleDetection to RailsLocaleDetection,
17
- although the previous namespace is still supported for legacy config files
18
- * Locale detection has been moved to a seperate object, to avoid polluting controllers with extra methods.
19
- * Detection order has been changed to `param` first, as this make more sense in most contexts.
20
- * Shortcut locale accessors are now mixed into views as well
21
-
22
12
  ## Usage
23
13
 
24
14
  Include the gem in your Gemfile
@@ -60,9 +50,28 @@ The configuration options:
60
50
  * `false` or `:never` never sets the option
61
51
  * `:explicity` sets the option only when a param[:locale] is present
62
52
  * `detection_order` set the order in which locale detection occurs. Omit values to skip those sources
63
- * `automatically_detect` configures automatic inclusion of the detection callback.
53
+ * `automatically_detect` configures automatic inclusion of the detection callback.
64
54
  You can set this to false and include the callback yourself by calling `detect_locale` in your controller as required.
65
- * `locale_key` configures the key used for `param` and `cookie`
55
+ * `locale_key` configures the key used for `param` and `cookie`
56
+
57
+ ## Changelog
58
+
59
+ ### 2.2 (2017-04-22)
60
+
61
+ * Cookie is now set only when the locale differs from the previous value, to avoid Set-Cookie headers being sent with every request
62
+
63
+ ### 2.1 (2016-08-01)
64
+
65
+ * Rails 5 compatibility
66
+
67
+ ### 2.0 (2015-10-14)
68
+
69
+ * Rails 4 compatibility
70
+ * Namespace has been changed from Rails::LocaleDetection to RailsLocaleDetection,
71
+ although the previous namespace is still supported for legacy config files
72
+ * Locale detection has been moved to a seperate object, to avoid polluting controllers with extra methods.
73
+ * Detection order has been changed to `param` first, as this make more sense in most contexts.
74
+ * Shortcut locale accessors are now mixed into views as well
66
75
 
67
76
  ## Contributing to rails_locale_detection
68
77
 
@@ -76,6 +85,6 @@ The configuration options:
76
85
 
77
86
  ## Copyright
78
87
 
79
- Copyright (c) 2012 Mateo Murphy. See LICENSE.txt for
88
+ Copyright (c) 2012-present Mateo Murphy. See LICENSE.txt for
80
89
  further details.
81
90
 
@@ -29,12 +29,21 @@ module RailsLocaleDetection
29
29
  RailsLocaleDetection.detection_order.inject(nil) { |result, source| result || locale_from(source) } || default_locale
30
30
  end
31
31
 
32
- # set I18n.locale, default_url_options[:locale] and cookies[:locale] to the value returned by
33
- # detect_locale
32
+ # set I18n.locale, default_url_options[:locale] and cookies[:locale]
33
+ # to the value returned by detect_locale
34
34
  def set_locale
35
35
  self.current_locale = detect_locale
36
- default_url_options[locale_key] = current_locale if set_default_url_option_for_request?
37
- cookies[locale_key] = { :value => current_locale, :expires => RailsLocaleDetection.locale_expiry.from_now }
36
+
37
+ if set_default_url_option_for_request?
38
+ default_url_options[locale_key] = current_locale
39
+ end
40
+
41
+ if locale_from_cookie != current_locale
42
+ cookies[locale_key] = {
43
+ :value => current_locale,
44
+ :expires => RailsLocaleDetection.locale_expiry.from_now
45
+ }
46
+ end
38
47
  end
39
48
 
40
49
  # returns true if the default url option should be set for this request
@@ -1,3 +1,3 @@
1
1
  module RailsLocaleDetection
2
- VERSION = "2.1.0"
2
+ VERSION = "2.2.0"
3
3
  end
@@ -22,7 +22,7 @@ Gem::Specification.new do |gem|
22
22
  gem.add_dependency('rails', '>= 3.2.0')
23
23
 
24
24
  gem.add_development_dependency('appraisal', '~> 2.1.0')
25
- gem.add_development_dependency('bundler', '~> 1.12.5')
25
+ gem.add_development_dependency('bundler', '~> 1.14.6')
26
26
  gem.add_development_dependency('i18n', '~> 0.7.0')
27
27
  gem.add_development_dependency('gem-release', '~> 0.5.3')
28
28
  gem.add_development_dependency('rake', '~> 11.2.2')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_locale_detection
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mateo Murphy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-01 00:00:00.000000000 Z
11
+ date: 2017-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http_accept_language
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.12.5
61
+ version: 1.14.6
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.12.5
68
+ version: 1.14.6
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: i18n
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
209
  version: '0'
210
210
  requirements: []
211
211
  rubyforge_project:
212
- rubygems_version: 2.6.6
212
+ rubygems_version: 2.6.8
213
213
  signing_key:
214
214
  specification_version: 4
215
215
  summary: Locale setting for rails projects