worldwide 1.12.0 → 1.13.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: dbd0868290580c52211d482478466332dc15728b688a53b966eccbc82fc9a4b8
4
- data.tar.gz: 24ef5f713338348f9708b6c70c17e758ea613d654f8d0c07f87f7e73c4c778fd
3
+ metadata.gz: de01cd292543ad56954a9e2997fac176b3a57f311551697228bf1670a9c24e66
4
+ data.tar.gz: a7bb98e141f34d5c2d0fb026a16b9ac102d2e06780b49cee161f6ebe921be12d
5
5
  SHA512:
6
- metadata.gz: 75a75cfec661ab1c9a1690e8aa01b0b803d2e0cd33da6f6f26853360f7ee837134236db8a64c1f7ce0716c69f374664c5ee8c1f0a9090dab4027e6d2785d401c
7
- data.tar.gz: 8529dc4dce8a96795c801b2c80d95c0e862d3fdf652433248f09be1ff6fe8bad0b3cd49a7162ee36059659d5ef6ceba9b79c84c3c2f756647b9d46df663a2dc7
6
+ metadata.gz: 65c4aaf5dadb2f54edf355f5dd02c49a8d96b5b22c81f92c57fc25c642bd753bb864627afc2f8467f3884f045715d494d6ec57025c5cbe73c1e30b6c0ab43e34
7
+ data.tar.gz: 8145a23f869a46784161a97e99563701119e05f76a63c187f60d36ab9d6d4bed5118c4d0cdbed52da49681a3cc50e2c2f260ccda175d94cf31feaeed63492b4c
data/CHANGELOG.md CHANGED
@@ -27,8 +27,17 @@ 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.13.0] - 2024-11-06
34
+ - Add `zip_prefixes` for Spain. [#295](https://github.com/Shopify/worldwide/pull/295)
35
+ - Move expensive resource initialization into an explicit `eager_load!` namespace method
36
+ [#297](https://github.com/Shopify/worldwide/pull/297)
37
+
38
+ ## [1.12.1] - 2024-10-15
39
+ - Update BR address1_regex to remove lookbehinds [#](https://github.com/Shopify/worldwide/pull/)
40
+
32
41
  ## [1.12.0] - 2024-10-11
33
42
  - Update Address splitting methods to split on the first delimiter [#291](https://github.com/Shopify/worldwide/pull/291)
34
43
 
data/Gemfile.lock CHANGED
@@ -13,7 +13,7 @@ GIT
13
13
  PATH
14
14
  remote: .
15
15
  specs:
16
- worldwide (1.12.0)
16
+ worldwide (1.13.0)
17
17
  activesupport (>= 7.0)
18
18
  i18n
19
19
  phonelib (~> 0.8)
@@ -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>(?!.*\\bnúmero\\b)[^\\d,]+(?<!\\s))(?:,? ?)(?<streetNumber>\\d+(?: ?[a-z])?)$"
32
+ - "^(?<streetName>(?:[^\\d,\\s]+\\s)*[^\\d,\\s]+)(?:,? ?)(?<streetNumber>\\d+(?: ?[a-z])?)$"
33
33
  additional_address_fields:
34
34
  - name: streetName
35
35
  required: true
@@ -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'
@@ -22,5 +22,5 @@ fr:
22
22
  default: Ville
23
23
  optional: Ville (facultatif)
24
24
  errors:
25
- blank_instructional: Saisir une ville
25
+ blank_instructional: Entrez une ville
26
26
  blank_informative: La ville est manquante
@@ -176,7 +176,7 @@ fr:
176
176
  default: Ville
177
177
  optional: Ville (facultatif)
178
178
  errors:
179
- blank_instructional: Saisir une ville
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Worldwide
4
- VERSION = "1.12.0"
4
+ VERSION = "1.13.0"
5
5
  end
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.12.0
4
+ version: 1.13.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-10-15 00:00:00.000000000 Z
11
+ date: 2024-11-06 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.21
8509
+ rubygems_version: 3.5.23
8509
8510
  signing_key:
8510
8511
  specification_version: 4
8511
8512
  summary: Internationalization and localization APIs