i18n 1.10.0 → 1.12.0

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: bcce939890b82f2f78ef93aa98b2be5995f172f6c37b95c53800c155f2036eec
4
- data.tar.gz: ae4d72446e698fc7c0666f0e9dad6f11fa669d768fe9272d0c89e14aba8d2274
3
+ metadata.gz: b92d195deaeca5e93f73cc62be2d2fb4c93d8a9787449e168b493773e5072458
4
+ data.tar.gz: f1172c9fac93f493c8a5b16cff4b27154ff917aed48cbc46a4a702363863111d
5
5
  SHA512:
6
- metadata.gz: bf36e9389526d5a48bbfc4043bc2c4587ddbfbfab41a2ccaafa801570c3a838530a001c6c3df1669d5e0beb14b63b394253cef6d6fdd12aa936ae8c07ecdbf72
7
- data.tar.gz: 82b972e13f2342ca864e4ead724008aa75ad24bbf6d4f14603330e2999501cfb5c05ee6a9e5cd2cffbf48f07f6da868fccc33b4771f7b4b085989c4def36a7b9
6
+ metadata.gz: 0174d10f7bac17e29cf7622d3ce69850e51755d53fd3d17d2f672bc9ca3c75823b851f6d04cbd367fea8ff5830c8c755fb9c80433bac9ec3c46590cbe9a874d0
7
+ data.tar.gz: ef22ed98cb7f223753a65b9d63d0f40e4b6821c93a41b1b41627e4c7b4e3de6b7bd411d8a6ed3d46dc6554432a776535c0461248e8d1fbfeee05dcda2ab89235
@@ -107,7 +107,7 @@ module I18n
107
107
  private
108
108
 
109
109
  # Overwrite on_fallback to add specified logic when the fallback succeeds.
110
- def on_fallback(_original_locale, _fallback_locale, _key, _optoins)
110
+ def on_fallback(_original_locale, _fallback_locale, _key, _options)
111
111
  nil
112
112
  end
113
113
  end
data/lib/i18n/config.rb CHANGED
@@ -38,7 +38,7 @@ module I18n
38
38
  end
39
39
 
40
40
  # Returns an array of locales for which translations are available.
41
- # Unless you explicitely set these through I18n.available_locales=
41
+ # Unless you explicitly set these through I18n.available_locales=
42
42
  # the call will be delegated to the backend.
43
43
  def available_locales
44
44
  @@available_locales ||= nil
@@ -106,7 +106,7 @@ module I18n
106
106
  # if you don't care about arity.
107
107
  #
108
108
  # == Example:
109
- # You can supress raising an exception and return string instead:
109
+ # You can suppress raising an exception and return string instead:
110
110
  #
111
111
  # I18n.config.missing_interpolation_argument_handler = Proc.new do |key|
112
112
  # "#{key} is missing"
@@ -24,7 +24,7 @@ module I18n
24
24
  been set is likely to display text from the wrong locale to some users.
25
25
 
26
26
  If you have a legitimate reason to access i18n data outside of the user flow, you can do so by passing
27
- the desired locale explictly with the `locale` argument, e.g. `I18n.#{method}(..., locale: :en)`
27
+ the desired locale explicitly with the `locale` argument, e.g. `I18n.#{method}(..., locale: :en)`
28
28
  MESSAGE
29
29
  end
30
30
  end
@@ -1,5 +1,5 @@
1
1
  # Simple Locale tag implementation that computes subtags by simply splitting
2
- # the locale tag at '-' occurences.
2
+ # the locale tag at '-' occurrences.
3
3
  module I18n
4
4
  module Locale
5
5
  module Tag
@@ -26,7 +26,7 @@ module I18n
26
26
  assert_equal I18n.available_locales, I18n.backend.available_locales
27
27
  end
28
28
 
29
- test "available_locales memoizes when set explicitely" do
29
+ test "available_locales memoizes when set explicitly" do
30
30
  I18n.backend.expects(:available_locales).never
31
31
  I18n.available_locales = [:foo]
32
32
  I18n.backend.store_translations('de', :bar => 'baz')
@@ -34,7 +34,7 @@ module I18n
34
34
  assert_equal [:foo], I18n.available_locales
35
35
  end
36
36
 
37
- test "available_locales delegates to the backend when not set explicitely" do
37
+ test "available_locales delegates to the backend when not set explicitly" do
38
38
  original_available_locales_value = I18n.backend.available_locales
39
39
  I18n.backend.expects(:available_locales).returns(original_available_locales_value).twice
40
40
  assert_equal I18n.backend.available_locales, I18n.available_locales
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.10.0"
4
+ VERSION = "1.12.0"
5
5
  end
data/lib/i18n.rb CHANGED
@@ -214,18 +214,12 @@ module I18n
214
214
 
215
215
  backend = config.backend
216
216
 
217
- result = catch(:exception) do
218
- if key.is_a?(Array)
219
- key.map { |k| backend.translate(locale, k, options) }
220
- else
221
- backend.translate(locale, key, options)
217
+ if key.is_a?(Array)
218
+ key.map do |k|
219
+ translate_key(k, throw, raise, locale, backend, options)
222
220
  end
223
- end
224
-
225
- if result.is_a?(MissingTranslation)
226
- handle_exception((throw && :throw || raise && :raise), result, locale, key, options)
227
221
  else
228
- result
222
+ translate_key(key, throw, raise, locale, backend, options)
229
223
  end
230
224
  end
231
225
  alias :t :translate
@@ -364,6 +358,18 @@ module I18n
364
358
 
365
359
  private
366
360
 
361
+ def translate_key(key, throw, raise, locale, backend, options)
362
+ result = catch(:exception) do
363
+ backend.translate(locale, key, options)
364
+ end
365
+
366
+ if result.is_a?(MissingTranslation)
367
+ handle_exception((throw && :throw || raise && :raise), result, locale, key, options)
368
+ else
369
+ result
370
+ end
371
+ end
372
+
367
373
  # Any exceptions thrown in translate will be sent to the @@exception_handler
368
374
  # which can be a Symbol, a Proc or any other Object unless they're forced to
369
375
  # be raised or thrown (MissingTranslation).
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.10.0
4
+ version: 1.12.0
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: 2022-02-14 00:00:00.000000000 Z
16
+ date: 2022-07-13 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: concurrent-ruby
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  - !ruby/object:Gem::Version
107
107
  version: 1.3.5
108
108
  requirements: []
109
- rubygems_version: 3.1.6
109
+ rubygems_version: 3.3.16
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: New wave Internationalization support for Ruby