country_select 5.0.0 → 5.0.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: cba4eeae56362408fc434ad30ba8befcfa56f406441ae7af01324a183dd6c3d7
4
- data.tar.gz: 84cd0ba154b88b0b78864b27d98abd075cc64310b156ab72a17826798da26494
3
+ metadata.gz: 1f79817c4bcf3df9e63c08756f84001c840be85c79ed8b07a4ff6d5cb9dd6b65
4
+ data.tar.gz: 7a6e4ac2b315dacc9788ef70264752f9d8013194eba5abd124abbb2475e0a1c5
5
5
  SHA512:
6
- metadata.gz: 2fa5a8030e734c3907dea470792a9e2cc18cda220dec52c8d343cc5163d8ff552ab5389814b3b3f6658227b6515941f85460d21d5102cd28a0a15558ecdbd4e7
7
- data.tar.gz: f58da7af3c22268aa07fc4496f7fbd22235baaa5de48ae6de3dfa7873e041cfbacd20a915a968056242fef8dfd9456281e57b198f7ded53b8b88f88dbf9fc6cf
6
+ metadata.gz: 31eb7c557942a0e88c44de468f7c54bc7345348f9f0330515db003b2ad78a70453d18133574ff2a6c1d419e1c8168a9998d62f7feb43661d139c16f8f644f921
7
+ data.tar.gz: a4623e97352b356ff04bddaeb70cccfd46e1510f61797e5a6aa17a7a58ce786b2d281498f436e360277aebc2bd44c0cfc54a110625b51b486d4ac8340d7ffd7b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 5.0.1 2021-03-08
2
+
3
+ * #181 - Fix i18n fallback in country translations (@lavaturtle)
4
+
1
5
  ## 5.0.0 2021-03-04
2
6
 
3
7
  * #164,#172 - Remove support for EOL versions of Ruby and Ruby on Rails
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- country_select (5.0.0.pre)
4
+ country_select (5.0.1)
5
5
  countries (~> 3.0)
6
6
  sort_alphabetical (~> 1.1)
7
7
 
@@ -25,7 +25,7 @@ GIT
25
25
  PATH
26
26
  remote: ..
27
27
  specs:
28
- country_select (5.0.0.pre)
28
+ country_select (5.0.1)
29
29
  countries (~> 3.0)
30
30
  sort_alphabetical (~> 1.1)
31
31
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- country_select (5.0.0.pre)
4
+ country_select (5.0.1)
5
5
  countries (~> 3.0)
6
6
  sort_alphabetical (~> 1.1)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- country_select (5.0.0.pre)
4
+ country_select (5.0.1)
5
5
  countries (~> 3.0)
6
6
  sort_alphabetical (~> 1.1)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- country_select (5.0.0.pre)
4
+ country_select (5.0.1)
5
5
  countries (~> 3.0)
6
6
  sort_alphabetical (~> 1.1)
7
7
 
@@ -2,6 +2,8 @@ module CountrySelect
2
2
  FORMATS = {}
3
3
 
4
4
  FORMATS[:default] = lambda do |country|
5
- country.translations&.dig(I18n.locale.to_s) || country.name
5
+ # Need to use :[] specifically, not :dig, because country.translations is a
6
+ # ISO3166::Translations object, which overrides :[] to support i18n locale fallbacks
7
+ country.translations&.send(:[], I18n.locale.to_s) || country.name
6
8
  end
7
9
  end
@@ -1,3 +1,3 @@
1
1
  module CountrySelect
2
- VERSION = '5.0.0'
2
+ VERSION = '5.0.1'
3
3
  end
@@ -61,6 +61,23 @@ describe "CountrySelect" do
61
61
  end
62
62
  end
63
63
 
64
+ it 'falls back when given a country-specific locale' do
65
+ I18n.available_locales = [:en, :de, :'de-AT']
66
+ ISO3166.reset
67
+
68
+ tag = options_for_select([['Deutschland', 'DE']], 'DE')
69
+
70
+ walrus.country_code = 'DE'
71
+ original_locale = I18n.locale
72
+ begin
73
+ I18n.locale = :'de-AT'
74
+ t = builder.country_select(:country_code)
75
+ expect(t).to include(tag)
76
+ ensure
77
+ I18n.locale = original_locale
78
+ end
79
+ end
80
+
64
81
  it "accepts a locale option" do
65
82
  I18n.available_locales = [:fr]
66
83
  ISO3166.reset
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: country_select
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Penner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-04 00:00:00.000000000 Z
11
+ date: 2021-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack