worldwide 2.1.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de8a80d57087c079ab1c023b73df7bab83b8e4d4efca610ada4fc1b36bf8a1fa
4
- data.tar.gz: cb20c9fecdf12aaa8b8833deb5c19e7322e0799aa2f9bdb3fabba01d398d48f1
3
+ metadata.gz: b9a82f1cb2c66512e0367a28af1a68d8b378870b58e8bef2b6aabec01ec332f5
4
+ data.tar.gz: d07213bf649760857f27130f6f8c604556d6b8e45c7339d359441925023db4af
5
5
  SHA512:
6
- metadata.gz: 7bdd5c312d07f9ecf26be0ee0946d62d1d88980f9c071e8285972e85d68aa2cae9b236d053a6103098ceeef3246c7edf245c34873f3e06ad1b5cf86bc85869bf
7
- data.tar.gz: b0a9fad71543e55efcb30e3fc3a2523602ca6f66e8f7455f19f5ab4101f6b0aadbe9f520259fc4d9776308d65fd9602fd0f98682cfa3faee6f5caa3bd434de2a
6
+ metadata.gz: 3aba7ee187e2b91c354bb9a5a4c4722bde29f17cadcb3e5816001310817b91e1faf2fcfb82c895d4c98cbef8b4382aa1aa68931650790db33a61c50642ce36e0
7
+ data.tar.gz: d927aad70adcff18005794cf332e43dfd60d285696284984bc0ad1fb09c32690f17af02cc02a963a772cdba5af3c0e059c3802defa99e42e3cb270a52a9f4b06
@@ -20,11 +20,12 @@ The most important guidelines:
20
20
 
21
21
  - All changes should be covered by tests.
22
22
  - Your code should support all the Ruby versions we have enabled on CI.
23
- - Do not update the CHANGELOG, or the `Worldwide::VERSION` constant.
23
+ - Add an entry under `Unreleased` in [`CHANGELOG.md`](../CHANGELOG.md) for every change except routine updates such as dependency bumps. Add the public PR link once it exists.
24
+ - Leave `Worldwide::VERSION` unchanged unless this PR also prepares a release.
24
25
 
25
26
  ### Releasing
26
27
 
27
28
  1. Check the [semantic versioning page](http://semver.org) for info on how to version the new release.
28
29
  2. Update the `Worldwide::VERSION` constant in **lib/worldwide/version.rb**.
29
- 3. Add a `CHANGELOG.md` entry for the new release with the date.
30
+ 3. Move the entries for this release from `Unreleased` to a dated section in `CHANGELOG.md`.
30
31
  4. Release the gem to rubygems using ShipIt (this will create tag/push during deploy)
@@ -17,11 +17,11 @@ jobs:
17
17
  - name: Check out code
18
18
  uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
19
19
  - name: Setup Node
20
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
20
+ uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
21
21
  with:
22
22
  node-version: 20
23
23
  - name: Setup PNPM
24
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
24
+ uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
25
25
  with:
26
26
  version: 9.1.3
27
27
  - name: Install dependencies
@@ -8,7 +8,9 @@ on:
8
8
 
9
9
  jobs:
10
10
  build:
11
- runs-on: ubuntu-latest
11
+ # ubuntu-latest moved to 26.04, whose tzdata no longer resolves America/Godthab (data/regions/GL.yml).
12
+ # Remove this pin once GL.yml uses America/Nuuk.
13
+ runs-on: ubuntu-24.04
12
14
  name: Ruby ${{ matrix.ruby }} / ${{ matrix.gemfile }}
13
15
  strategy:
14
16
  fail-fast: false
@@ -22,7 +24,7 @@ jobs:
22
24
  - name: Check out code
23
25
  uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
24
26
  - name: Set up Ruby ${{ matrix.ruby }}
25
- uses: ruby/setup-ruby@14594264cd68ce8a2345dd349bc3d138a4ef85c8 # v1.327.0
27
+ uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0
26
28
  with:
27
29
  ruby-version: ${{ matrix.ruby }}
28
30
  bundler-cache: true
@@ -24,11 +24,11 @@ jobs:
24
24
  with:
25
25
  token: ${{ secrets.SHOPIFY_GH_ACCESS_TOKEN }}
26
26
  - name: Setup Node
27
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
27
+ uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
28
28
  with:
29
29
  node-version: 24
30
30
  - name: Setup PNPM
31
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
31
+ uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
32
32
  with:
33
33
  version: 9.1.3
34
34
  - name: Install dependencies
data/.gitignore CHANGED
@@ -29,3 +29,6 @@ Thumbs.db
29
29
  # Vendored CLDR data downloaded during `rake cldr:data:import`
30
30
  # Contains temporary Unicode CLDR files used to generate data/cldr/
31
31
  /vendor/
32
+
33
+ # Files downloaded by the `postal:codes:import` rake task
34
+ /rake/postal/vendor/
data/AGENTS.md ADDED
@@ -0,0 +1,57 @@
1
+ # Contributing to Worldwide
2
+
3
+ Worldwide is a public Ruby gem for localization and address handling. It also contains the public `@shopify/worldwide` TypeScript package.
4
+
5
+ ## Keep contributions public
6
+
7
+ - Use public sources and synthetic address examples. Use a published address for a public institution only when the example needs a real location.
8
+ - Do not include customer or merchant data, internal links, private tickets, logs, screenshots, credentials, or unpublished findings. This rule also applies to PR text, comments, commit messages, fixtures, generated data, and CI output.
9
+ - Cite the public source for data changes. Prefer the relevant postal authority, government agency, ISO list, Unicode CLDR, or IANA time zone database. Check that readers can open the source without private access. Check the license and keep any required attribution.
10
+
11
+ ## Find the right file
12
+
13
+ | Change | Start here |
14
+ | --- | --- |
15
+ | Address layouts, postal rules, zone codes, country settings | `data/regions/<CC>.yml`, `lib/worldwide/region.rb`, `lib/worldwide/zip.rb` |
16
+ | Region labels and translations | `data/regions/<CC>/`, `data/cldr/`, `data/other/` |
17
+ | CLDR corrections | [`rake/cldr/patch.rb`](rake/cldr/patch.rb), [`rake/tasks/cldr.rake`](rake/tasks/cldr.rake) |
18
+ | Postal prefix imports | [`rake/postal/README.md`](rake/postal/README.md) |
19
+ | TypeScript address code | [`lang/typescript/`](lang/typescript/) |
20
+
21
+ ## Make the change easy to review
22
+
23
+ - Keep the change to one behavior or one related group of countries. Split unrelated cleanup and dependency updates into separate PRs.
24
+ - Match nearby YAML key order, indentation, and quoting. For generated CLDR data, change the patch or generator and include the matching output. Run `bundle exec rake cldr:data:generate_paths` after you add, move, or remove indexed data files.
25
+ - Treat changes to canonical codes, defaults, locale scripts, fallback rules, and validation as API changes. Show the old and new output. Keep historical codes as lookup alternates when appropriate. Test lookup by both codes and check the value the API returns.
26
+ - For postal changes, test old and new formats, normalization, and invalid input. Check that examples match the rule. An example can also affect the reported postal code type. For address layouts, check both `edit` and `show` where applicable. See [Address format strings](docs/address_format_strings.md).
27
+ - Add focused Minitest coverage next to related tests. For country-specific tests in `test/worldwide/regions/`, use `<cc>_test.rb` and a class such as `PaTest`. If shared region data changes, check its effect on the TypeScript package too.
28
+
29
+ ## Run checks
30
+
31
+ Use `.ruby-version` for local setup. Check [`worldwide.gemspec`](worldwide.gemspec) for the supported Ruby minimum and [Ruby CI](.github/workflows/ci.yml) for the test matrix. Do not assume the oldest Ruby in CI is the supported minimum.
32
+
33
+ ```sh
34
+ bundle install
35
+ bundle exec ruby -Itest test/worldwide/regions/pa_test.rb # example focused test
36
+ bin/test
37
+ bin/style
38
+ ```
39
+
40
+ Run `bin/test-cldr-rake-tasks` from a clean checkout to check that the full CLDR pipeline reproduces the committed data. The script downloads data and reports unexpected changes to the working tree.
41
+
42
+ For changes that affect TypeScript, use the Node and pnpm versions in [TypeScript CI](.github/workflows/ci-typescript.yml):
43
+
44
+ ```sh
45
+ cd lang/typescript
46
+ pnpm install
47
+ pnpm typecheck
48
+ pnpm lint
49
+ pnpm test
50
+ pnpm build
51
+ ```
52
+
53
+ ## Open the PR
54
+
55
+ - Use the [PR template](.github/pull_request_template.md). State the problem, why you chose this fix, which behavior changes, and what you tested. Include public sources, a small reproduction, or a before-and-after example when useful.
56
+ - Add an entry under `Unreleased` in [`CHANGELOG.md`](CHANGELOG.md) for every change except routine updates such as dependency bumps. Add the public PR link once it exists. Leave the version bump to the release unless a maintainer asks for both in the same PR.
57
+ - For a TypeScript change that affects package users, add a changeset with `pnpm changeset` from `lang/typescript`. See the [package README](lang/typescript/README.md) for the release process.
data/CHANGELOG.md CHANGED
@@ -29,6 +29,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
29
29
 
30
30
  ---
31
31
 
32
+ ## [2.3.0] - 2026-11-18
33
+
34
+ - Add an `AGENTS.md` contribution guide and document when contributors need a changelog entry. [#686](https://github.com/Shopify/worldwide/pull/686)
35
+ - Add the `postal:codes:import`, `postal:codes:check` and `postal:codes:zone_check` rake tasks. They build and check the `zip_prefixes` and `zips_crossing_provinces` data in `data/regions/<CC>.yml`. [#680](https://github.com/Shopify/worldwide/pull/680)
36
+ - Correct Gabon's default currency from XOF to XAF, as listed in [ISO 4217](https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml). XOF remains supported. [#684](https://github.com/Shopify/worldwide/pull/684)
37
+
38
+ ---
39
+
40
+ ## [2.2.0] - 2026-11-12
41
+
42
+ - The Italian province of Sulcis Iglesiente now uses its current official code `SU`. `CI` stays as a code alternate, so lookups by `CI` still resolve, but `zone.code` now returns `SU`. Its ISO code stays `IT-CI` to keep CLDR's Sulcis Iglesiente names (CLDR's `itsu` is the former Sud Sardegna). [#667](https://github.com/Shopify/worldwide/pull/667)
43
+
44
+ ---
45
+
32
46
  ## [2.1.0] - 2026-11-10
33
47
 
34
48
  - Accept Panama's 10-character postal codes (`XXXXX-XXXXX`, for example `ADC96-M8H44`), as well as the 4-digit codes. `Zip.normalize` puts the hyphen after the 5th character. [#678](https://github.com/Shopify/worldwide/pull/678)
data/Gemfile CHANGED
@@ -26,6 +26,12 @@ group :development do
26
26
  gem "pry-byebug", "< 3.12", require: false
27
27
  end
28
28
 
29
+ # Used by the postal code rake tasks in rake/postal. The gemspec does not package rake/, so the gem does not depend on them.
30
+ group :development, :test do
31
+ gem "csv"
32
+ gem "rubyzip"
33
+ end
34
+
29
35
  group :test do
30
36
  gem "minitest", "~> 5.27"
31
37
  gem "minitest-reporters"
data/Gemfile.lock CHANGED
@@ -13,7 +13,7 @@ GIT
13
13
  PATH
14
14
  remote: .
15
15
  specs:
16
- worldwide (2.1.0)
16
+ worldwide (2.3.0)
17
17
  activesupport (>= 7.0)
18
18
  i18n (>= 1.15)
19
19
  phonelib (~> 0.8)
@@ -43,6 +43,7 @@ GEM
43
43
  coderay (1.1.3)
44
44
  concurrent-ruby (1.3.8)
45
45
  connection_pool (2.5.5)
46
+ csv (3.3.7)
46
47
  drb (2.2.3)
47
48
  i18n (1.15.2)
48
49
  concurrent-ruby (~> 1.0)
@@ -141,6 +142,7 @@ PLATFORMS
141
142
  x86_64-linux
142
143
 
143
144
  DEPENDENCIES
145
+ csv
144
146
  minitest (~> 5.27)
145
147
  minitest-focus
146
148
  minitest-reporters
@@ -155,6 +157,7 @@ DEPENDENCIES
155
157
  rubocop-shopify
156
158
  ruby-cldr!
157
159
  ruby-lsp
160
+ rubyzip
158
161
  worldwide!
159
162
 
160
163
  BUNDLED WITH
data/data/regions/GA.yml CHANGED
@@ -3,7 +3,7 @@ name: Gabon
3
3
  code: GA
4
4
  tax: 0.18
5
5
  tax_name: VAT
6
- currency: XOF
6
+ currency: XAF
7
7
  group: African Countries
8
8
  group_name: Africa
9
9
  unit_system: metric
data/data/regions/IT.yml CHANGED
@@ -262,10 +262,10 @@ zones:
262
262
  tax: 0.0
263
263
  tax_name: VAT
264
264
  neighboring_zones:
265
- - CI
266
265
  - NU
267
266
  - OG
268
267
  - OR
268
+ - SU
269
269
  - VS
270
270
  zip_prefixes:
271
271
  - '08033'
@@ -737,8 +737,8 @@ zones:
737
737
  tax_name: VAT
738
738
  neighboring_zones:
739
739
  - CA
740
- - CI
741
740
  - OR
741
+ - SU
742
742
  zip_prefixes:
743
743
  - '09020' # Collinas, Genuri, Gesturi, Las Plassas, Pauli Arbarei, Pimentel, Samatzai, Siddi, Turri
744
744
  - '09021' # Barumini
@@ -1247,7 +1247,10 @@ zones:
1247
1247
  - '230'
1248
1248
  - '231'
1249
1249
  - name: Sulcis Iglesiente
1250
- code: CI
1250
+ code: SU
1251
+ code_alternates:
1252
+ - CI
1253
+ iso_code: IT-CI
1251
1254
  name_alternates:
1252
1255
  - Carbonia-Iglesias
1253
1256
  tax: 0.0
@@ -1489,18 +1492,18 @@ zips_crossing_provinces:
1489
1492
  - OR
1490
1493
  - VS
1491
1494
  '09010':
1492
- - CI
1495
+ - SU
1493
1496
  - CA
1494
1497
  '09013':
1495
- - CI
1498
+ - SU
1496
1499
  - CA
1497
1500
  - VS
1498
1501
  '09016':
1499
- - CI
1502
+ - SU
1500
1503
  - CA
1501
1504
  - VS
1502
1505
  '09017':
1503
- - CI
1506
+ - SU
1504
1507
  - CA
1505
1508
  '09020':
1506
1509
  - VS
@@ -1511,7 +1514,7 @@ zips_crossing_provinces:
1511
1514
  '09027':
1512
1515
  - VS
1513
1516
  - CA
1514
- - CI
1517
+ - SU
1515
1518
  '09030':
1516
1519
  - VS
1517
1520
  - CA
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Worldwide
4
- VERSION = "2.1.0"
4
+ VERSION = "2.3.0"
5
5
  end