worldwide 0.6.7 → 0.7.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: 178e0c8d74b9c3cec8bf652560c83526bcb3623786524ee1900ad8d346c9a426
4
- data.tar.gz: 7dc35f369eb2f1e3aff02973de09c9bcc2d027a23a7730215720c9fc94a8a3a7
3
+ metadata.gz: d77d16a44dc494413132f4e14e2e990a2cd4d184bec491428f2beb5e14038cd6
4
+ data.tar.gz: 00b095d594e66f476403a8040d304a102ce494d9f5cc1fd9c9e8d9d833425c89
5
5
  SHA512:
6
- metadata.gz: c5d34009294fed8737d30579aeb6595a45be8a99e2ccccfb9f6abc53d99545679caeaf9e5ab8a5c56abdf5e3e59bfaefec0187d3e4c13d03faf2580acf877402
7
- data.tar.gz: 3abe562d1c290ada493b76695e36ac038bcded8e0d0bfa2ad26975983057877d91afd88ddd1000be468976d46eaa584331ac00decfd65894cb28aef1c3615e48
6
+ metadata.gz: 8e737c2f727fb3e017a83a88490cbd73ff4c9408ec43c44b804fb07d1ebf5262c21d3e9df98a4f5bc6746e6d5f25997abb3f862f581c1595f60d36491ed22e81
7
+ data.tar.gz: 74436ab09a204d16cec2064c530e473b19109ffbd24d23320f735e081781333fde6af0c547044dbba4cc7f1147aab71585c74c443e98147a4e796133a1e4836d
data/CHANGELOG.md CHANGED
@@ -27,9 +27,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
27
27
 
28
28
  ## [Unreleased]
29
29
 
30
- nil.
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)
35
+
36
+ [0.6.8] - 2024-01-31
37
+
38
+ - Prefer "SAR" over "SAR China" in Chinese-language names for regions `HK` and `MO`. [#79](https://github.com/Shopify/worldwide/pull/79).
39
+ - Add Worldwide::Field.valid_key? method. [#80](https://github.com/Shopify/worldwide/pull/80)
33
40
 
34
41
  [0.6.7] - 2024-01-30
35
42
 
data/Gemfile.lock CHANGED
@@ -13,7 +13,7 @@ GIT
13
13
  PATH
14
14
  remote: .
15
15
  specs:
16
- worldwide (0.6.7)
16
+ worldwide (0.7.0)
17
17
  activesupport (~> 7.0)
18
18
  i18n
19
19
  phonelib (~> 0.8)
@@ -132,4 +132,4 @@ DEPENDENCIES
132
132
  worldwide!
133
133
 
134
134
  BUNDLED WITH
135
- 2.4.6
135
+ 2.4.10
@@ -132,7 +132,7 @@ zh:
132
132
  GU: 关岛
133
133
  GW: 几内亚比绍
134
134
  GY: 圭亚那
135
- HK: 中国香港特别行政区
135
+ HK: 香港特别行政区
136
136
  HM: 赫德岛和麦克唐纳群岛
137
137
  HN: 洪都拉斯
138
138
  HR: 克罗地亚
@@ -186,7 +186,7 @@ zh:
186
186
  ML: 马里
187
187
  MM: 缅甸
188
188
  MN: 蒙古
189
- MO: 中国澳门特别行政区
189
+ MO: 澳门特别行政区
190
190
  MP: 北马里亚纳群岛
191
191
  MQ: 马提尼克
192
192
  MR: 毛里塔尼亚
@@ -20,8 +20,14 @@ module Worldwide
20
20
  :address,
21
21
  ]
22
22
 
23
- def initialize(country_code:, field_key:)
24
- @country_code = country_code.upcase.to_sym
23
+ class << self
24
+ def valid_key?(key)
25
+ VALID_KEYS.include?(key.to_sym)
26
+ end
27
+ end
28
+
29
+ def initialize(country_code: nil, field_key:)
30
+ @country_code = country_code&.upcase&.to_sym
25
31
  @field_key = field_key.downcase.to_sym
26
32
  end
27
33
 
@@ -59,8 +65,12 @@ module Worldwide
59
65
 
60
66
  def lookup(key_suffix, locale:, options: {})
61
67
  I18n.with_locale(locale) do
62
- I18n.t("#{base_key(@country_code)}.#{key_suffix}", default: nil, **options) ||
68
+ if @country_code.nil?
63
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
64
74
  end
65
75
  end
66
76
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Worldwide
4
- VERSION = "0.6.7"
4
+ VERSION = "0.7.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: worldwide
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.7
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify