i18n 1.14.6 → 1.14.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/i18n/tests/localization/procs.rb +2 -2
- data/lib/i18n/tests/procs.rb +11 -7
- data/lib/i18n/version.rb +1 -1
- metadata +4 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cca63854d9dd69dfe1d36eb0388926fc5e7a7cd297ece21e2fdc431ef9c4c286
|
4
|
+
data.tar.gz: 1ab0f78752eabfd6a03b7c1f4a6f4e45c03689e9fbc0936cd65d6cd1f4103363
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8dd4e1cf010b24d748b4e2713794296964301234b9dbed36c96ae591677fb9ca3d5df7f5aedd86a48a1f470ad81de07997f2103107af32786486892204222d4
|
7
|
+
data.tar.gz: 9e2008459e303dc8e87742231d2468faa3f2edcb61a30c3c26f5240cc5606a8132bccc70ec3e45a9cfcc38eaf04d84c74c6d643ef54f1df2534c66706677180d
|
@@ -34,7 +34,7 @@ module I18n
|
|
34
34
|
test "localize Date: given a format that resolves to a Proc it calls the Proc with the object and extra options" do
|
35
35
|
setup_time_proc_translations
|
36
36
|
date = ::Date.new(2008, 3, 1)
|
37
|
-
assert_equal
|
37
|
+
assert_equal %|[Sat, 01 Mar 2008, #{{:foo=>"foo"}}]|, I18n.l(date, :format => :proc, :foo => 'foo', :locale => :ru)
|
38
38
|
end
|
39
39
|
|
40
40
|
test "localize DateTime: given a format that resolves to a Proc it calls the Proc with the object" do
|
@@ -46,7 +46,7 @@ module I18n
|
|
46
46
|
test "localize DateTime: given a format that resolves to a Proc it calls the Proc with the object and extra options" do
|
47
47
|
setup_time_proc_translations
|
48
48
|
datetime = ::DateTime.new(2008, 3, 1, 6)
|
49
|
-
assert_equal
|
49
|
+
assert_equal %|[Sat, 01 Mar 2008 06:00:00 +00:00, #{{:foo=>"foo"}}]|, I18n.l(datetime, :format => :proc, :foo => 'foo', :locale => :ru)
|
50
50
|
end
|
51
51
|
|
52
52
|
test "localize Time: given a format that resolves to a Proc it calls the Proc with the object" do
|
data/lib/i18n/tests/procs.rb
CHANGED
@@ -5,34 +5,38 @@ module I18n
|
|
5
5
|
module Procs
|
6
6
|
test "lookup: given a translation is a proc it calls the proc with the key and interpolation values" do
|
7
7
|
I18n.backend.store_translations(:en, :a_lambda => lambda { |*args| I18n::Tests::Procs.filter_args(*args) })
|
8
|
-
assert_equal
|
8
|
+
assert_equal %|[:a_lambda, #{{:foo=>"foo"}}]|, I18n.t(:a_lambda, :foo => 'foo')
|
9
9
|
end
|
10
10
|
|
11
11
|
test "lookup: given a translation is a proc it passes the interpolation values as keyword arguments" do
|
12
12
|
I18n.backend.store_translations(:en, :a_lambda => lambda { |key, foo:, **| I18n::Tests::Procs.filter_args(key, foo: foo) })
|
13
|
-
assert_equal
|
13
|
+
assert_equal %|[:a_lambda, #{{:foo=>"foo"}}]|, I18n.t(:a_lambda, :foo => 'foo')
|
14
14
|
end
|
15
15
|
|
16
16
|
test "defaults: given a default is a Proc it calls it with the key and interpolation values" do
|
17
17
|
proc = lambda { |*args| I18n::Tests::Procs.filter_args(*args) }
|
18
|
-
assert_equal
|
18
|
+
assert_equal %|[nil, #{{:foo=>"foo"}}]|, I18n.t(nil, :default => proc, :foo => 'foo')
|
19
19
|
end
|
20
20
|
|
21
21
|
test "defaults: given a default is a key that resolves to a Proc it calls it with the key and interpolation values" do
|
22
22
|
the_lambda = lambda { |*args| I18n::Tests::Procs.filter_args(*args) }
|
23
23
|
I18n.backend.store_translations(:en, :a_lambda => the_lambda)
|
24
|
-
assert_equal
|
25
|
-
assert_equal
|
24
|
+
assert_equal %|[:a_lambda, #{{:foo=>"foo"}}]|, I18n.t(nil, :default => :a_lambda, :foo => 'foo')
|
25
|
+
assert_equal %|[:a_lambda, #{{:foo=>"foo"}}]|, I18n.t(nil, :default => [nil, :a_lambda], :foo => 'foo')
|
26
26
|
end
|
27
27
|
|
28
28
|
test "interpolation: given an interpolation value is a lambda it calls it with key and values before interpolating it" do
|
29
29
|
proc = lambda { |*args| I18n::Tests::Procs.filter_args(*args) }
|
30
|
-
|
30
|
+
if RUBY_VERSION < "3.4"
|
31
|
+
assert_match %r(\[\{:foo=>#<Proc.*>\}\]), I18n.t(nil, :default => '%{foo}', :foo => proc)
|
32
|
+
else
|
33
|
+
assert_match %r(\[\{foo: #<Proc.*>\}\]), I18n.t(nil, :default => '%{foo}', :foo => proc)
|
34
|
+
end
|
31
35
|
end
|
32
36
|
|
33
37
|
test "interpolation: given a key resolves to a Proc that returns a string then interpolation still works" do
|
34
38
|
proc = lambda { |*args| "%{foo}: " + I18n::Tests::Procs.filter_args(*args) }
|
35
|
-
assert_equal
|
39
|
+
assert_equal %|foo: [nil, #{{:foo=>"foo"}}]|, I18n.t(nil, :default => proc, :foo => 'foo')
|
36
40
|
end
|
37
41
|
|
38
42
|
test "pluralization: given a key resolves to a Proc that returns valid data then pluralization still works" do
|
data/lib/i18n/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.14.
|
4
|
+
version: 1.14.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sven Fuchs
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2025-01-19 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: concurrent-ruby
|
@@ -91,10 +91,7 @@ metadata:
|
|
91
91
|
changelog_uri: https://github.com/ruby-i18n/i18n/releases
|
92
92
|
documentation_uri: https://guides.rubyonrails.org/i18n.html
|
93
93
|
source_code_uri: https://github.com/ruby-i18n/i18n
|
94
|
-
post_install_message:
|
95
|
-
major release (April 2025), due to Ruby''s end of life for 3.1 and below (https://endoflife.date/ruby).
|
96
|
-
Please upgrade to Ruby 3.2 or newer by April 2025 to continue using future versions
|
97
|
-
of this gem.'
|
94
|
+
post_install_message:
|
98
95
|
rdoc_options: []
|
99
96
|
require_paths:
|
100
97
|
- lib
|
@@ -109,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
106
|
- !ruby/object:Gem::Version
|
110
107
|
version: 1.3.5
|
111
108
|
requirements: []
|
112
|
-
rubygems_version: 3.
|
109
|
+
rubygems_version: 3.5.23
|
113
110
|
signing_key:
|
114
111
|
specification_version: 4
|
115
112
|
summary: New wave Internationalization support for Ruby
|