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 +5 -5
- data/Gemfile +1 -1
- data/README.rdoc +2 -2
- data/Rakefile +0 -1
- data/doc/text/news.md +20 -0
- data/lib/locale/driver/cgi.rb +2 -2
- data/lib/locale/tag/cldr.rb +4 -2
- data/lib/locale/tag/common.rb +4 -2
- data/lib/locale/tag/posix.rb +4 -2
- data/lib/locale/tag/rfc.rb +4 -2
- data/lib/locale/tag/simple.rb +3 -1
- data/lib/locale/version.rb +2 -2
- data/locale.gemspec +3 -4
- data/test/test_detect_general.rb +24 -0
- data/test/test_driver_jruby.rb +5 -1
- data/test/test_driver_win32.rb +5 -1
- metadata +15 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '0566995735dba653591ecc129791317aaccb9e04910bdf530a968eda9bc3d3b8'
|
4
|
+
data.tar.gz: 9352a3d86cb0d62bbb5d65aedeab76e20ec2a5ee9773ec51fec0409a04449fc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5de200054cccf923c4d542175d792dddb28a3ec59887e9a97c6aec55a59d588c1690527540a83affee5fe1843b01bd4bcef6bc02310b91da98b9c107c015cff0
|
7
|
+
data.tar.gz: 9e846daf080367701b615377af1d07ef1428b70bc779a664ea08ae8e061c8f26b13ac5229fdc1b95cd71966c7ae07c0d8db272a42d30da9481ca2a24bb2461dd
|
data/Gemfile
CHANGED
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 <
|
32
|
-
* JRuby-1.1.4 or later <
|
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
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
|
data/lib/locale/driver/cgi.rb
CHANGED
@@ -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
|
}
|
data/lib/locale/tag/cldr.rb
CHANGED
@@ -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
|
-
|
32
|
+
case tag
|
33
|
+
when /\APOSIX\Z/ # This is the special case of POSIX locale but match this regexp.
|
32
34
|
nil
|
33
|
-
|
35
|
+
when TAG_RE
|
34
36
|
lang, script, region, subtag = $1, $2, $3, $4
|
35
37
|
|
36
38
|
extensions = {}
|
data/lib/locale/tag/common.rb
CHANGED
@@ -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
|
-
|
39
|
+
case tag
|
40
|
+
when /\APOSIX\Z/ # This is the special case of POSIX locale but match this regexp.
|
39
41
|
nil
|
40
|
-
|
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
|
|
data/lib/locale/tag/posix.rb
CHANGED
@@ -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
|
-
|
34
|
+
case tag
|
35
|
+
when /^(C|POSIX)$/
|
34
36
|
ret = self.new("en", "US")
|
35
37
|
ret.tag = tag
|
36
38
|
ret
|
37
|
-
|
39
|
+
when TAG_RE
|
38
40
|
ret = self.new($1, $2, $3, $4)
|
39
41
|
ret.tag = tag
|
40
42
|
ret
|
data/lib/locale/tag/rfc.rb
CHANGED
@@ -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
|
-
|
33
|
+
case tag
|
34
|
+
when /\APOSIX\Z/ # This is the special case of POSIX locale but match this regexp.
|
33
35
|
nil
|
34
|
-
|
36
|
+
when TAG_RE
|
35
37
|
lang, script, region, subtag = $1, $2, $3, $4
|
36
38
|
extensions = []
|
37
39
|
variants = []
|
data/lib/locale/tag/simple.rb
CHANGED
@@ -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
|
-
|
56
|
+
case tag
|
57
|
+
when TAG_RE
|
56
58
|
ret = self.new($1, $2)
|
57
59
|
ret.tag = tag
|
58
60
|
ret
|
data/lib/locale/version.rb
CHANGED
@@ -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-
|
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.
|
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("
|
50
|
-
s.add_development_dependency("
|
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
|
data/test/test_detect_general.rb
CHANGED
@@ -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
|
data/test/test_driver_jruby.rb
CHANGED
@@ -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::
|
63
|
+
assert_equal Locale::Tag::Common.parse("en-US"), Locale::Driver::JRuby.locales[0]
|
60
64
|
end
|
61
65
|
end
|
62
66
|
|
data/test/test_driver_win32.rb
CHANGED
@@ -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
|
-
|
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.
|
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:
|
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:
|
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:
|
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-
|
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:
|
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
|
-
|
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
|
-
|
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/
|
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/
|
185
|
+
- test/test_info.rb
|
206
186
|
- test/test_locale.rb
|
207
|
-
|
187
|
+
- test/test_tag.rb
|
188
|
+
- test/test_taglist.rb
|
189
|
+
- test/test_thread.rb
|