worldwide 0.3.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -1
  3. data/Gemfile.lock +1 -1
  4. data/data/other/timezones/bg-BG.yml +1 -0
  5. data/data/other/timezones/cs.yml +1 -0
  6. data/data/other/timezones/da.yml +1 -0
  7. data/data/other/timezones/de.yml +1 -0
  8. data/data/other/timezones/el.yml +1 -0
  9. data/data/other/timezones/en.yml +1 -0
  10. data/data/other/timezones/es.yml +1 -0
  11. data/data/other/timezones/fi.yml +1 -0
  12. data/data/other/timezones/fr.yml +1 -0
  13. data/data/other/timezones/hi.yml +1 -0
  14. data/data/other/timezones/hr-HR.yml +1 -0
  15. data/data/other/timezones/hu.yml +1 -0
  16. data/data/other/timezones/id.yml +1 -0
  17. data/data/other/timezones/it.yml +1 -0
  18. data/data/other/timezones/ja.yml +1 -0
  19. data/data/other/timezones/ko.yml +1 -0
  20. data/data/other/timezones/lt-LT.yml +1 -0
  21. data/data/other/timezones/nb.yml +1 -0
  22. data/data/other/timezones/nl.yml +1 -0
  23. data/data/other/timezones/pl.yml +1 -0
  24. data/data/other/timezones/pt-BR.yml +1 -0
  25. data/data/other/timezones/pt-PT.yml +1 -0
  26. data/data/other/timezones/ro-RO.yml +1 -0
  27. data/data/other/timezones/ru.yml +1 -0
  28. data/data/other/timezones/sk-SK.yml +1 -0
  29. data/data/other/timezones/sl-SI.yml +1 -0
  30. data/data/other/timezones/sv.yml +1 -0
  31. data/data/other/timezones/th.yml +1 -0
  32. data/data/other/timezones/tr.yml +1 -0
  33. data/data/other/timezones/vi.yml +1 -0
  34. data/data/other/timezones/zh-CN.yml +1 -0
  35. data/data/other/timezones/zh-TW.yml +1 -0
  36. data/db/data/regions/AT.yml +1 -0
  37. data/db/data/regions/AW.yml +2 -0
  38. data/db/data/regions/AX.yml +3 -0
  39. data/db/data/regions/BL.yml +2 -0
  40. data/db/data/regions/BQ.yml +2 -0
  41. data/db/data/regions/CW.yml +2 -0
  42. data/db/data/regions/GF.yml +3 -0
  43. data/db/data/regions/GP.yml +4 -0
  44. data/db/data/regions/HK.yml +3 -0
  45. data/db/data/regions/IT.yml +4 -0
  46. data/db/data/regions/MF.yml +2 -0
  47. data/db/data/regions/MO.yml +3 -0
  48. data/db/data/regions/MQ.yml +3 -0
  49. data/db/data/regions/NC.yml +2 -0
  50. data/db/data/regions/PF.yml +2 -0
  51. data/db/data/regions/PM.yml +2 -0
  52. data/db/data/regions/RE.yml +4 -0
  53. data/db/data/regions/SJ.yml +2 -0
  54. data/db/data/regions/SX.yml +2 -0
  55. data/db/data/regions/TF.yml +2 -0
  56. data/db/data/regions/TW.yml +3 -0
  57. data/db/data/regions/UM.yml +2 -0
  58. data/db/data/regions/US.yml +12 -0
  59. data/db/data/regions/WF.yml +2 -0
  60. data/db/data/regions/YT.yml +4 -0
  61. data/lib/worldwide/region.rb +5 -1
  62. data/lib/worldwide/regions.rb +3 -11
  63. data/lib/worldwide/regions_loader.rb +35 -1
  64. data/lib/worldwide/version.rb +1 -1
  65. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70f7f2806122734340656c024d816ec4028060de514b5dc4773529ce8bff4f37
4
- data.tar.gz: 3c5c2237879ab05f1a77505432bca89ad50e9d5667ff1d1951b501c07f43050e
3
+ metadata.gz: 6a9594ba5a0791de7841a1b420eb2035d7e426c407815a7b308cf19946a0c36e
4
+ data.tar.gz: 4b91f4790718a7f1c5023c08d39fe6dbea86c4b00a4a6406fef6eb94327c10f4
5
5
  SHA512:
6
- metadata.gz: 1f8e9fa1416ccc24d3818e609acf7d05da6534cdb9b1e780af496151559bbb5e73540df416d85d554a3083a5add5691df2ab512fa023da3ca43d85251a89c18d
7
- data.tar.gz: d55d1ed819560e45099c6ae1fc9e1cc5f62e0a6b62c4e9b24aa97daa78b7aae0e6cb8636dc0b6086ca5ba7f3a715badc0e7d4c60ddde09df49cb2b2c00677e8c
6
+ metadata.gz: a7df4373be3cf1f576c9ea97d2a1c6db1a9e0742d9e5c1ae955059efde1618f09566303e4e038c56ef653a308e67c38f3d3e94b7b60f46b5441f471f07fb59c5
7
+ data.tar.gz: fc7f50b224674162e79e7178fd8f84e36dc99582ef0ebab5b9fc1c848d9b32f06ca20a1f12a7c9a909d6382cea3e970ab16227d3e34256944200d21498d9ff74
data/CHANGELOG.md CHANGED
@@ -1,10 +1,13 @@
1
1
  # Changelog
2
+
2
3
  All notable changes to this project will be documented in this file.
3
4
 
4
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
6
 
6
7
  ## How do I make a good changelog?
8
+
7
9
  ### Guiding Principles
10
+
8
11
  - Changelogs are for humans, not machines.
9
12
  - There should be an entry for every single version.
10
13
  - The same types of changes should be grouped.
@@ -28,7 +31,20 @@ Nil.
28
31
 
29
32
  ---
30
33
 
34
+ [0.4.1] - 2023-11-10
35
+ - Add support for deprecated timezone Australia/Canberra [#35](https://github.com/Shopify/worldwide/pull/35)
36
+ - Add alternate codes for territories [#39](https://github.com/Shopify/worldwide/pull/39)
37
+ - Allow building numbers on address2 field for Austrian addresses [#40](https://github.com/Shopify/worldwide/pull/40)
38
+ - Add zone name alternates for Italy [#42](https://github.com/Shopify/worldwide/pull/35)
39
+
40
+ [0.4.0] - 2023-11-08
41
+
42
+ - Add region name alternates [#32](https://github.com/Shopify/worldwide/pull/32)
43
+ - Cache `Region#parent_name` [#33](https://github.com/Shopify/worldwide/pull/33)
44
+ - Use hash tables to look up regions by code [#36](https://github.com/Shopify/worldwide/pull/36)
45
+
31
46
  [0.3.0] - 2023-11-03
47
+
32
48
  - Add code alternates for Japan [#23](https://github.com/Shopify/worldwide/pull/23)
33
49
  - Add code alternates for Puerto Rico [#24](https://github.com/Shopify/worldwide/pull/24)
34
50
  - Record multiple parents per region [#27](https://github.com/Shopify/worldwide/pull/27)
@@ -37,7 +53,6 @@ Nil.
37
53
  [#29](https://github.com/Shopify/worldwide/pull/29)
38
54
  - Handle ISO_CODE only zones lookup [#26](https://github.com/Shopify/worldwide/pull/26)
39
55
 
40
-
41
56
  [0.2.0] - 2023-11-01
42
57
 
43
58
  - Add Region#group and Region#group_name [#15](https://github.com/Shopify/worldwide/pull/15)
data/Gemfile.lock CHANGED
@@ -13,7 +13,7 @@ GIT
13
13
  PATH
14
14
  remote: .
15
15
  specs:
16
- worldwide (0.3.0)
16
+ worldwide (0.4.1)
17
17
  activesupport (~> 7.0)
18
18
  i18n (~> 1.12.0)
19
19
  phonelib (~> 0.8)
@@ -121,6 +121,7 @@ bg-BG:
121
121
  Pacific/Guam: "(GMT+10:00) Гуам"
122
122
  Australia/Hobart: "(GMT+10:00) Хобарт"
123
123
  Australia/Melbourne: "(GMT+10:00) Канбера, Мелбърн"
124
+ Australia/Canberra: "(GMT+10:00) Канбера, Мелбърн"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Порт Морсби"
125
126
  Australia/Sydney: "(GMT+10:00) Сидни"
126
127
  Asia/Vladivostok: "(GMT+10:00) Владивосток"
@@ -121,6 +121,7 @@ cs:
121
121
  Pacific/Guam: "(GMT+10:00) Guam"
122
122
  Australia/Hobart: "(GMT+10:00) Hobart"
123
123
  Australia/Melbourne: "(GMT+10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT+10:00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Port Moresby"
125
126
  Australia/Sydney: "(GMT+10:00) Sydney"
126
127
  Asia/Vladivostok: "(GMT+10:00) Vladivostok"
@@ -121,6 +121,7 @@ da:
121
121
  Pacific/Guam: "(GMT+10:00) Guam"
122
122
  Australia/Hobart: "(GMT+10:00) Hobart"
123
123
  Australia/Melbourne: "(GMT+10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT+10:00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Port Moresby"
125
126
  Australia/Sydney: "(GMT+10:00) Sydney"
126
127
  Asia/Vladivostok: "(GMT+10:00) Vladivostok"
@@ -121,6 +121,7 @@ de:
121
121
  Pacific/Guam: "(GMT+10:00) Guam"
122
122
  Australia/Hobart: "(GMT+10:00) Hobart"
123
123
  Australia/Melbourne: "(GMT+10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT+10:00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Port Moresby"
125
126
  Australia/Sydney: "(GMT+10:00) Sydney"
126
127
  Asia/Vladivostok: "(GMT+10:00) Wladiwostok"
@@ -121,6 +121,7 @@ el:
121
121
  Pacific/Guam: "(GMT+10:00) Γκουάμ"
122
122
  Australia/Hobart: "(GMT+10:00) Χόμπαρτ"
123
123
  Australia/Melbourne: "(GMT+10:00) Καμπέρα, Μελβούρνη"
124
+ Australia/Canberra: "(GMT+10:00) Καμπέρα, Μελβούρνη"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Πορτ Μόρεσμπι"
125
126
  Australia/Sydney: "(GMT+10:00) Σίδνεϊ"
126
127
  Asia/Vladivostok: "(GMT+10:00) Βλαδιβοστόκ"
@@ -121,6 +121,7 @@ en:
121
121
  Pacific/Guam: "(GMT+10:00) Guam"
122
122
  Australia/Hobart: "(GMT+10:00) Hobart"
123
123
  Australia/Melbourne: "(GMT+10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT+10:00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Port Moresby"
125
126
  Australia/Sydney: "(GMT+10:00) Sydney"
126
127
  Asia/Vladivostok: "(GMT+10:00) Vladivostok"
@@ -121,6 +121,7 @@ es:
121
121
  Pacific/Guam: "(GMT+10:00) Guam"
122
122
  Australia/Hobart: "(GMT+10:00) Hobart"
123
123
  Australia/Melbourne: "(GMT+10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT+10:00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Puerto Moresby"
125
126
  Australia/Sydney: "(GMT+10:00) Sídney"
126
127
  Asia/Vladivostok: "(GMT+10:00) Vladivostok"
@@ -121,6 +121,7 @@ fi:
121
121
  Pacific/Guam: "(GMT+10:00) Guam"
122
122
  Australia/Hobart: "(GMT+10:00) Hobart"
123
123
  Australia/Melbourne: "(GMT+10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT+10:00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Port Moresby"
125
126
  Australia/Sydney: "(GMT+10:00) Sydney"
126
127
  Asia/Vladivostok: "(GMT+10:00) Vladivostok"
@@ -121,6 +121,7 @@ fr:
121
121
  Pacific/Guam: "(GMT + 10:00) Guam"
122
122
  Australia/Hobart: "(GMT + 10:00) Hobart"
123
123
  Australia/Melbourne: "(GMT + 10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT + 10:00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT + 10:00) Port Moresby"
125
126
  Australia/Sydney: "(GMT + 10:00) Sydney"
126
127
  Asia/Vladivostok: "(GMT + 10:00) Vladivostok"
@@ -121,6 +121,7 @@ hi:
121
121
  Pacific/Guam: "(GMT+10:00) गुआम"
122
122
  Australia/Hobart: "(GMT+10:00) होबार्ट"
123
123
  Australia/Melbourne: "(GMT+10:00) कैनबरा, मेलबर्न"
124
+ Australia/Canberra: "(GMT+10:00) कैनबरा, मेलबर्न"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) पोर्ट मोरेस्बी"
125
126
  Australia/Sydney: "(GMT+10:00) सिडनी"
126
127
  Asia/Vladivostok: "(GMT+10:00) व्लादिवोस्तोक"
@@ -121,6 +121,7 @@ hr-HR:
121
121
  Pacific/Guam: "(GMT+10:00) Guam"
122
122
  Australia/Hobart: "(GMT+10:00) Hobart"
123
123
  Australia/Melbourne: "(GMT+10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT+10:00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Port Moresby"
125
126
  Australia/Sydney: "(GMT+10:00) Sydney"
126
127
  Asia/Vladivostok: "(GMT+10:00) Vladivostok"
@@ -121,6 +121,7 @@ hu:
121
121
  Pacific/Guam: "(GMT + 10: 00) Guam"
122
122
  Australia/Hobart: "(GMT + 10: 00) Hobart"
123
123
  Australia/Melbourne: "(GMT + 10: 00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT + 10: 00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT + 10: 00) Port Moresby"
125
126
  Australia/Sydney: "(GMT + 10: 00) Sydney"
126
127
  Asia/Vladivostok: "(GMT + 10: 00) Vlagyivosztok"
@@ -121,6 +121,7 @@ id:
121
121
  Pacific/Guam: "(GMT+10:00) Guam"
122
122
  Australia/Hobart: "(GMT+10:00) Hobart"
123
123
  Australia/Melbourne: "(GMT+10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT+10:00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Port Moresby"
125
126
  Australia/Sydney: "(GMT+10:00) Sydney"
126
127
  Asia/Vladivostok: "(GMT+10:00) Vladivostok"
@@ -121,6 +121,7 @@ it:
121
121
  Pacific/Guam: "(UTC+10:00) Guam"
122
122
  Australia/Hobart: "(UTC+10:00) Hobart"
123
123
  Australia/Melbourne: "(UTC+10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(UTC+10:00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(UTC+10:00) Port Moresby"
125
126
  Australia/Sydney: "(UTC+10:00) Sydney"
126
127
  Asia/Vladivostok: "(UTC+10:00) Vladivostok"
@@ -121,6 +121,7 @@ ja:
121
121
  Pacific/Guam: "(GMT+10:00) グアム"
122
122
  Australia/Hobart: "(GMT+10:00) ホバート"
123
123
  Australia/Melbourne: "(GMT+10:00) キャンベラ、メルボルン"
124
+ Australia/Canberra: "(GMT+10:00) キャンベラ、メルボルン"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) ポートモレスビー"
125
126
  Australia/Sydney: "(GMT+10:00) シドニー"
126
127
  Asia/Vladivostok: "(GMT+10:00) ウラジオストク"
@@ -121,6 +121,7 @@ ko:
121
121
  Pacific/Guam: "(GMT + 10 : 00) 괌"
122
122
  Australia/Hobart: "(GMT + 10 : 00) 호바트"
123
123
  Australia/Melbourne: "(GMT + 10 : 00) 캔버라, 멜버른"
124
+ Australia/Canberra: "(GMT + 10 : 00) 캔버라, 멜버른"
124
125
  Pacific/Port_Moresby: "(GMT + 10 : 00) 포트모르즈비"
125
126
  Australia/Sydney: "(GMT + 10 : 00) 시드니"
126
127
  Asia/Vladivostok: "(GMT + 10 : 00) 블라디보스토크"
@@ -121,6 +121,7 @@ lt-LT:
121
121
  Pacific/Guam: "(GMT+10:00) Guamas"
122
122
  Australia/Hobart: "(GMT+10:00) Hobartas"
123
123
  Australia/Melbourne: "(GMT+10:00) Kanbera, Melburnas"
124
+ Australia/Canberra: "(GMT+10:00) Kanbera, Melburnas"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Port Morsbis"
125
126
  Australia/Sydney: "(GMT+10:00) Sidnėjus"
126
127
  Asia/Vladivostok: "(GMT+10:00) Vladivostokas"
@@ -121,6 +121,7 @@ nb:
121
121
  Pacific/Guam: "(GMT+10:00) Guam"
122
122
  Australia/Hobart: "(GMT+10:00) Hobart"
123
123
  Australia/Melbourne: "(GMT+10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT+10:00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Port Moresby"
125
126
  Australia/Sydney: "(GMT+10:00) Sydney"
126
127
  Asia/Vladivostok: "(GMT+10:00) Vladivostok"
@@ -121,6 +121,7 @@ nl:
121
121
  Pacific/Guam: "(GMT + 10: 00) Guam"
122
122
  Australia/Hobart: "(GMT + 10: 00) Hobart"
123
123
  Australia/Melbourne: "(GMT+10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT+10:00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Port Moresby"
125
126
  Australia/Sydney: "(GMT+10:00) Sydney"
126
127
  Asia/Vladivostok: "(GMT+10:00) Vladivostok"
@@ -121,6 +121,7 @@ pl:
121
121
  Pacific/Guam: "(GMT + 10: 00) Guam"
122
122
  Australia/Hobart: "(GMT + 10: 00) Hobart"
123
123
  Australia/Melbourne: "(GMT + 10: 00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT + 10: 00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT + 10: 00) Port Moresby"
125
126
  Australia/Sydney: "(GMT + 10: 00) Sydney"
126
127
  Asia/Vladivostok: "(GMT + 10: 00) Władywostok"
@@ -121,6 +121,7 @@ pt-BR:
121
121
  Pacific/Guam: "(GMT+10:00) Guam"
122
122
  Australia/Hobart: "(GMT+10:00) Hobart"
123
123
  Australia/Melbourne: "(GMT+10:00) Camberra, Melbourne"
124
+ Australia/Canberra: "(GMT+10:00) Camberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Port Moresby"
125
126
  Australia/Sydney: "(GMT+10:00) Sydney"
126
127
  Asia/Vladivostok: "(GMT+10:00) Vladivostok"
@@ -121,6 +121,7 @@ pt-PT:
121
121
  Pacific/Guam: "(GMT+10:00) Guam"
122
122
  Australia/Hobart: "(GMT+10:00) Hobart"
123
123
  Australia/Melbourne: "(GMT+10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT+10:00) Camberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Port Moresby"
125
126
  Australia/Sydney: "(GMT+10:00) Sydney"
126
127
  Asia/Vladivostok: "(GMT+10:00) Vladivostok"
@@ -121,6 +121,7 @@ ro-RO:
121
121
  Pacific/Guam: "(GMT+10:00) Guam"
122
122
  Australia/Hobart: "(GMT+10:00) Hobart"
123
123
  Australia/Melbourne: "(GMT+10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT+10:00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Port Moresby"
125
126
  Australia/Sydney: "(GMT+10:00) Sydney"
126
127
  Asia/Vladivostok: "(GMT+10:00) Vladivostok"
@@ -121,6 +121,7 @@ ru:
121
121
  Pacific/Guam: "(GMT+10:00) Гуам"
122
122
  Australia/Hobart: "(GMT+10:00) Хобарт"
123
123
  Australia/Melbourne: "(GMT+10:00) Канберра, Мельбурн"
124
+ Australia/Canberra: "(GMT+10:00) Канберра, Мельбурн"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Порт-Морсби"
125
126
  Australia/Sydney: "(GMT+10:00) Сидней"
126
127
  Asia/Vladivostok: "(GMT+10:00) Владивосток"
@@ -121,6 +121,7 @@ sk-SK:
121
121
  Pacific/Guam: "(GMT+10:00) Guam"
122
122
  Australia/Hobart: "(GMT+10:00) Hobart"
123
123
  Australia/Melbourne: "(GMT+10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT+10:00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Port Moresby"
125
126
  Australia/Sydney: "(GMT+10:00) Sydney"
126
127
  Asia/Vladivostok: "(GMT+10:00) Vladivostok"
@@ -121,6 +121,7 @@ sl-SI:
121
121
  Pacific/Guam: "(GMT+10:00) Guam"
122
122
  Australia/Hobart: "(GMT+10:00) Hobart"
123
123
  Australia/Melbourne: "(GMT+10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT+10:00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Port Moresby"
125
126
  Australia/Sydney: "(GMT+10:00) Sydney"
126
127
  Asia/Vladivostok: "(GMT+10:00) Vladivostok"
@@ -121,6 +121,7 @@ sv:
121
121
  Pacific/Guam: "(GMT+10:00) Guam"
122
122
  Australia/Hobart: "(GMT+10:00) Hobart"
123
123
  Australia/Melbourne: "(GMT+10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT+10:00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Port Moresby"
125
126
  Australia/Sydney: "(GMT+10:00) Sydney"
126
127
  Asia/Vladivostok: "(GMT+10:00) Vladivostok"
@@ -121,6 +121,7 @@ th:
121
121
  Pacific/Guam: "(GMT+10:00) กวม"
122
122
  Australia/Hobart: "(GMT+10:00) โฮบาร์ต"
123
123
  Australia/Melbourne: "(GMT+10:00) แคนเบอร์รา, เมลเบิร์น"
124
+ Australia/Canberra: "(GMT+10:00) แคนเบอร์รา, เมลเบิร์น"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) พอร์ตมอร์สบี"
125
126
  Australia/Sydney: "(GMT+10:00) ซิดนีย์"
126
127
  Asia/Vladivostok: "(GMT+10:00) วลาดีวอสตอค"
@@ -121,6 +121,7 @@ tr:
121
121
  Pacific/Guam: "(GMT+10:00) Guam"
122
122
  Australia/Hobart: "(GMT+10:00) Hobart"
123
123
  Australia/Melbourne: "(GMT+10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT+10:00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Port Moresby"
125
126
  Australia/Sydney: "(GMT+10:00) Sidney"
126
127
  Asia/Vladivostok: "(GMT+10:00) Vladivostok"
@@ -121,6 +121,7 @@ vi:
121
121
  Pacific/Guam: "(GMT+10:00) Guam"
122
122
  Australia/Hobart: "(GMT+10:00) Hobart"
123
123
  Australia/Melbourne: "(GMT+10:00) Canberra, Melbourne"
124
+ Australia/Canberra: "(GMT+10:00) Canberra, Melbourne"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) Port Moresby"
125
126
  Australia/Sydney: "(GMT+10:00) Sydney"
126
127
  Asia/Vladivostok: "(GMT+10:00) Vladivostok"
@@ -121,6 +121,7 @@ zh-CN:
121
121
  Pacific/Guam: "(GMT+10:00) 关岛"
122
122
  Australia/Hobart: "(GMT+10:00) 霍巴特"
123
123
  Australia/Melbourne: "(GMT+10:00) 堪培拉、墨尔本"
124
+ Australia/Canberra: "(GMT+10:00) 堪培拉、墨尔本"
124
125
  Pacific/Port_Moresby: "(GMT+10:00) 莫尔兹比港"
125
126
  Australia/Sydney: "(GMT+10:00) 悉尼"
126
127
  Asia/Vladivostok: "(GMT+10:00) 符拉迪沃斯托克"
@@ -121,6 +121,7 @@ zh-TW:
121
121
  Pacific/Guam: "(格林威治標準時間加 10 個小時)關島"
122
122
  Australia/Hobart: "(格林威治標準時間加 10 個小時)霍巴特"
123
123
  Australia/Melbourne: "(格林威治標準時間加 10 個小時)坎培拉,墨爾本"
124
+ Australia/Canberra: "(格林威治標準時間加 10 個小時)坎培拉,墨爾本"
124
125
  Pacific/Port_Moresby: "(格林威治標準時間加 10 個小時)莫爾斯貝港"
125
126
  Australia/Sydney: "(格林威治標準時間加 10 個小時)雪梨"
126
127
  Asia/Vladivostok: "(格林威治標準時間加 10 個小時)海參崴"
@@ -14,6 +14,7 @@ zip_example: '1010'
14
14
  zip_regex: "^((AT?( |-)?)?[1-9]\\d{3})$"
15
15
  phone_number_prefix: 43
16
16
  building_number_required: true
17
+ building_number_may_be_in_address2: true
17
18
  languages:
18
19
  - de
19
20
  - en
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: Aruba
3
3
  code: AW
4
+ code_alternates:
5
+ - NL-AW
4
6
  tax: 0.03
5
7
  currency: AWG
6
8
  unit_system: metric
@@ -1,6 +1,9 @@
1
1
  ---
2
2
  name: Aland Islands
3
3
  code: AX
4
+ code_alternates:
5
+ - FI-AX
6
+ - FI-01
4
7
  tax: 0.0
5
8
  unit_system: metric
6
9
  tax_name: VAT
@@ -5,6 +5,8 @@ name: Saint Barthélemy
5
5
  group: Central American Countries
6
6
  group_name: Central America
7
7
  code: BL
8
+ code_alternates:
9
+ - FR-BL
8
10
  unit_system: metric
9
11
  tags:
10
12
  - EU-OCT
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: Caribbean Netherlands
3
3
  code: BQ
4
+ code_alternates:
5
+ - NL-BQ
4
6
  tax: 0.08
5
7
  currency: USD
6
8
  unit_system: metric
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: Curaçao
3
3
  code: CW
4
+ code_alternates:
5
+ - NL-CW
4
6
  tax: 0.06
5
7
  currency: ANG
6
8
  unit_system: metric
@@ -7,6 +7,9 @@ tax_name: VAT
7
7
  name_alternates:
8
8
  - French Guyana
9
9
  code: GF
10
+ code_alternates:
11
+ - FR-GF
12
+ - FR-973
10
13
  tags:
11
14
  - EU-OMR
12
15
  unit_system: metric
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  name: Guadeloupe
3
3
  code: GP
4
+ code_alternates:
5
+ - FR-GP
6
+ - FR-GUA
7
+ - FR-971
4
8
  tax: 0.085
5
9
  currency: EUR
6
10
  unit_system: metric
@@ -1,6 +1,9 @@
1
1
  ---
2
2
  name: Hong Kong
3
3
  code: HK
4
+ code_alternates:
5
+ - CN-HK
6
+ - CN-91
4
7
  tax: 0.0
5
8
  currency: HKD
6
9
  unit_system: metric
@@ -788,6 +788,8 @@ zones:
788
788
  zip_prefixes:
789
789
  - '41'
790
790
  - name: Monza e Brianza
791
+ name_alternates:
792
+ - Monza e della Brianza
791
793
  code: MB
792
794
  tax: 0.0
793
795
  tax_name: VAT
@@ -1083,6 +1085,8 @@ zones:
1083
1085
  - '890'
1084
1086
  - '891'
1085
1087
  - name: Reggio Emilia
1088
+ name_alternates:
1089
+ - Reggion nell'Emilia
1086
1090
  code: RE
1087
1091
  tax: 0.0
1088
1092
  tax_name: VAT
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: Saint Martin
3
3
  code: MF
4
+ code_alternates:
5
+ - FR-MF
4
6
  tax: 0.05
5
7
  currency: EUR
6
8
  unit_system: metric
@@ -1,6 +1,9 @@
1
1
  ---
2
2
  name: Macao
3
3
  code: MO
4
+ code_alternates:
5
+ - CN-MO
6
+ - CN-92
4
7
  tax: 0.0
5
8
  currency: MOP
6
9
  unit_system: metric
@@ -1,6 +1,9 @@
1
1
  ---
2
2
  name: Martinique
3
3
  code: MQ
4
+ code_alternates:
5
+ - FR-MQ
6
+ - FR-972
4
7
  tax: 0.085
5
8
  currency: EUR
6
9
  unit_system: metric
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: New Caledonia
3
3
  code: NC
4
+ code_alternates:
5
+ - FR-NC
4
6
  tax: 0.11
5
7
  currency: XPF
6
8
  unit_system: metric
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: French Polynesia
3
3
  code: PF
4
+ code_alternates:
5
+ - FR-PF
4
6
  tax: 0.16
5
7
  tax_name: VAT
6
8
  currency: XPF
@@ -4,6 +4,8 @@ name: Saint Pierre And Miquelon
4
4
  group: Central American Countries
5
5
  group_name: Central America
6
6
  code: PM
7
+ code_alternates:
8
+ - FR-PM
7
9
  unit_system: metric
8
10
  currency: EUR
9
11
  tags:
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  name: Reunion
3
3
  code: RE
4
+ code_alternates:
5
+ - FR-RE
6
+ - FR-LRE
7
+ - FR-974
4
8
  tax: 0.085
5
9
  tax_name: TVA
6
10
  tax_inclusive: true
@@ -5,6 +5,8 @@ name: Svalbard And Jan Mayen
5
5
  group: European Countries
6
6
  group_name: Europe
7
7
  code: SJ
8
+ code_alternates:
9
+ - "NO-SJ"
8
10
  unit_system: metric
9
11
  currency: NOK
10
12
  zip_example: '9170'
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: Sint Maarten
3
3
  code: SX
4
+ code_alternates:
5
+ - NL-SX
4
6
  tax: 0.05
5
7
  currency: ANG
6
8
  unit_system: metric
@@ -4,6 +4,8 @@ name: French Southern Territories
4
4
  group: Other Countries
5
5
  group_name: Other
6
6
  code: TF
7
+ code_alternates:
8
+ - FR-TF
7
9
  tags:
8
10
  - EU-OCT
9
11
  # There are military, research, and support staff in TF, but no permanently settled inhabitants.
@@ -1,6 +1,9 @@
1
1
  ---
2
2
  name: Taiwan
3
3
  code: TW
4
+ code_alternates:
5
+ - CN-TW
6
+ - CN-71
4
7
  tax: 0.05
5
8
  currency: TWD
6
9
  unit_system: metric
@@ -4,6 +4,8 @@ name: United States Minor Outlying Islands
4
4
  group: Central American Countries
5
5
  group_name: Central America
6
6
  code: UM
7
+ code_alternates:
8
+ - US-UM
7
9
  inhabited: false
8
10
  unit_system: metric
9
11
  currency: USD
@@ -7,6 +7,8 @@ unit_system: imperial
7
7
  tax_name: Federal Tax
8
8
  group: North American Countries
9
9
  group_name: North America
10
+ name_alternates:
11
+ - United States of America
10
12
  zip_label: Zip code
11
13
  zip_regex: "(?-mix:\\A\\d{5}(-\\d{4})?\\z)|(?i-mx:\\AFPO\\s*A[A-Z]\\s*\\d{5}-\\d{4}\\z)"
12
14
  zip_example: '90210'
@@ -73,6 +75,8 @@ zones:
73
75
  example_city_zip: '96799'
74
76
  tax_name: State Tax
75
77
  code: AS
78
+ code_alternates:
79
+ - US-AS
76
80
  iso_code: AS
77
81
  zip_prefixes:
78
82
  - '96799'
@@ -393,6 +397,8 @@ zones:
393
397
  example_city_zip: '96929'
394
398
  tax_name: State Tax
395
399
  code: GU
400
+ code_alternates:
401
+ - US-GU
396
402
  iso_code: GU
397
403
  zip_prefixes:
398
404
  - '9691'
@@ -1165,6 +1171,8 @@ zones:
1165
1171
  example_city_zip: '96950'
1166
1172
  tax_name: State Tax
1167
1173
  code: MP
1174
+ code_alternates:
1175
+ - US-MP
1168
1176
  iso_code: MP
1169
1177
  zip_prefixes:
1170
1178
  # Valid postal codes in MP are 96950, 96951, 96952
@@ -1357,6 +1365,8 @@ zones:
1357
1365
  example_city_zip: '00717'
1358
1366
  tax_name: State Tax
1359
1367
  code: PR
1368
+ code_alternates:
1369
+ - US-PR
1360
1370
  iso_code: PR
1361
1371
  zip_prefixes:
1362
1372
  - '006'
@@ -1722,6 +1732,8 @@ zones:
1722
1732
  example_city_zip: '00802'
1723
1733
  tax_name: State Tax
1724
1734
  code: VI
1735
+ code_alternates:
1736
+ - US-VI
1725
1737
  iso_code: VI
1726
1738
  zip_prefixes:
1727
1739
  - '008'
@@ -6,6 +6,8 @@ name: Wallis And Futuna
6
6
  group: Oceanian Countries
7
7
  group_name: Oceania
8
8
  code: WF
9
+ code_alternates:
10
+ - FR-WF
9
11
  unit_system: metric
10
12
  tags:
11
13
  - EU-OCT
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  name: Mayotte
3
3
  code: YT
4
+ code_alternates:
5
+ - FR-YT
6
+ - FR-MAY
7
+ - FR-976
4
8
  tax: 0.0
5
9
  tax_inclusive: true
6
10
  currency: EUR
@@ -110,6 +110,10 @@ module Worldwide
110
110
  # This name is the name that was traditionally returned by "country_db".
111
111
  attr_reader :legacy_name
112
112
 
113
+ # Other names that may be used to refer to this region.
114
+ # E.g., "Czech Republic" is also known as "Czechia".
115
+ attr_accessor :name_alternates
116
+
113
117
  # iso_code values of regions (subdivisions) within the same country that border this region.
114
118
  # E.g., for CA-ON, the neighbouring zones are CA-MB, CA-NU and CA-QC.
115
119
  attr_accessor :neighbours
@@ -438,7 +442,7 @@ module Worldwide
438
442
  end
439
443
 
440
444
  def parent_country
441
- parents.find(&:country?)
445
+ @parent_country ||= parents.find(&:country?)
442
446
  end
443
447
 
444
448
  # Checks whether the given value is acceptable according to the regular expression defined for the country.
@@ -16,7 +16,7 @@ module Worldwide
16
16
  end
17
17
 
18
18
  def initialize
19
- @regions = RegionsLoader.new.load_regions
19
+ @regions, @regions_by_cldr_code, @regions_by_iso_code = RegionsLoader.new.load_regions
20
20
  end
21
21
 
22
22
  def all
@@ -29,17 +29,9 @@ module Worldwide
29
29
  end
30
30
 
31
31
  result = if cldr
32
- search_code = cldr.to_s.upcase
33
-
34
- @regions.find do |r|
35
- r.send(:answers_to_cldr_code, search_code)
36
- end
32
+ @regions_by_cldr_code[cldr.to_s.upcase]
37
33
  elsif code
38
- search_code = code.to_s.upcase
39
-
40
- @regions.find do |r|
41
- r.send(:answers_to_iso_code, search_code) || r.alpha_three == search_code || r.numeric_three == search_code
42
- end
34
+ @regions_by_iso_code[code.to_s.upcase]
43
35
  else # search by name
44
36
  search_name = name.upcase
45
37
 
@@ -9,6 +9,9 @@ module Worldwide
9
9
  WORLD_CODE = "001" # UN code for the whole world
10
10
 
11
11
  def load_regions
12
+ @regions_by_cldr_code = {}
13
+ @regions_by_iso_code = {}
14
+
12
15
  # Load country/region definitions out of the db/data/regions/??.yml files
13
16
  @regions = Dir["#{Worldwide::Paths::REGIONS_ROOT}/*.yml"].map do |filename|
14
17
  load_territory(filename)
@@ -25,11 +28,39 @@ module Worldwide
25
28
 
26
29
  construct_unknown
27
30
 
28
- @regions.freeze
31
+ @regions.each do |region|
32
+ construct_lookup_info(region)
33
+ end
34
+
35
+ [@regions.freeze, @regions_by_cldr_code, @regions_by_iso_code]
29
36
  end
30
37
 
31
38
  private
32
39
 
40
+ def construct_lookup_info(region)
41
+ pc = region.send(:parent_country)
42
+
43
+ # Remember CLDR code(s) for later use during lookup
44
+
45
+ search_code = region.cldr_code.to_s.upcase
46
+ @regions_by_cldr_code[search_code] = region if Util.present?(search_code)
47
+
48
+ @regions_by_cldr_code["#{pc.cldr_code.upcase}#{search_code}"] = region if Util.present?(pc&.cldr_code)
49
+
50
+ # Remember ISO 3166 code(s) for later use during lookup
51
+
52
+ iso_code = region.iso_code
53
+ @regions_by_iso_code[iso_code] = region if Util.present?(iso_code)
54
+
55
+ @regions_by_iso_code["#{pc.iso_code}-#{iso_code}"] = region if Util.present?(pc)
56
+
57
+ alpha_three = region.alpha_three
58
+ @regions_by_iso_code[alpha_three] = region if Util.present?(alpha_three)
59
+
60
+ numeric_three = region.numeric_three
61
+ @regions_by_iso_code[numeric_three] = region if Util.present?(numeric_three)
62
+ end
63
+
33
64
  def apply_hierarchy(parent:, code:, children:)
34
65
  current_region = find_region(code: code)
35
66
  if current_region.nil?
@@ -61,6 +92,7 @@ module Worldwide
61
92
  region.building_number_required = spec["building_number_required"] || true
62
93
  region.building_number_may_be_in_address2 = spec["building_number_may_be_in_address2"] || false
63
94
  currency_code = spec["currency"]
95
+ region.code_alternates = spec["code_alternates"] || []
64
96
  region.currency = Worldwide.currency(code: currency_code) unless currency_code.nil?
65
97
  region.flag = spec["emoji"]
66
98
  region.format = spec["format"]
@@ -82,10 +114,12 @@ module Worldwide
82
114
  region.zip_requirement = spec["zip_requirement"]
83
115
  region.zip_regex = spec["zip_regex"]
84
116
  region.zips_crossing_provinces = spec["zips_crossing_provinces"]
117
+ region.name_alternates = spec["name_alternates"] || []
85
118
  end
86
119
 
87
120
  def apply_zone_attributes(region, zone)
88
121
  region.code_alternates = zone["code_alternates"] || []
122
+ region.name_alternates = zone["name_alternates"] || []
89
123
  region.example_city = zone["example_city"]
90
124
  region.neighbours = zone["neighboring_zones"]
91
125
  region.zip_prefixes = zone["zip_prefixes"] || []
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Worldwide
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.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: 0.3.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-03 00:00:00.000000000 Z
11
+ date: 2023-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport