i18n 1.14.6 → 1.14.8

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
  SHA256:
3
- metadata.gz: abb47988c5f7107e7752235391d3841b093b22129643b5800fe208fd885c238a
4
- data.tar.gz: 95343bb49011a881932676ca8e561a28e0779b1972893d9ece8c012886ac862c
3
+ metadata.gz: edf1a48f0dd110066260f4d93cd2af16e73e9f91845a16126794d4c9af5b664c
4
+ data.tar.gz: 36a488fcbbaefdabb42e1a6f42af534fa36f640de5674d31a92407d6dfd1835d
5
5
  SHA512:
6
- metadata.gz: bdeb6008dae46d97da006f84446c0be3a81ffe8fe275ea4a6866673e663b13664fc225c3dcc7314c0db4aa4ef269a8fbcb6b58b5a359452de90625e1a826ff6d
7
- data.tar.gz: ca01e033ca49fb385a3e05b3ff72bbfd5a5f256e22379f564367e72eabe125beb0c418654fb423523077a0a9aece57ad9e94d72ee646e5a6483e3e7e14525cc3
6
+ metadata.gz: 82897d5266dfb62379930d6f94346dc0e62c14e619995e3933dc6339d0dd6d06d4b491449d1f4eb43128de995e3d9837624e4132b7b506455e0169dece108b7f
7
+ data.tar.gz: 8938b0f8d862e989f7427ccb2299722914bd485af9afff24bf0bda6cd8f438dc750cacd8c85d45292787f2e78438ead7c7533d6c696f5d5b9fc7109535a48ee4
@@ -25,6 +25,7 @@ module I18n
25
25
 
26
26
  def compile_if_an_interpolation(string)
27
27
  if interpolated_str?(string)
28
+ string = +string
28
29
  string.instance_eval <<-RUBY_EVAL, __FILE__, __LINE__
29
30
  def i18n_interpolate(v = {})
30
31
  "#{compiled_interpolation_body(string)}"
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'cgi'
4
-
5
3
  module I18n
6
4
  class ExceptionHandler
7
5
  def call(exception, _locale, _key, _options)
@@ -10,7 +10,7 @@ module I18n
10
10
  def call(env)
11
11
  @app.call(env)
12
12
  ensure
13
- Thread.current[:i18n_config] = I18n::Config.new
13
+ Thread.current.thread_variable_set(:i18n_config, I18n::Config.new)
14
14
  end
15
15
 
16
16
  end
@@ -89,14 +89,14 @@ module I18n
89
89
  end
90
90
 
91
91
  test "interpolation: ASCII strings in the backend should be encoded to UTF8 if interpolation options are in UTF8" do
92
- I18n.backend.store_translations 'en', 'encoding' => ('%{who} let me go'.force_encoding("ASCII"))
92
+ I18n.backend.store_translations 'en', 'encoding' => ('%{who} let me go'.dup.force_encoding(Encoding::US_ASCII))
93
93
  result = I18n.t 'encoding', :who => "måmmå miå"
94
94
  assert_equal Encoding::UTF_8, result.encoding
95
95
  end
96
96
 
97
97
  test "interpolation: UTF8 strings in the backend are still returned as UTF8 with ASCII interpolation" do
98
98
  I18n.backend.store_translations 'en', 'encoding' => 'måmmå miå %{what}'
99
- result = I18n.t 'encoding', :what => 'let me go'.force_encoding("ASCII")
99
+ result = I18n.t 'encoding', :what => 'let me go'.dup.force_encoding(Encoding::US_ASCII)
100
100
  assert_equal Encoding::UTF_8, result.encoding
101
101
  end
102
102
 
@@ -172,7 +172,7 @@ module I18n
172
172
  end
173
173
 
174
174
  def euc_jp(string)
175
- string.encode!(Encoding::EUC_JP)
175
+ string.encode(Encoding::EUC_JP)
176
176
  end
177
177
 
178
178
  def interpolate(*args)
@@ -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 '[Sat, 01 Mar 2008, {:foo=>"foo"}]', I18n.l(date, :format => :proc, :foo => 'foo', :locale => :ru)
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 '[Sat, 01 Mar 2008 06:00:00 +00:00, {:foo=>"foo"}]', I18n.l(datetime, :format => :proc, :foo => 'foo', :locale => :ru)
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
@@ -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 '[:a_lambda, {:foo=>"foo"}]', I18n.t(:a_lambda, :foo => 'foo')
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 '[:a_lambda, {:foo=>"foo"}]', I18n.t(:a_lambda, :foo => 'foo')
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 '[nil, {:foo=>"foo"}]', I18n.t(nil, :default => proc, :foo => 'foo')
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 '[: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')
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
- assert_match %r(\[\{:foo=>#<Proc.*>\}\]), I18n.t(nil, :default => '%{foo}', :foo => proc)
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 'foo: [nil, {:foo=>"foo"}]', I18n.t(nil, :default => proc, :foo => 'foo')
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module I18n
4
- VERSION = "1.14.6"
4
+ VERSION = "1.14.8"
5
5
  end
data/lib/i18n.rb CHANGED
@@ -55,12 +55,13 @@ module I18n
55
55
  module Base
56
56
  # Gets I18n configuration object.
57
57
  def config
58
- Thread.current[:i18n_config] ||= I18n::Config.new
58
+ Thread.current.thread_variable_get(:i18n_config) ||
59
+ Thread.current.thread_variable_set(:i18n_config, I18n::Config.new)
59
60
  end
60
61
 
61
62
  # Sets I18n configuration object.
62
63
  def config=(value)
63
- Thread.current[:i18n_config] = value
64
+ Thread.current.thread_variable_set(:i18n_config, value)
64
65
  end
65
66
 
66
67
  # Write methods which delegates to the configuration object
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.6
4
+ version: 1.14.8
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: 2024-09-15 00:00:00.000000000 Z
16
+ date: 2025-12-21 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: 'PSA: I18n will be dropping support for Ruby < 3.2 in the next
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.3.27
109
+ rubygems_version: 3.5.23
113
110
  signing_key:
114
111
  specification_version: 4
115
112
  summary: New wave Internationalization support for Ruby