i18n 1.8.7 → 1.8.9

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
2
  SHA256:
3
- metadata.gz: ecfb802a53a50fa0b480295092adbe3064584ef69f06b81851b95bd15f49bca2
4
- data.tar.gz: 84e6ce2a82b2ce6f52ba8358b5c409c7fe48ff790ca7f3680d922557b06c7f56
3
+ metadata.gz: fd6aad7b79f41eae2970ab9570b3e141b479fcf748273925515c67d31efc1ef9
4
+ data.tar.gz: 1ddd5c7df6a618e95514139007a6dca81237cf71226b81b2a1b6890746542e29
5
5
  SHA512:
6
- metadata.gz: c8cf31834170e4aea3f2b25cfad6930372f4ab5f781a9fb7c5f78e6ddabb5316f45a67c5258375d50b5b4ea7f7a97d3a44eda6c34d1a8e7b8c5e5a5f21a95042
7
- data.tar.gz: 49532d4362b42b2dcf5f8ef60afd677e64d23aece076933623f0e102f3a803383bff1f6c9add7d00097044459cbd609dd71ead49a965af1636c7a3452f3a885b
6
+ metadata.gz: 4adc990bc7c22716e61e0185dccfbe789e50d88c05d5c21894ee6fbaec7b3f6bbf32ea3db29a977c0a586c858c2a6692248da8ca456a94ed5045727498220617
7
+ data.tar.gz: b19ddacc5aaa10bc55ea15bfedf4d1964035045cedb117cfa87a1472a9c60205d9d23b721cc93f1b5f5de7b117440853bf7c7ea5d7b94b6352fb0c5b8afb83a2
data/lib/i18n.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'concurrent/map'
4
+ require 'concurrent/hash'
4
5
 
5
6
  require 'i18n/version'
6
7
  require 'i18n/exceptions'
@@ -33,7 +34,7 @@ module I18n
33
34
  EMPTY_HASH = {}.freeze
34
35
 
35
36
  def self.new_double_nested_cache # :nodoc:
36
- Concurrent::Map.new { |h,k| h[k] = Concurrent::Map.new }
37
+ Concurrent::Map.new { |h, k| h[k] = Concurrent::Map.new }
37
38
  end
38
39
 
39
40
  module Base
@@ -17,11 +17,11 @@
17
17
  #
18
18
  # The cache_key implementation by default assumes you pass values that return
19
19
  # a valid key from #hash (see
20
- # http://www.ruby-doc.org/core/classes/Object.html#M000337). However, you can
20
+ # https://www.ruby-doc.org/core/classes/Object.html#M000337). However, you can
21
21
  # configure your own digest method via which responds to #hexdigest (see
22
- # http://ruby-doc.org/stdlib/libdoc/digest/rdoc/index.html):
22
+ # https://ruby-doc.org/stdlib/libdoc/openssl/rdoc/OpenSSL/Digest.html):
23
23
  #
24
- # I18n.cache_key_digest = Digest::MD5.new
24
+ # I18n.cache_key_digest = OpenSSL::Digest::SHA256.new
25
25
  #
26
26
  # If you use a lambda as a default value in your translation like this:
27
27
  #
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'digest/sha2'
3
+ require 'openssl'
4
4
 
5
5
  module I18n
6
6
  module Backend
@@ -19,7 +19,7 @@ module I18n
19
19
  key = I18n::Backend::Flatten.escape_default_separator(normalized_path(filename))
20
20
  old_mtime, old_digest = initialized && lookup(:i18n, key, :load_file)
21
21
  return if (mtime = File.mtime(filename).to_i) == old_mtime ||
22
- (digest = Digest::SHA2.file(filename).hexdigest) == old_digest
22
+ (digest = OpenSSL::Digest::SHA256.file(filename).hexdigest) == old_digest
23
23
  super
24
24
  store_translations(:i18n, load_file: { key => [mtime, digest] })
25
25
  end
@@ -16,11 +16,13 @@ module I18n
16
16
  # Returns the current fallbacks implementation. Defaults to +I18n::Locale::Fallbacks+.
17
17
  def fallbacks
18
18
  @@fallbacks ||= I18n::Locale::Fallbacks.new
19
+ Thread.current[:i18n_fallbacks] || @@fallbacks
19
20
  end
20
21
 
21
22
  # Sets the current fallbacks implementation. Use this to set a different fallbacks implementation.
22
23
  def fallbacks=(fallbacks)
23
24
  @@fallbacks = fallbacks.is_a?(Array) ? I18n::Locale::Fallbacks.new(fallbacks) : fallbacks
25
+ Thread.current[:i18n_fallbacks] = @@fallbacks
24
26
  end
25
27
  end
26
28
 
@@ -40,7 +40,7 @@ module I18n
40
40
  return data
41
41
  end
42
42
  locale = locale.to_sym
43
- translations[locale] ||= {}
43
+ translations[locale] ||= Concurrent::Hash.new
44
44
  data = data.deep_symbolize_keys
45
45
  translations[locale].deep_merge!(data)
46
46
  end
@@ -71,7 +71,7 @@ module I18n
71
71
  # call `init_translations`
72
72
  init_translations if do_init && !initialized?
73
73
 
74
- @translations ||= {}
74
+ @translations ||= Concurrent::Hash.new { |h, k| h[k] = Concurrent::Hash.new }
75
75
  end
76
76
 
77
77
  protected
@@ -4,7 +4,7 @@ module I18n
4
4
  using I18n::HashRefinements
5
5
  def except(*keys)
6
6
  dup.except!(*keys)
7
- end
7
+ end unless method_defined?(:except)
8
8
 
9
9
  def except!(*keys)
10
10
  keys.each { |key| delete(key) }
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.8.7"
4
+ VERSION = "1.8.9"
5
5
  end
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.8.7
4
+ version: 1.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Fuchs
@@ -13,15 +13,15 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2021-01-04 00:00:00.000000000 Z
16
+ date: 2021-02-12 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
- name: concurrent-ruby
20
19
  requirement: !ruby/object:Gem::Requirement
21
20
  requirements:
22
21
  - - "~>"
23
22
  - !ruby/object:Gem::Version
24
23
  version: '1.0'
24
+ name: concurrent-ruby
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,23 +90,7 @@ metadata:
90
90
  changelog_uri: https://github.com/ruby-i18n/i18n/releases
91
91
  documentation_uri: https://guides.rubyonrails.org/i18n.html
92
92
  source_code_uri: https://github.com/ruby-i18n/i18n
93
- post_install_message: |2+
94
-
95
- HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
96
- But that may break your application.
97
-
98
- If you are upgrading your Rails application from an older version of Rails:
99
-
100
- Please check your Rails app for 'config.i18n.fallbacks = true'.
101
- If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
102
- 'config.i18n.fallbacks = [I18n.default_locale]'.
103
- If not, fallbacks will be broken in your app by I18n 1.1.x.
104
-
105
- If you are starting a NEW Rails application, you can ignore this notice.
106
-
107
- For more info see:
108
- https://github.com/svenfuchs/i18n/releases/tag/v1.1.0
109
-
93
+ post_install_message:
110
94
  rdoc_options: []
111
95
  require_paths:
112
96
  - lib
@@ -121,9 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
105
  - !ruby/object:Gem::Version
122
106
  version: 1.3.5
123
107
  requirements: []
124
- rubygems_version: 3.2.3
108
+ rubygems_version: 3.0.6
125
109
  signing_key:
126
110
  specification_version: 4
127
111
  summary: New wave Internationalization support for Ruby
128
112
  test_files: []
129
- ...