worldwide 1.12.0 → 1.14.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 +13 -0
- data/Gemfile.lock +1 -1
- data/db/data/regions/BR.yml +1 -1
- data/db/data/regions/ES.yml +104 -0
- data/db/data/regions/SE/fr.yml +1 -1
- data/db/data/regions/_default/fr.yml +1 -1
- data/lib/worldwide/rails/railtie.rb +13 -0
- data/lib/worldwide/region.rb +12 -0
- data/lib/worldwide/regions_loader.rb +3 -0
- data/lib/worldwide/version.rb +1 -1
- data/lib/worldwide.rb +6 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8e1682267c61bc3105042d14c28f05ca21730e15f4da748369a135e30650228
|
4
|
+
data.tar.gz: 0b956ea2386d92d289b5c59982aea7f9469ef383fa2d4047ecb91892391493d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 737c81fe51007d97a2d1a6e8641f4b532e92c2039c96814477ad805b5db3619ca9ecfe93c67f5585c316f9740247cbc5698731bcb5f20495fe3cad60acad0318
|
7
|
+
data.tar.gz: 5e7c43277a21471884a70def39f0e3a314793587f0542b54906370a95d06cdfbd0ecddc098c191442298aa3d5f065781882ef285b421e22b0a7baca3833cc620
|
data/CHANGELOG.md
CHANGED
@@ -27,8 +27,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
27
27
|
|
28
28
|
## [Unreleased]
|
29
29
|
- Nil.
|
30
|
+
|
30
31
|
---
|
31
32
|
|
33
|
+
## [1.14.0] - 2024-11-07
|
34
|
+
- Add example_city_zip and priority accessors to Regions [#298](https://github.com/Shopify/worldwide/pull/298)
|
35
|
+
- Add tax_type accessor to Regions [#299](https://github.com/Shopify/worldwide/pull/299)
|
36
|
+
|
37
|
+
## [1.13.0] - 2024-11-06
|
38
|
+
- Add `zip_prefixes` for Spain. [#295](https://github.com/Shopify/worldwide/pull/295)
|
39
|
+
- Move expensive resource initialization into an explicit `eager_load!` namespace method
|
40
|
+
[#297](https://github.com/Shopify/worldwide/pull/297)
|
41
|
+
|
42
|
+
## [1.12.1] - 2024-10-15
|
43
|
+
- Update BR address1_regex to remove lookbehinds [#](https://github.com/Shopify/worldwide/pull/)
|
44
|
+
|
32
45
|
## [1.12.0] - 2024-10-11
|
33
46
|
- Update Address splitting methods to split on the first delimiter [#291](https://github.com/Shopify/worldwide/pull/291)
|
34
47
|
|
data/Gemfile.lock
CHANGED
data/db/data/regions/BR.yml
CHANGED
@@ -29,7 +29,7 @@ format:
|
|
29
29
|
format_extended:
|
30
30
|
edit: "{country}_{firstName}{lastName}_{company}_{zip}_{streetName}{streetNumber}_{line2}{neighborhood}_{city}{province}_{phone}"
|
31
31
|
address1_regex:
|
32
|
-
- "^(?<streetName>(
|
32
|
+
- "^(?<streetName>(?:[^\\d,\\s]+\\s)*[^\\d,\\s]+)(?:,? ?)(?<streetNumber>\\d+(?: ?[a-z])?)$"
|
33
33
|
additional_address_fields:
|
34
34
|
- name: streetName
|
35
35
|
required: true
|
data/db/data/regions/ES.yml
CHANGED
@@ -48,38 +48,54 @@ zones:
|
|
48
48
|
code: C
|
49
49
|
tax: 0.0
|
50
50
|
tax_name: VAT
|
51
|
+
zip_prefixes:
|
52
|
+
- '15'
|
51
53
|
- name: Álava
|
52
54
|
name_alternates:
|
53
55
|
- Araba
|
54
56
|
code: VI
|
55
57
|
tax: 0.0
|
56
58
|
tax_name: VAT
|
59
|
+
zip_prefixes:
|
60
|
+
- '01'
|
57
61
|
- name: Albacete
|
58
62
|
code: AB
|
59
63
|
tax: 0.0
|
60
64
|
tax_name: VAT
|
65
|
+
zip_prefixes:
|
66
|
+
- '02'
|
61
67
|
- name: Alicante
|
62
68
|
code: A
|
63
69
|
tax: 0.0
|
64
70
|
tax_name: VAT
|
71
|
+
zip_prefixes:
|
72
|
+
- '03'
|
65
73
|
- name: Almería
|
66
74
|
code: AL
|
67
75
|
tax: 0.0
|
68
76
|
tax_name: VAT
|
77
|
+
zip_prefixes:
|
78
|
+
- '04'
|
69
79
|
- name: Asturias
|
70
80
|
name_alternates:
|
71
81
|
- Principado de Asturias
|
72
82
|
code: O
|
73
83
|
tax: 0.0
|
74
84
|
tax_name: VAT
|
85
|
+
zip_prefixes:
|
86
|
+
- '33'
|
75
87
|
- name: Ávila
|
76
88
|
code: AV
|
77
89
|
tax: 0.0
|
90
|
+
zip_prefixes:
|
91
|
+
- '05'
|
78
92
|
tax_name: VAT
|
79
93
|
- name: Badajoz
|
80
94
|
code: BA
|
81
95
|
tax: 0.0
|
82
96
|
tax_name: VAT
|
97
|
+
zip_prefixes:
|
98
|
+
- '06'
|
83
99
|
- name: Balears
|
84
100
|
name_alternates:
|
85
101
|
- Baleares
|
@@ -88,76 +104,108 @@ zones:
|
|
88
104
|
code: PM
|
89
105
|
tax: 0.0
|
90
106
|
tax_name: VAT
|
107
|
+
zip_prefixes:
|
108
|
+
- '07'
|
91
109
|
- name: Barcelona
|
92
110
|
code: B
|
93
111
|
tax: 0.0
|
94
112
|
tax_name: VAT
|
113
|
+
zip_prefixes:
|
114
|
+
- '08'
|
95
115
|
- name: Burgos
|
96
116
|
code: BU
|
97
117
|
tax: 0.0
|
98
118
|
tax_name: VAT
|
119
|
+
zip_prefixes:
|
120
|
+
- '09'
|
99
121
|
- name: Cáceres
|
100
122
|
code: CC
|
101
123
|
tax: 0.0
|
102
124
|
tax_name: VAT
|
125
|
+
zip_prefixes:
|
126
|
+
- '10'
|
103
127
|
- name: Cádiz
|
104
128
|
code: CA
|
105
129
|
tax: 0.0
|
106
130
|
tax_name: VAT
|
131
|
+
zip_prefixes:
|
132
|
+
- '11'
|
107
133
|
- name: Cantabria
|
108
134
|
code: S
|
109
135
|
tax: 0.0
|
110
136
|
tax_name: VAT
|
137
|
+
zip_prefixes:
|
138
|
+
- '39'
|
111
139
|
- name: Castellón
|
112
140
|
name_alternates:
|
113
141
|
- Castelló
|
114
142
|
code: CS
|
115
143
|
tax: 0.0
|
116
144
|
tax_name: VAT
|
145
|
+
zip_prefixes:
|
146
|
+
- '12'
|
117
147
|
- name: Ceuta
|
118
148
|
code: CE
|
119
149
|
tax: 0.0
|
120
150
|
tax_name: VAT
|
151
|
+
zip_prefixes:
|
152
|
+
- '51'
|
121
153
|
- name: Ciudad Real
|
122
154
|
name_alternates:
|
123
155
|
- Cdad. Real
|
124
156
|
code: CR
|
125
157
|
tax: 0.0
|
126
158
|
tax_name: VAT
|
159
|
+
zip_prefixes:
|
160
|
+
- '13'
|
127
161
|
- name: Córdoba
|
128
162
|
name_alternates:
|
129
163
|
- Cordova
|
130
164
|
code: CO
|
131
165
|
tax: 0.0
|
132
166
|
tax_name: VAT
|
167
|
+
zip_prefixes:
|
168
|
+
- '14'
|
133
169
|
- name: Cuenca
|
134
170
|
code: CU
|
135
171
|
tax: 0.0
|
136
172
|
tax_name: VAT
|
173
|
+
zip_prefixes:
|
174
|
+
- '16'
|
137
175
|
- name: Girona
|
138
176
|
name_alternates:
|
139
177
|
- Gerona
|
140
178
|
code: GI
|
141
179
|
tax: 0.0
|
142
180
|
tax_name: VAT
|
181
|
+
zip_prefixes:
|
182
|
+
- '17'
|
143
183
|
- name: Granada
|
144
184
|
code: GR
|
145
185
|
tax: 0.0
|
146
186
|
tax_name: VAT
|
187
|
+
zip_prefixes:
|
188
|
+
- '18'
|
147
189
|
- name: Guadalajara
|
148
190
|
code: GU
|
149
191
|
tax: 0.0
|
150
192
|
tax_name: VAT
|
193
|
+
zip_prefixes:
|
194
|
+
- '19'
|
151
195
|
- name: Guipúzcoa
|
152
196
|
name_alternates:
|
153
197
|
- Gipuzkoa
|
154
198
|
code: SS
|
155
199
|
tax: 0.0
|
156
200
|
tax_name: VAT
|
201
|
+
zip_prefixes:
|
202
|
+
- '20'
|
157
203
|
- name: Huelva
|
158
204
|
code: H
|
159
205
|
tax: 0.0
|
160
206
|
tax_name: VAT
|
207
|
+
zip_prefixes:
|
208
|
+
- '21'
|
161
209
|
- name: Huesca
|
162
210
|
name_alternates:
|
163
211
|
- Uesca
|
@@ -165,32 +213,46 @@ zones:
|
|
165
213
|
code: HU
|
166
214
|
tax: 0.0
|
167
215
|
tax_name: VAT
|
216
|
+
zip_prefixes:
|
217
|
+
- '22'
|
168
218
|
- name: Jaén
|
169
219
|
code: J
|
170
220
|
tax: 0.0
|
171
221
|
tax_name: VAT
|
222
|
+
zip_prefixes:
|
223
|
+
- '23'
|
172
224
|
- name: La Rioja
|
173
225
|
code: LO
|
174
226
|
tax: 0.0
|
175
227
|
tax_name: VAT
|
228
|
+
zip_prefixes:
|
229
|
+
- '26'
|
176
230
|
- name: Las Palmas
|
177
231
|
code: GC
|
178
232
|
tax: 0.0
|
179
233
|
tax_name: VAT
|
234
|
+
zip_prefixes:
|
235
|
+
- '35'
|
180
236
|
- name: León
|
181
237
|
code: LE
|
182
238
|
tax: 0.0
|
183
239
|
tax_name: VAT
|
240
|
+
zip_prefixes:
|
241
|
+
- '24'
|
184
242
|
- name: Lleida
|
185
243
|
name_alternates:
|
186
244
|
- Lérida
|
187
245
|
code: L
|
188
246
|
tax: 0.0
|
189
247
|
tax_name: VAT
|
248
|
+
zip_prefixes:
|
249
|
+
- '25'
|
190
250
|
- name: Lugo
|
191
251
|
code: LU
|
192
252
|
tax: 0.0
|
193
253
|
tax_name: VAT
|
254
|
+
zip_prefixes:
|
255
|
+
- '27'
|
194
256
|
- name: Madrid
|
195
257
|
name_alternates:
|
196
258
|
- Comunidad de Madrid
|
@@ -198,20 +260,28 @@ zones:
|
|
198
260
|
code: M
|
199
261
|
tax: 0.0
|
200
262
|
tax_name: VAT
|
263
|
+
zip_prefixes:
|
264
|
+
- '28'
|
201
265
|
- name: Málaga
|
202
266
|
code: MA
|
203
267
|
tax: 0.0
|
204
268
|
tax_name: VAT
|
269
|
+
zip_prefixes:
|
270
|
+
- '29'
|
205
271
|
- name: Melilla
|
206
272
|
code: ML
|
207
273
|
tax: 0.0
|
208
274
|
tax_name: VAT
|
275
|
+
zip_prefixes:
|
276
|
+
- '52'
|
209
277
|
- name: Murcia
|
210
278
|
name_alternates:
|
211
279
|
- Región de Murcia
|
212
280
|
code: MU
|
213
281
|
tax: 0.0
|
214
282
|
tax_name: VAT
|
283
|
+
zip_prefixes:
|
284
|
+
- '30'
|
215
285
|
- name: Navarra
|
216
286
|
name_alternates:
|
217
287
|
- Nafarroa
|
@@ -219,64 +289,92 @@ zones:
|
|
219
289
|
code: NA
|
220
290
|
tax: 0.0
|
221
291
|
tax_name: VAT
|
292
|
+
zip_prefixes:
|
293
|
+
- '31'
|
222
294
|
- name: Ourense
|
223
295
|
code: OR
|
224
296
|
tax: 0.0
|
225
297
|
tax_name: VAT
|
298
|
+
zip_prefixes:
|
299
|
+
- '32'
|
226
300
|
- name: Palencia
|
227
301
|
code: P
|
228
302
|
tax: 0.0
|
229
303
|
tax_name: VAT
|
304
|
+
zip_prefixes:
|
305
|
+
- '34'
|
230
306
|
- name: Pontevedra
|
231
307
|
code: PO
|
232
308
|
tax: 0.0
|
233
309
|
tax_name: VAT
|
310
|
+
zip_prefixes:
|
311
|
+
- '36'
|
234
312
|
- name: Salamanca
|
235
313
|
code: SA
|
236
314
|
tax: 0.0
|
237
315
|
tax_name: VAT
|
316
|
+
zip_prefixes:
|
317
|
+
- '37'
|
238
318
|
- name: Santa Cruz de Tenerife
|
239
319
|
name_alternates:
|
240
320
|
- Santa Cruz
|
241
321
|
code: TF
|
242
322
|
tax: 0.0
|
243
323
|
tax_name: VAT
|
324
|
+
zip_prefixes:
|
325
|
+
- '38'
|
244
326
|
- name: Segovia
|
245
327
|
code: SG
|
246
328
|
tax: 0.0
|
247
329
|
tax_name: VAT
|
330
|
+
zip_prefixes:
|
331
|
+
- '40'
|
248
332
|
- name: Sevilla
|
249
333
|
name_alternates:
|
250
334
|
- Seville
|
251
335
|
code: SE
|
252
336
|
tax: 0.0
|
253
337
|
tax_name: VAT
|
338
|
+
zip_prefixes:
|
339
|
+
- '41'
|
254
340
|
- name: Soria
|
255
341
|
code: SO
|
256
342
|
tax: 0.0
|
257
343
|
tax_name: VAT
|
344
|
+
zip_prefixes:
|
345
|
+
- '42'
|
258
346
|
- name: Tarragona
|
259
347
|
code: T
|
260
348
|
tax: 0.0
|
261
349
|
tax_name: VAT
|
350
|
+
zip_prefixes:
|
351
|
+
- '43'
|
262
352
|
- name: Teruel
|
263
353
|
code: TE
|
264
354
|
tax: 0.0
|
265
355
|
tax_name: VAT
|
356
|
+
zip_prefixes:
|
357
|
+
- '44'
|
266
358
|
- name: Toledo
|
267
359
|
code: TO
|
268
360
|
tax: 0.0
|
269
361
|
tax_name: VAT
|
362
|
+
zip_prefixes:
|
363
|
+
- '45'
|
270
364
|
- name: Valencia
|
271
365
|
name_alternates:
|
272
366
|
- València
|
273
367
|
code: V
|
274
368
|
tax: 0.0
|
275
369
|
tax_name: VAT
|
370
|
+
zip_prefixes:
|
371
|
+
- '46'
|
276
372
|
- name: Valladolid
|
277
373
|
code: VA
|
278
374
|
tax: 0.0
|
279
375
|
tax_name: VAT
|
376
|
+
zip_prefixes:
|
377
|
+
- '47'
|
280
378
|
- name: Vizcaya
|
281
379
|
name_alternates:
|
282
380
|
- Biscay
|
@@ -284,16 +382,22 @@ zones:
|
|
284
382
|
code: BI
|
285
383
|
tax: 0.0
|
286
384
|
tax_name: VAT
|
385
|
+
zip_prefixes:
|
386
|
+
- '48'
|
287
387
|
- name: Zamora
|
288
388
|
code: ZA
|
289
389
|
tax: 0.0
|
290
390
|
tax_name: VAT
|
391
|
+
zip_prefixes:
|
392
|
+
- '49'
|
291
393
|
- name: Zaragoza
|
292
394
|
name_alternates:
|
293
395
|
- Saragossa
|
294
396
|
code: Z
|
295
397
|
tax: 0.0
|
296
398
|
tax_name: VAT
|
399
|
+
zip_prefixes:
|
400
|
+
- '50'
|
297
401
|
timezones:
|
298
402
|
Atlantic/Canary:
|
299
403
|
- '35'
|
data/db/data/regions/SE/fr.yml
CHANGED
@@ -176,7 +176,7 @@ fr:
|
|
176
176
|
default: Ville
|
177
177
|
optional: Ville (facultatif)
|
178
178
|
errors:
|
179
|
-
blank_instructional:
|
179
|
+
blank_instructional: Entrez une ville
|
180
180
|
blank_informative: La ville est manquante
|
181
181
|
unknown_for_zip_instructional: Saisir une ville valide pour %{zip}
|
182
182
|
unknown_for_zip_informative: La ville ne concorde pas avec %{zip}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/railtie"
|
4
|
+
|
5
|
+
module Worldwide
|
6
|
+
module Rails
|
7
|
+
class Railtie < ::Rails::Railtie
|
8
|
+
initializer "worldwide.setup" do |application|
|
9
|
+
application.config.eager_load_namespaces << Worldwide
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/worldwide/region.rb
CHANGED
@@ -17,6 +17,7 @@ module Worldwide
|
|
17
17
|
:building_number_required,
|
18
18
|
:currency,
|
19
19
|
:example_city,
|
20
|
+
:example_city_zip,
|
20
21
|
:example_address,
|
21
22
|
:flag,
|
22
23
|
:format,
|
@@ -28,6 +29,7 @@ module Worldwide
|
|
28
29
|
:languages,
|
29
30
|
:neighbours,
|
30
31
|
:numeric_three,
|
32
|
+
:priority,
|
31
33
|
:week_start_day,
|
32
34
|
:unit_system,
|
33
35
|
:zip_autofill_enabled,
|
@@ -67,6 +69,13 @@ module Worldwide
|
|
67
69
|
# A major city in the given region that can be used as an example
|
68
70
|
attr_accessor :example_city
|
69
71
|
|
72
|
+
# A zip code in the given region that can be used as an example; corresponds to example_city
|
73
|
+
attr_accessor :example_city_zip
|
74
|
+
|
75
|
+
# A value that can be used to order zones
|
76
|
+
# Some countries, Japan, for example, customarily order zones non-alphabetically.
|
77
|
+
attr_accessor :priority
|
78
|
+
|
70
79
|
# A full address in the given region that can be used as an example
|
71
80
|
attr_accessor :example_address
|
72
81
|
|
@@ -157,6 +166,9 @@ module Worldwide
|
|
157
166
|
# "generic" VAT tax rate on "most" goods
|
158
167
|
attr_reader :tax_rate
|
159
168
|
|
169
|
+
# The type of tax for this region, e.g. "harmonized"
|
170
|
+
attr_accessor :tax_type
|
171
|
+
|
160
172
|
# tags that help us group the region, e.g. "EU-member"
|
161
173
|
attr_accessor :tags
|
162
174
|
|
@@ -132,6 +132,9 @@ module Worldwide
|
|
132
132
|
region.code_alternates = zone["code_alternates"] || []
|
133
133
|
region.name_alternates = zone["name_alternates"] || []
|
134
134
|
region.example_city = zone["example_city"]
|
135
|
+
region.example_city_zip = zone["example_city_zip"]
|
136
|
+
region.priority = zone["priority"]
|
137
|
+
region.tax_type = zone["tax_type"] || nil
|
135
138
|
region.neighbours = zone["neighboring_zones"]
|
136
139
|
region.zip_prefixes = zone["zip_prefixes"] || []
|
137
140
|
end
|
data/lib/worldwide/version.rb
CHANGED
data/lib/worldwide.rb
CHANGED
@@ -39,11 +39,17 @@ require "worldwide/units"
|
|
39
39
|
require "worldwide/util"
|
40
40
|
require "worldwide/zip"
|
41
41
|
|
42
|
+
require "worldwide/rails/railtie" if defined?(Rails::Railtie)
|
43
|
+
|
42
44
|
module Worldwide
|
43
45
|
@currencies_cache = {}
|
44
46
|
@locales_cache = {}
|
45
47
|
|
46
48
|
class << self
|
49
|
+
def eager_load!
|
50
|
+
Regions.instance
|
51
|
+
end
|
52
|
+
|
47
53
|
def address(**kwargs)
|
48
54
|
Address.new(**kwargs)
|
49
55
|
end
|
@@ -109,6 +115,4 @@ module Worldwide
|
|
109
115
|
Units
|
110
116
|
end
|
111
117
|
end
|
112
|
-
|
113
|
-
Regions.instance # eagerload
|
114
118
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: worldwide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -8472,6 +8472,7 @@ files:
|
|
8472
8472
|
- lib/worldwide/pluralization_helper.rb
|
8473
8473
|
- lib/worldwide/plurals.rb
|
8474
8474
|
- lib/worldwide/punctuation.rb
|
8475
|
+
- lib/worldwide/rails/railtie.rb
|
8475
8476
|
- lib/worldwide/region.rb
|
8476
8477
|
- lib/worldwide/regions.rb
|
8477
8478
|
- lib/worldwide/regions_loader.rb
|
@@ -8505,7 +8506,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
8505
8506
|
- !ruby/object:Gem::Version
|
8506
8507
|
version: '0'
|
8507
8508
|
requirements: []
|
8508
|
-
rubygems_version: 3.5.
|
8509
|
+
rubygems_version: 3.5.23
|
8509
8510
|
signing_key:
|
8510
8511
|
specification_version: 4
|
8511
8512
|
summary: Internationalization and localization APIs
|