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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/gemfiles/actionpack.edge.gemfile.lock +1 -1
- data/gemfiles/actionpack5.2.gemfile.lock +1 -1
- data/gemfiles/actionpack6.0.gemfile.lock +1 -1
- data/gemfiles/actionpack6.1.gemfile.lock +1 -1
- data/lib/country_select/formats.rb +3 -1
- data/lib/country_select/version.rb +1 -1
- data/spec/country_select_spec.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f79817c4bcf3df9e63c08756f84001c840be85c79ed8b07a4ff6d5cb9dd6b65
|
4
|
+
data.tar.gz: 7a6e4ac2b315dacc9788ef70264752f9d8013194eba5abd124abbb2475e0a1c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31eb7c557942a0e88c44de468f7c54bc7345348f9f0330515db003b2ad78a70453d18133574ff2a6c1d419e1c8168a9998d62f7feb43661d139c16f8f644f921
|
7
|
+
data.tar.gz: a4623e97352b356ff04bddaeb70cccfd46e1510f61797e5a6aa17a7a58ce786b2d281498f436e360277aebc2bd44c0cfc54a110625b51b486d4ac8340d7ffd7b
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,6 +2,8 @@ module CountrySelect
|
|
2
2
|
FORMATS = {}
|
3
3
|
|
4
4
|
FORMATS[:default] = lambda do |country|
|
5
|
-
country.translations
|
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
|
data/spec/country_select_spec.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2021-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|