locale 2.1.2 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 530d2db4f5bc7f68d06654f0a8ec730479e79860
4
- data.tar.gz: 72a52587e7410335944d6ac1ab1a769633598c58
2
+ SHA256:
3
+ metadata.gz: '0566995735dba653591ecc129791317aaccb9e04910bdf530a968eda9bc3d3b8'
4
+ data.tar.gz: 9352a3d86cb0d62bbb5d65aedeab76e20ec2a5ee9773ec51fec0409a04449fc1
5
5
  SHA512:
6
- metadata.gz: 1f3cf2b1775cd5245c7e72ac837e2ec81af7db1b89abeb6771d74393bddde9d28ca4c1d0f73d2a615a474325c726ba37edebcce9551ba84d08b1c97941b244c2
7
- data.tar.gz: c2c19cd4920438188f0f9cb7dff4cff07e1e87b8a15c3feb07bd49e9e3c7a4badfc6e950d5477f85e75a8a4134dc24a929782b4a2449d1f7b174dde471b8aef8
6
+ metadata.gz: 5de200054cccf923c4d542175d792dddb28a3ec59887e9a97c6aec55a59d588c1690527540a83affee5fe1843b01bd4bcef6bc02310b91da98b9c107c015cff0
7
+ data.tar.gz: 9e846daf080367701b615377af1d07ef1428b70bc779a664ea08ae8e061c8f26b13ac5229fdc1b95cd71966c7ae07c0d8db272a42d30da9481ca2a24bb2461dd
data/Gemfile CHANGED
@@ -17,6 +17,6 @@
17
17
  # You should have received a copy of the GNU Lesser General Public License
18
18
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
- source :rubygems
20
+ source 'https://rubygems.org'
21
21
 
22
22
  gemspec
data/README.rdoc CHANGED
@@ -28,8 +28,8 @@ other i18n/l10n libs/apps to handle major locale ID standards.
28
28
  * https://github.com/ruby-gettext/locale
29
29
 
30
30
  == Requirements
31
- * Ruby-1.8.7 or later <http://www.ruby-lang.org/ja/>
32
- * JRuby-1.1.4 or later <http://jruby.codehaus.org/>
31
+ * Ruby-1.8.7 or later <https://www.ruby-lang.org/>
32
+ * JRuby-1.1.4 or later <https://www.jruby.org/>
33
33
 
34
34
  == Install
35
35
 
data/Rakefile CHANGED
@@ -35,7 +35,6 @@ end
35
35
 
36
36
  helper = Bundler::GemHelper.new(base_dir)
37
37
  helper.install
38
- spec = helper.gemspec
39
38
 
40
39
  desc "Run tests"
41
40
  task :test do
data/doc/text/news.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # News
2
2
 
3
+ ## 2.1.4: 2024-03-18
4
+
5
+ ### Fixes
6
+
7
+ * `Locale::Middleware`: Fixed a bug that `lang` cookie and
8
+ `Accept-Language`/`Accept-Charset` HTTP headers never used.
9
+ * GH-15
10
+ * GH-16
11
+ * Patch by OZAWA Sakuro
12
+
13
+ ### Thanks
14
+
15
+ * OZAWA Sakuro
16
+
17
+ ## <a id="2-1-3">2.1.3</a>: 2020-02-12
18
+
19
+ ### Improvements
20
+
21
+ * Suppressed warnings.
22
+
3
23
  ## <a id="2-1-2">2.1.2</a>: 2015-09-15
4
24
 
5
25
  ### Improvements
@@ -95,8 +95,8 @@ module Locale
95
95
  def set_request(query_langs, cookie_langs, accept_language, accept_charset)
96
96
  Locale.clear
97
97
  Thread.current[:current_request] = {
98
- :query_langs => query_langs,
99
- :cookie_langs => cookie_langs,
98
+ :query_langs => query_langs.compact,
99
+ :cookie_langs => cookie_langs.compact,
100
100
  :accept_language => accept_language,
101
101
  :accept_charset => accept_charset
102
102
  }
@@ -2,6 +2,7 @@
2
2
  locale/tag/cldr.rb - Locale::Tag::CLDR
3
3
 
4
4
  Copyright (C) 2008,2009 Masao Mutoh
5
+ Copyright (C) 2018 Kouhei Sutou <kou@clear-code.com>
5
6
 
6
7
  You may redistribute it and/or modify it under the same
7
8
  license terms as Ruby.
@@ -28,9 +29,10 @@ module Locale
28
29
  class << self
29
30
  # Parse the language tag and return the new Locale::Tag::CLDR.
30
31
  def parse(tag)
31
- if tag =~ /\APOSIX\Z/ # This is the special case of POSIX locale but match this regexp.
32
+ case tag
33
+ when /\APOSIX\Z/ # This is the special case of POSIX locale but match this regexp.
32
34
  nil
33
- elsif tag =~ TAG_RE
35
+ when TAG_RE
34
36
  lang, script, region, subtag = $1, $2, $3, $4
35
37
 
36
38
  extensions = {}
@@ -2,6 +2,7 @@
2
2
  locale/tag/common.rb - Locale::Tag::Common
3
3
 
4
4
  Copyright (C) 2008,2009 Masao Mutoh
5
+ Copyright (C) 2018 Kouhei Sutou <kou@clear-code.com>
5
6
 
6
7
  You may redistribute it and/or modify it under the same
7
8
  license terms as Ruby.
@@ -35,9 +36,10 @@ module Locale
35
36
  class << self
36
37
  # Parse the language tag and return the new Locale::Tag::Common.
37
38
  def parse(tag)
38
- if tag =~ /\APOSIX\Z/ # This is the special case of POSIX locale but match this regexp.
39
+ case tag
40
+ when /\APOSIX\Z/ # This is the special case of POSIX locale but match this regexp.
39
41
  nil
40
- elsif tag =~ TAG_RE
42
+ when TAG_RE
41
43
  lang, script, region, subtag = $1, $2, $3, $4
42
44
  variants = subtag.scan(/(^|[-_])#{VARIANT}(?=([-_]|$))/i).collect{|v| v[1]}
43
45
 
@@ -2,6 +2,7 @@
2
2
  locale/tag/posix.rb - Locale::Tag::Posix
3
3
 
4
4
  Copyright (C) 2008 Masao Mutoh
5
+ Copyright (C) 2018 Kouhei Sutou <kou@clear-code.com>
5
6
 
6
7
  You may redistribute it and/or modify it under the same
7
8
  license terms as Ruby.
@@ -30,11 +31,12 @@ module Locale
30
31
  end
31
32
 
32
33
  def self.parse(tag)
33
- if tag =~ /^(C|POSIX)$/
34
+ case tag
35
+ when /^(C|POSIX)$/
34
36
  ret = self.new("en", "US")
35
37
  ret.tag = tag
36
38
  ret
37
- elsif tag =~ TAG_RE
39
+ when TAG_RE
38
40
  ret = self.new($1, $2, $3, $4)
39
41
  ret.tag = tag
40
42
  ret
@@ -2,6 +2,7 @@
2
2
  locale/tag/rfc.rb - Locale::Tag::Rfc
3
3
 
4
4
  Copyright (C) 2008,2009 Masao Mutoh
5
+ Copyright (C) 2018 Kouhei Sutou <kou@clear-code.com>
5
6
 
6
7
  You may redistribute it and/or modify it under the same
7
8
  license terms as Ruby.
@@ -29,9 +30,10 @@ module Locale
29
30
  class << self
30
31
  # Parse the language tag and return the new Locale::Tag::Rfc.
31
32
  def parse(tag)
32
- if tag =~ /\APOSIX\Z/ # This is the special case of POSIX locale but match this regexp.
33
+ case tag
34
+ when /\APOSIX\Z/ # This is the special case of POSIX locale but match this regexp.
33
35
  nil
34
- elsif tag =~ TAG_RE
36
+ when TAG_RE
35
37
  lang, script, region, subtag = $1, $2, $3, $4
36
38
  extensions = []
37
39
  variants = []
@@ -2,6 +2,7 @@
2
2
  locale/tag/simple.rb - Locale::Tag::Simple
3
3
 
4
4
  Copyright (C) 2008,2009 Masao Mutoh
5
+ Copyright (C) 2018 Kouhei Sutou <kou@clear-code.com>
5
6
 
6
7
  You may redistribute it and/or modify it under the same
7
8
  license terms as Ruby.
@@ -52,7 +53,8 @@ module Locale
52
53
  class << self
53
54
  # Parse the language tag and return the new Locale::Tag::Simple.
54
55
  def parse(tag)
55
- if tag =~ TAG_RE
56
+ case tag
57
+ when TAG_RE
56
58
  ret = self.new($1, $2)
57
59
  ret.tag = tag
58
60
  ret
@@ -2,12 +2,12 @@
2
2
  version - version information of Ruby-Locale
3
3
 
4
4
  Copyright (C) 2008 Masao Mutoh
5
- Copyright (C) 2013-2015 Kouhei Sutou <kou@clear-code.com>
5
+ Copyright (C) 2013-2020 Sutou Kouhei <kou@clear-code.com>
6
6
 
7
7
  You may redistribute it and/or modify it under the same
8
8
  license terms as Ruby.
9
9
  =end
10
10
  module Locale
11
- VERSION = "2.1.2"
11
+ VERSION = "2.1.4"
12
12
  end
13
13
 
data/locale.gemspec CHANGED
@@ -44,11 +44,10 @@ Ruby-Locale is the pure ruby library which provides basic APIs for localization.
44
44
  s.test_files = Dir.glob("test/test_*.rb")
45
45
  end
46
46
 
47
- s.add_development_dependency("rake")
48
47
  s.add_development_dependency("bundler")
49
- s.add_development_dependency("yard")
50
- s.add_development_dependency("redcarpet")
48
+ s.add_development_dependency("kramdown")
49
+ s.add_development_dependency("rake")
51
50
  s.add_development_dependency("test-unit")
52
- s.add_development_dependency("test-unit-notify")
53
51
  s.add_development_dependency("test-unit-rr")
52
+ s.add_development_dependency("yard")
54
53
  end
@@ -27,6 +27,12 @@ class TestDetectGeneral < Test::Unit::TestCase
27
27
  def setup
28
28
  Locale.init
29
29
  Locale.clear_all
30
+ @have_win32_driver =
31
+ (Locale::Driver.const_defined?(:Win32) and
32
+ Locale::Driver::Win32.respond_to?(:set_thread_locale_id))
33
+ if @have_win32_driver
34
+ Locale::Driver::Win32.set_thread_locale_id(0xffff) # invalid
35
+ end
30
36
  ENV["LC_ALL"] = nil
31
37
  ENV["LC_CTYPE"] = nil
32
38
  ENV["LC_MESSAGES"] = nil
@@ -34,6 +40,12 @@ class TestDetectGeneral < Test::Unit::TestCase
34
40
  ENV["LANGUAGE"] = nil
35
41
  end
36
42
 
43
+ def teardown
44
+ if @have_win32_driver
45
+ Locale::Driver::Win32.set_thread_locale_id(nil)
46
+ end
47
+ end
48
+
37
49
  def test_lc_all
38
50
  ENV["LC_ALL"] = "ja_JP.eucJP"
39
51
  ENV["LC_CTYPE"] = "fr_FR.ISO-8859-1" #Ignored.
@@ -165,6 +177,8 @@ class TestDetectGeneral < Test::Unit::TestCase
165
177
  end
166
178
 
167
179
  test "LC_ALL=C" do
180
+ omit("Can't disable the JRuby's default") if jruby?
181
+
168
182
  ENV["LC_ALL"] = "C"
169
183
  ENV["LANGUAGE"] = "zh_CN.UTF-8:ja_JP" # ignored
170
184
 
@@ -173,6 +187,8 @@ class TestDetectGeneral < Test::Unit::TestCase
173
187
  end
174
188
 
175
189
  test "LC_MESSAGES=C" do
190
+ omit("Can't disable the JRuby's default") if jruby?
191
+
176
192
  ENV["LC_MESSAGES"] = "C"
177
193
  ENV["LANGUAGE"] = "zh_CN.UTF-8:ja_JP" # ignored
178
194
 
@@ -181,6 +197,8 @@ class TestDetectGeneral < Test::Unit::TestCase
181
197
  end
182
198
 
183
199
  test "LANG=C" do
200
+ omit("Can't disable the JRuby's default") if jruby?
201
+
184
202
  ENV["LANG"] = "C"
185
203
  ENV["LANGUAGE"] = "zh_CN.UTF-8:ja_JP" # ignored
186
204
 
@@ -213,6 +231,8 @@ class TestDetectGeneral < Test::Unit::TestCase
213
231
  end
214
232
 
215
233
  test "LC_ALL=C and LC_MESSAGES" do
234
+ omit("Can't disable the JRuby's default") if jruby?
235
+
216
236
  ENV["LC_ALL"] = "C"
217
237
  ENV["LC_MESSAGES"] = "ja_JP.Shift_JIS"
218
238
  ENV["LANGUAGE"] = "zh_CN.UTF-8:ja_JP" # ignored
@@ -222,6 +242,8 @@ class TestDetectGeneral < Test::Unit::TestCase
222
242
  end
223
243
 
224
244
  test "LC_ALL=C and LANG" do
245
+ omit("Can't disable the JRuby's default") if jruby?
246
+
225
247
  ENV["LC_ALL"] = "C"
226
248
  ENV["LANG"] = "ja_JP.Shift_JIS"
227
249
  ENV["LANGUAGE"] = "zh_CN.UTF-8:ja_JP" # ignored
@@ -231,6 +253,8 @@ class TestDetectGeneral < Test::Unit::TestCase
231
253
  end
232
254
 
233
255
  test "LC_MESSAGES=C and LANG" do
256
+ omit("Can't disable the JRuby's default") if jruby?
257
+
234
258
  ENV["LC_MESSAGES"] = "C"
235
259
  ENV["LANG"] = "ja_JP.Shift_JIS"
236
260
  ENV["LANGUAGE"] = "zh_CN.UTF-8:ja_JP" # ignored
@@ -25,10 +25,14 @@ begin
25
25
  class TestDiverJRuby < Test::Unit::TestCase
26
26
 
27
27
  def setup
28
+ Locale.init
29
+ Locale.clear_all
28
30
  ENV["LC_ALL"] = nil
29
31
  ENV["LC_CTYPE"] = nil
32
+ ENV["LC_MESSAGES"] = nil
30
33
  ENV["LANG"] = nil
31
34
  ENV["LANGUAGE"] = nil
35
+ set_locale(Locale::Tag::Common.parse("en-US"))
32
36
  end
33
37
 
34
38
  def set_locale(tag)
@@ -56,7 +60,7 @@ begin
56
60
  assert_equal Locale::Tag::Posix.parse("ja_JP"), Locale::Driver::JRuby.locales[0]
57
61
 
58
62
  ENV["LC_ALL"] = "C"
59
- assert_equal Locale::Tag::Posix.parse("C"), Locale::Driver::JRuby.locales[0]
63
+ assert_equal Locale::Tag::Common.parse("en-US"), Locale::Driver::JRuby.locales[0]
60
64
  end
61
65
  end
62
66
 
@@ -5,8 +5,11 @@ begin
5
5
  class TestDiverWin32 < Test::Unit::TestCase
6
6
 
7
7
  def setup
8
+ Locale.init
9
+ Locale.clear_all
8
10
  ENV["LC_ALL"] = nil
9
11
  ENV["LC_CTYPE"] = nil
12
+ ENV["LC_MESSAGES"] = nil
10
13
  ENV["LANG"] = nil
11
14
  ENV["LANGUAGE"] = nil
12
15
  Locale::Driver::Win32.set_thread_locale_id(nil)
@@ -56,7 +59,8 @@ begin
56
59
  assert_equal "CP932", Locale::Driver::Win32.charset
57
60
 
58
61
  ENV["LC_ALL"] = "C"
59
- assert_equal Locale::Tag::Posix.parse("C"), Locale::Driver::Win32.locales[0]
62
+ Locale::Driver::Win32.set_thread_locale_id(0x0409)
63
+ assert_equal Locale::Tag::Common.parse("en_US"), Locale::Driver::Win32.locales[0]
60
64
  assert_equal "CP1252", Locale::Driver::Win32.charset
61
65
  end
62
66
  end
metadata CHANGED
@@ -1,30 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locale
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  - Masao Mutoh
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-09-15 00:00:00.000000000 Z
11
+ date: 2024-03-18 00:00:00.000000000 Z
13
12
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rake
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: '0'
21
- type: :development
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: '0'
28
13
  - !ruby/object:Gem::Dependency
29
14
  name: bundler
30
15
  requirement: !ruby/object:Gem::Requirement
@@ -40,7 +25,7 @@ dependencies:
40
25
  - !ruby/object:Gem::Version
41
26
  version: '0'
42
27
  - !ruby/object:Gem::Dependency
43
- name: yard
28
+ name: kramdown
44
29
  requirement: !ruby/object:Gem::Requirement
45
30
  requirements:
46
31
  - - ">="
@@ -54,7 +39,7 @@ dependencies:
54
39
  - !ruby/object:Gem::Version
55
40
  version: '0'
56
41
  - !ruby/object:Gem::Dependency
57
- name: redcarpet
42
+ name: rake
58
43
  requirement: !ruby/object:Gem::Requirement
59
44
  requirements:
60
45
  - - ">="
@@ -82,7 +67,7 @@ dependencies:
82
67
  - !ruby/object:Gem::Version
83
68
  version: '0'
84
69
  - !ruby/object:Gem::Dependency
85
- name: test-unit-notify
70
+ name: test-unit-rr
86
71
  requirement: !ruby/object:Gem::Requirement
87
72
  requirements:
88
73
  - - ">="
@@ -96,7 +81,7 @@ dependencies:
96
81
  - !ruby/object:Gem::Version
97
82
  version: '0'
98
83
  - !ruby/object:Gem::Dependency
99
- name: test-unit-rr
84
+ name: yard
100
85
  requirement: !ruby/object:Gem::Requirement
101
86
  requirements:
102
87
  - - ">="
@@ -109,8 +94,9 @@ dependencies:
109
94
  - - ">="
110
95
  - !ruby/object:Gem::Version
111
96
  version: '0'
112
- description: |
113
- Ruby-Locale is the pure ruby library which provides basic APIs for localization.
97
+ description: 'Ruby-Locale is the pure ruby library which provides basic APIs for localization.
98
+
99
+ '
114
100
  email:
115
101
  - kou@clear-code.com
116
102
  - mutomasa at gmail.com
@@ -174,7 +160,6 @@ licenses:
174
160
  - Ruby
175
161
  - LGPLv3+
176
162
  metadata: {}
177
- post_install_message:
178
163
  rdoc_options: []
179
164
  require_paths:
180
165
  - lib
@@ -189,19 +174,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
174
  - !ruby/object:Gem::Version
190
175
  version: '0'
191
176
  requirements: []
192
- rubyforge_project:
193
- rubygems_version: 2.2.2
194
- signing_key:
177
+ rubygems_version: 3.6.0.dev
195
178
  specification_version: 4
196
179
  summary: Ruby-Locale is the pure ruby library which provides basic APIs for localization.
197
180
  test_files:
198
- - test/test_tag.rb
199
181
  - test/test_detect_cgi.rb
200
- - test/test_info.rb
201
- - test/test_thread.rb
182
+ - test/test_detect_general.rb
202
183
  - test/test_driver_jruby.rb
203
- - test/test_taglist.rb
204
184
  - test/test_driver_win32.rb
205
- - test/test_detect_general.rb
185
+ - test/test_info.rb
206
186
  - test/test_locale.rb
207
- has_rdoc:
187
+ - test/test_tag.rb
188
+ - test/test_taglist.rb
189
+ - test/test_thread.rb