worldwide 1.6.0 → 1.6.1

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: 7c70554af66bc0686a4ba343a4a2e1ca0e428cdd57d419603db9b81607ccd10c
4
- data.tar.gz: afb662939d26b5652229aac5ad63ff57b09788ce22ecdb0b1b571aa48f95c20a
3
+ metadata.gz: 6439152c0928ca18a49226e1c5599650d7210c5d83af3e40bb191a4e85f47cab
4
+ data.tar.gz: 111d418809e5ff56b7db3be7e8e55ea89cd7b42ef12632066e1d19fdfd51c59a
5
5
  SHA512:
6
- metadata.gz: 4bca890d9434db080cca3ae4c1b9d7207067e2a9e22be72ced153131985e0fedeaca38174f134b06ba76b05fef208d78a4b8c9c8246628711b46eb3fc09f54b2
7
- data.tar.gz: ded58fdc0ace5a3b2c8b11ded6b6cd2089114565a9b67581cd7f85c84d5a9809b35a22bc8f868c9884ca76f512330feb64b444e8a09674c60a2299c4adf24406
6
+ metadata.gz: f6ee99e6b31eddeb9f4de313395b753de498452ee8fe1ad4084727c3b774b77e008c0d78b2cf5e3e69bc7babc939ed98ca53ceed85cdbd7c261bb6da4bf4380e
7
+ data.tar.gz: 13dcb17108427445feb73e9bffb99ce327ac24d5e2f58a60bf1d89088ee64c57a6f02a07b4bff377503b87f037e50bd3c50f05538b12c85b028291b49ac94af1
@@ -17,6 +17,8 @@ jobs:
17
17
  steps:
18
18
  - name: Checkout Repo
19
19
  uses: actions/checkout@v3
20
+ with:
21
+ token: ${{ secrets.SHOPIFY_GH_ACCESS_TOKEN }}
20
22
  - name: Setup Node
21
23
  uses: actions/setup-node@v3
22
24
  with:
@@ -33,6 +35,8 @@ jobs:
33
35
  with:
34
36
  publish: pnpm release
35
37
  cwd: lang/typescript
38
+ title: Version NPM Package
39
+ commit: Version NPM Package
36
40
  env:
37
41
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
38
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42
+ GITHUB_TOKEN: ${{ secrets.SHOPIFY_GH_ACCESS_TOKEN }}
data/CHANGELOG.md CHANGED
@@ -29,6 +29,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
29
29
 
30
30
  ---
31
31
 
32
+ ## [1.6.1] - 2024-07-03
33
+ - Move Units constants `SUPPORTED_HUMANIZATIONS` and `MEASUREMENT_KEYS` to `Worldwide.units.supported_humanizations` and `Worldwide.units.measurement_keys` [#240](https://github.com/Shopify/worldwide/pull/240)
34
+ - Allow house numbers on address2 for Japan [#245](https://github.com/Shopify/worldwide/pull/245)
35
+
32
36
  ## [1.6.0] - 2024-06-21
33
37
  - Support multiple script-based address concatenation rules for each country [#224](https://github.com/Shopify/worldwide/pull/224)
34
38
  - Fixed a typo in list of supported scripts from `Latn` to `Latin`
@@ -39,7 +43,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
39
43
  ## [1.4.1] - 2024-06-17
40
44
  - Add translations for neighborhood error strings in AE, CR, KW, PA, PE, SA [#220](https://github.com/Shopify/worldwide/pull/220)
41
45
 
42
-
43
46
  ## [1.4.0] - 2024-06-14
44
47
  - Add localized error strings for neighborhood in AE, CR, KW, PA, PE, SA [#215](https://github.com/Shopify/worldwide/pull/215)
45
48
  - Change delimiter from Non-Breaking Space to Word Joiner [#221](https://github.com/Shopify/worldwide/pull/221)
data/Gemfile.lock CHANGED
@@ -13,7 +13,7 @@ GIT
13
13
  PATH
14
14
  remote: .
15
15
  specs:
16
- worldwide (1.6.0)
16
+ worldwide (1.6.1)
17
17
  activesupport (>= 7.0)
18
18
  i18n
19
19
  phonelib (~> 0.8)
@@ -126,6 +126,7 @@ GEM
126
126
  PLATFORMS
127
127
  arm64-darwin-21
128
128
  arm64-darwin-22
129
+ arm64-darwin-23
129
130
  x86_64-linux
130
131
 
131
132
  DEPENDENCIES
data/README.md CHANGED
@@ -74,10 +74,17 @@ I18n.enforce_available_locales = false
74
74
 
75
75
  Here the list of the features we currently support:
76
76
 
77
- - [šŸŒ Regions](#--regions-countries--territories--subdivisions--states--provinces--prefectures--etc)
77
+ - [šŸŒ Regions (Countries / Territories / Subdivisions / States / Provinces / Prefectures / etc.)](#--regions-countries--territories--subdivisions--states--provinces--prefectures--etc)
78
+ - [Regional Validations](#regional-validations)
79
+ - [Phone Validations](#phone-validations)
78
80
  - [šŸ“« Addresses](#--addresses)
81
+ - [Formatting](#formatting)
82
+ - [Validation](#validation)
83
+ - [Auto-correction](#auto-correction)
79
84
  - [šŸ—“ / ⌚ Date and Time formats](#-----date-and-time-formats)
85
+ - [Calendar quarter formatting](#calendar-quarter-formatting)
80
86
  - [šŸ“… Calendar Information](#--calendar-information)
87
+ - [Month and Weekday labels](#month-and-weekday-labels)
81
88
  - [šŸ•° Localized Timezone](#--localized-timezone)
82
89
  - [āž”šŸ•° Map Deprecated Timezone Name to Modern Name](#--map-deprecated-timezone-name-to-modern-name)
83
90
  - [šŸ‘„ Names](#--names)
@@ -898,7 +905,7 @@ This module provides localized measurement unit formatting.
898
905
 
899
906
  `Units.format` supports the following arguments:
900
907
  - `amount`: the amount associated with the unit. This parameter is used to apply the unique pluralization rules of the requested locale.
901
- - `unit`: the measurement unit. Currently, only the keys listed in [`Worldwide::MEASUREMENT_KEYS`](https://github.com/Shopify/worldwide/blob/main/lib/worldwide/units.rb#L9-L51) are supported.
908
+ - `unit`: the measurement unit. The keys listed in [`Worldwide.Units.measurement_keys`](https://github.com/Shopify/worldwide/blob/main/lib/worldwide/units.rb#L23-L70) are supported.
902
909
  - `humanize`: can be `:long` or `:short`. `:long` returns the translated word of the unit. `:short` returns the localized abbreviation of the unit. The default value is `:short`.
903
910
 
904
911
  ```ruby
@@ -13,6 +13,7 @@ zip_regex: "\\A怒?(\\d{7}|[0-9|0-ļ¼™]{3}(-|ー)[0-9|0-ļ¼™]{4})\\z"
13
13
  partial_zip_regex: "\\A怒?([0-9|0-ļ¼™]{0,3})(-|ー?)([0-9|0-ļ¼™]{0,4})\\z"
14
14
  phone_number_prefix: 81
15
15
  building_number_required: true
16
+ building_number_may_be_in_address2: true
16
17
  week_start_day: sunday
17
18
  languages:
18
19
  - en
@@ -1,69 +1,73 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Worldwide
4
- SUPPORTED_HUMANIZATIONS = {
5
- short: :short,
6
- long: :long,
7
- }.freeze
8
-
9
- MEASUREMENT_KEYS = {
10
- millimeter: :length_millimeter,
11
- millimeters: :length_millimeter,
12
- centimeter: :length_centimeter,
13
- centimeters: :length_centimeter,
14
- foot: :length_foot,
15
- feet: :length_foot,
16
- inch: :length_inch,
17
- inches: :length_inch,
18
- meter: :length_meter,
19
- meters: :length_meter,
20
- gram: :mass_gram,
21
- grams: :mass_gram,
22
- kilogram: :mass_kilogram,
23
- kilograms: :mass_kilogram,
24
- ounce: :mass_ounce,
25
- ounces: :mass_ounce,
26
- pound: :mass_pound,
27
- pounds: :mass_pound,
28
- centiliter: :volume_centiliter,
29
- centiliters: :volume_centiliter,
30
- cubic_meter: :volume_cubic_meter,
31
- cubic_meters: :volume_cubic_meter,
32
- imperial_fluid_ounce: :volume_fluid_ounce_imperial,
33
- imperial_fluid_ounces: :volume_fluid_ounce_imperial,
34
- fluid_ounce: :volume_fluid_ounce,
35
- fluid_ounces: :volume_fluid_ounce,
36
- imperial_gallon: :volume_gallon_imperial,
37
- imperial_gallons: :volume_gallon_imperial,
38
- gallon: :volume_gallon,
39
- gallons: :volume_gallon,
40
- liter: :volume_liter,
41
- liters: :volume_liter,
42
- milliliter: :volume_milliliter,
43
- milliliters: :volume_milliliter,
44
- pint: :volume_pint,
45
- pints: :volume_pint,
46
- imperial_pint: :volume_pint_imperial,
47
- imperial_pints: :volume_pint_imperial,
48
- quart: :volume_quart,
49
- quarts: :volume_quart,
50
- imperial_quart: :volume_quart_imperial,
51
- imperial_quarts: :volume_quart_imperial,
52
- yard: :length_yard,
53
- yards: :length_yard,
54
- }.freeze
55
-
56
4
  class Units
57
5
  class << self
58
6
  def format(amount, unit, humanize: :short)
59
- supported_humanization = SUPPORTED_HUMANIZATIONS[humanize.to_sym]
7
+ supported_humanization = supported_humanizations[humanize.to_sym]
60
8
  raise ArgumentError, "Unsupported value for `humanize`: #{humanize}." unless supported_humanization
61
9
 
62
- measurement_key = MEASUREMENT_KEYS[unit.to_sym]
10
+ measurement_key = measurement_keys[unit.to_sym]
63
11
  raise ArgumentError, "Unsupported value for `unit`: #{unit}." unless measurement_key
64
12
 
65
13
  Cldr.t("units.unit_length.#{supported_humanization}.#{measurement_key}", count: amount)
66
14
  end
15
+
16
+ def supported_humanizations
17
+ {
18
+ short: :short,
19
+ long: :long,
20
+ }.freeze
21
+ end
22
+
23
+ def measurement_keys
24
+ {
25
+ millimeter: :length_millimeter,
26
+ millimeters: :length_millimeter,
27
+ centimeter: :length_centimeter,
28
+ centimeters: :length_centimeter,
29
+ foot: :length_foot,
30
+ feet: :length_foot,
31
+ inch: :length_inch,
32
+ inches: :length_inch,
33
+ meter: :length_meter,
34
+ meters: :length_meter,
35
+ gram: :mass_gram,
36
+ grams: :mass_gram,
37
+ kilogram: :mass_kilogram,
38
+ kilograms: :mass_kilogram,
39
+ ounce: :mass_ounce,
40
+ ounces: :mass_ounce,
41
+ pound: :mass_pound,
42
+ pounds: :mass_pound,
43
+ centiliter: :volume_centiliter,
44
+ centiliters: :volume_centiliter,
45
+ cubic_meter: :volume_cubic_meter,
46
+ cubic_meters: :volume_cubic_meter,
47
+ imperial_fluid_ounce: :volume_fluid_ounce_imperial,
48
+ imperial_fluid_ounces: :volume_fluid_ounce_imperial,
49
+ fluid_ounce: :volume_fluid_ounce,
50
+ fluid_ounces: :volume_fluid_ounce,
51
+ imperial_gallon: :volume_gallon_imperial,
52
+ imperial_gallons: :volume_gallon_imperial,
53
+ gallon: :volume_gallon,
54
+ gallons: :volume_gallon,
55
+ liter: :volume_liter,
56
+ liters: :volume_liter,
57
+ milliliter: :volume_milliliter,
58
+ milliliters: :volume_milliliter,
59
+ pint: :volume_pint,
60
+ pints: :volume_pint,
61
+ imperial_pint: :volume_pint_imperial,
62
+ imperial_pints: :volume_pint_imperial,
63
+ quart: :volume_quart,
64
+ quarts: :volume_quart,
65
+ imperial_quart: :volume_quart_imperial,
66
+ imperial_quarts: :volume_quart_imperial,
67
+ yard: :length_yard,
68
+ yards: :length_yard,
69
+ }.freeze
70
+ end
67
71
  end
68
72
  end
69
73
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Worldwide
4
- VERSION = "1.6.0"
4
+ VERSION = "1.6.1"
5
5
  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.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-21 00:00:00.000000000 Z
11
+ date: 2024-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -8490,7 +8490,7 @@ licenses: []
8490
8490
  metadata:
8491
8491
  allowed_push_host: https://rubygems.org/
8492
8492
  changelog_uri: https://github.com/Shopify/worldwide/blob/main/CHANGELOG.md
8493
- post_install_message:
8493
+ post_install_message:
8494
8494
  rdoc_options: []
8495
8495
  require_paths:
8496
8496
  - lib
@@ -8505,8 +8505,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
8505
8505
  - !ruby/object:Gem::Version
8506
8506
  version: '0'
8507
8507
  requirements: []
8508
- rubygems_version: 3.5.13
8509
- signing_key:
8508
+ rubygems_version: 3.5.14
8509
+ signing_key:
8510
8510
  specification_version: 4
8511
8511
  summary: Internationalization and localization APIs
8512
8512
  test_files: []