i18n 1.7.0 → 1.7.1

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: dd80c4dac859bf40aa5a70cab46357ea469fe054757dc747d8976a243e619bb0
4
- data.tar.gz: f396a7f27e9295a336dbccc489828439816de7dbc7b7fd5f8bd7863c907d813a
3
+ metadata.gz: d2d329752d461ff5287721f9bd5fee7f33a102562eaee86e6a9ab2cb2fbdae44
4
+ data.tar.gz: 305fc47d8004f06f2589d1bccb015c772e1122c18e4328956a89833e473f6e29
5
5
  SHA512:
6
- metadata.gz: 1be60c0724e1bb2054dfaecc1f732d3a6d52e2eaa600947899938f591b0cbb3af43614d57e2157d9f6a35f18b8b3119e65cba605b32cef33c4e361be2e84f9aa
7
- data.tar.gz: 973b4f37394853d37b10a8801cc6d3b33f934601ccd492a1c93df6f05c13cb780068403c4e12216d0a831489babd0fcec9eb04ad0c68ebbaf57a94b76ad24ed2
6
+ metadata.gz: 16bc9ad463daaea66200aac4eade44ab199cdd4cf29e0a2d0eb0de3230ceee005d67aaa03459e2f364d1638d2cc6e9f3f8b378f7f0b6cff685f88e66044d9f1a
7
+ data.tar.gz: 157350c5f080cb7fc1ba074411c06d364332d66e2e23f512f1a263fcf9e23ff309f2e696da582862effd9d22a9207c8f6191fbaf5806c3f94ab1b212e5630c00
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ruby I18n
2
2
 
3
- [![Build Status](https://api.travis-ci.org/ruby-i18n/i18n.svg?branch=master)](https://travis-ci.org/ruby-i18n/i18n)
3
+ [![Build Status](https://github.com/ruby-i18n/i18n/workflows/Ruby/badge.svg)](https://github.com/ruby-i18n/i18n/actions?query=workflow%3ARuby)
4
4
 
5
5
  Ruby Internationalization and localization solution.
6
6
 
@@ -176,6 +176,22 @@ module I18n
176
176
  # from the argument values passed to #translate. Therefore your lambdas should
177
177
  # always return the same translations/values per unique combination of argument
178
178
  # values.
179
+ #
180
+ # *Ruby 2.7+ keyword arguments warning*
181
+ #
182
+ # This method uses keyword arguments.
183
+ # There is a breaking change in ruby that produces warning with ruby 2.7 and won't work as expected with ruby 3.0
184
+ # The "hash" parameter must be passed as keyword argument.
185
+ #
186
+ # Good:
187
+ # I18n.t(:salutation, :gender => 'w', :name => 'Smith')
188
+ # I18n.t(:salutation, **{ :gender => 'w', :name => 'Smith' })
189
+ # I18n.t(:salutation, **any_hash)
190
+ #
191
+ # Bad:
192
+ # I18n.t(:salutation, { :gender => 'w', :name => 'Smith' })
193
+ # I18n.t(:salutation, any_hash)
194
+ #
179
195
  def translate(key = nil, *, throw: false, raise: false, locale: nil, **options) # TODO deprecate :raise
180
196
  locale ||= config.locale
181
197
  raise Disabled.new('t') if locale == false
@@ -163,7 +163,7 @@ module I18n
163
163
  # not standard with regards to the CLDR pluralization rules.
164
164
  # Other backends can implement more flexible or complex pluralization rules.
165
165
  def pluralize(locale, entry, count)
166
- return entry unless entry.is_a?(Hash) && count
166
+ return entry unless entry.is_a?(Hash) && count && entry.values.none? { |v| v.is_a?(Hash) }
167
167
 
168
168
  key = pluralization_key(entry, count)
169
169
  raise InvalidPluralizationData.new(entry, count, key) unless entry.has_key?(key)
@@ -29,7 +29,7 @@ module I18n
29
29
  # either pick a special :zero translation even for languages where the
30
30
  # pluralizer does not return a :zero key.
31
31
  def pluralize(locale, entry, count)
32
- return entry unless entry.is_a?(Hash) and count
32
+ return entry unless entry.is_a?(Hash) && count && entry.values.none? { |v| v.is_a?(Hash) }
33
33
 
34
34
  pluralizer = pluralizer(locale)
35
35
  if pluralizer.respond_to?(:call)
@@ -26,7 +26,7 @@ module I18n
26
26
  }
27
27
  assert_equal('linked', I18n.backend.translate('en', :'foo.link'))
28
28
  end
29
-
29
+
30
30
  test "linked lookup: if a dot-separated key resolves to a dot-separated symbol it looks up the symbol" do
31
31
  I18n.backend.store_translations 'en', {
32
32
  :foo => { :link => :"bar.linked" },
@@ -51,6 +51,16 @@ module I18n
51
51
  assert_equal "can't be blank", I18n.t(:"activerecord.errors.messages.blank")
52
52
  assert_equal "can't be blank", I18n.t(:"activerecord.errors.messages.blank")
53
53
  end
54
+
55
+ test "linked lookup: a link can resolve with option :count" do
56
+ I18n.backend.store_translations 'en', {
57
+ :counter => :counted,
58
+ :counted => { :foo => { :one => "one", :other => "other" }, :bar => "bar" }
59
+ }
60
+ assert_equal "one", I18n.t(:'counter.foo', count: 1)
61
+ assert_equal "other", I18n.t(:'counter.foo', count: 2)
62
+ assert_equal "bar", I18n.t(:'counter.bar', count: 3)
63
+ end
54
64
  end
55
65
  end
56
66
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module I18n
4
- VERSION = "1.7.0"
4
+ VERSION = "1.7.1"
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.7.0
4
+ version: 1.7.1
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: 2019-10-04 00:00:00.000000000 Z
16
+ date: 2020-01-07 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: concurrent-ruby
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  - !ruby/object:Gem::Version
118
118
  version: 1.3.5
119
119
  requirements: []
120
- rubygems_version: 3.0.3
120
+ rubygems_version: 3.1.2
121
121
  signing_key:
122
122
  specification_version: 4
123
123
  summary: New wave Internationalization support for Ruby