worldwide 0.6.8 → 0.7.0
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 -2
- data/Gemfile.lock +2 -2
- data/lib/worldwide/field.rb +7 -3
- data/lib/worldwide/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d77d16a44dc494413132f4e14e2e990a2cd4d184bec491428f2beb5e14038cd6
|
4
|
+
data.tar.gz: 00b095d594e66f476403a8040d304a102ce494d9f5cc1fd9c9e8d9d833425c89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e737c2f727fb3e017a83a88490cbd73ff4c9408ec43c44b804fb07d1ebf5262c21d3e9df98a4f5bc6746e6d5f25997abb3f862f581c1595f60d36491ed22e81
|
7
|
+
data.tar.gz: 74436ab09a204d16cec2064c530e473b19109ffbd24d23320f735e081781333fde6af0c547044dbba4cc7f1147aab71585c74c443e98147a4e796133a1e4836d
|
data/CHANGELOG.md
CHANGED
@@ -27,9 +27,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
27
27
|
|
28
28
|
## [Unreleased]
|
29
29
|
|
30
|
-
|
30
|
+
- Nil.
|
31
31
|
|
32
|
-
|
32
|
+
[0.7.0] - 2024-01-31
|
33
|
+
|
34
|
+
- Support address field lookup when there is no country code. [#82](https://github.com/Shopify/worldwide/pull/82)
|
33
35
|
|
34
36
|
[0.6.8] - 2024-01-31
|
35
37
|
|
data/Gemfile.lock
CHANGED
data/lib/worldwide/field.rb
CHANGED
@@ -26,8 +26,8 @@ module Worldwide
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
def initialize(country_code
|
30
|
-
@country_code = country_code
|
29
|
+
def initialize(country_code: nil, field_key:)
|
30
|
+
@country_code = country_code&.upcase&.to_sym
|
31
31
|
@field_key = field_key.downcase.to_sym
|
32
32
|
end
|
33
33
|
|
@@ -65,8 +65,12 @@ module Worldwide
|
|
65
65
|
|
66
66
|
def lookup(key_suffix, locale:, options: {})
|
67
67
|
I18n.with_locale(locale) do
|
68
|
-
|
68
|
+
if @country_code.nil?
|
69
69
|
default_lookup(key_suffix, options: options)
|
70
|
+
else
|
71
|
+
I18n.t("#{base_key(@country_code)}.#{key_suffix}", default: nil, **options) ||
|
72
|
+
default_lookup(key_suffix, options: options)
|
73
|
+
end
|
70
74
|
end
|
71
75
|
end
|
72
76
|
end
|
data/lib/worldwide/version.rb
CHANGED