Skip to content

Commit

Permalink
Merge pull request #283 from Shopify/name-alternates-default
Browse files Browse the repository at this point in the history
Add Arabic alternate_names for UAE
  • Loading branch information
gabypancu authored Sep 16, 2024
2 parents 66b55c8 + 7b034d4 commit 068275d
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Security in case of vulnerabilities.

## [Unreleased]
- Nil.
- Add alternate Arabic names for UAE zones [#283](https://github.com/Shopify/worldwide/pull/283)

---

Expand Down
14 changes: 14 additions & 0 deletions db/data/regions/AE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,17 @@ example_address:
phone: "+971 600 544442"
zones:
- name: Abu Dhabi
name_alternates:
- "أبو ظبي"
code: AZ
tax: 0.0
tax_name: VAT
neighboring_zones:
- DU
- SH
- name: Ajman
name_alternates:
- "عجمان"
code: AJ
tax: 0.0
tax_name: VAT
Expand All @@ -53,6 +57,8 @@ zones:
- RK
- SH
- name: Dubai
name_alternates:
- "دبي"
code: DU
tax: 0.0
tax_name: VAT
Expand All @@ -62,6 +68,8 @@ zones:
- RK
- SH
- name: Fujairah
name_alternates:
- "الفجيرة"
code: FU
tax: 0.0
tax_name: VAT
Expand All @@ -70,6 +78,8 @@ zones:
- RK
- SH
- name: Ras al-Khaimah
name_alternates:
- "رأس الخيمة"
code: RK
tax: 0.0
tax_name: VAT
Expand All @@ -80,6 +90,8 @@ zones:
- SH
- UQ
- name: Sharjah
name_alternates:
- "الشارقة"
code: SH
tax: 0.0
tax_name: VAT
Expand All @@ -91,6 +103,8 @@ zones:
- RK
- UQ
- name: Umm al-Quwain
name_alternates:
- "أم القيوين"
code: UQ
tax: 0.0
tax_name: VAT
Expand Down
2 changes: 2 additions & 0 deletions db/data/regions/MX.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ zones:
tax: 0.0
tax_name: State Tax
- name: Coahuila
name_alternates:
- Coahuila de Zaragoza
code: COAH
code_alternates:
- COA
Expand Down
1 change: 1 addition & 0 deletions lib/worldwide/region.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ def initialize(
@flag = nil
@format = {}
@format_extended = {}
@name_alternates = []
@group = nil
@group_name = nil
@languages = []
Expand Down
33 changes: 33 additions & 0 deletions test/worldwide/region_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class RegionTest < ActiveSupport::TestCase
assert_nil region.legacy_name
assert_empty(region.format)
assert_empty(region.format_extended)
assert_empty(region.name_alternates)
assert_nil region.numeric_three
assert_equal false, region.province?
# short_name currently throws a NoMethodError because it's not yet implemented
Expand Down Expand Up @@ -452,5 +453,37 @@ class RegionTest < ActiveSupport::TestCase
assert_equal expected_value, Worldwide.region(code: region_code).additional_address_fields
end
end

test "initializer sets expected default attributes" do
region = Region.new(iso_code: "ZZ")

assert_empty region.additional_address_fields
assert_empty(region.combined_address_format)
refute region.building_number_required
refute region.building_number_may_be_in_address2
assert_nil region.currency
assert_nil region.flag
assert_empty(region.format)
assert_empty(region.format_extended)
assert_empty region.name_alternates
assert_nil region.group
assert_nil region.group_name
assert_empty region.languages
assert_empty region.neighbours
assert_nil region.partial_zip_regex
assert_nil region.phone_number_prefix
assert_empty region.tags
assert_nil region.timezone
assert_empty(region.timezones)
assert_nil region.unit_system
assert_nil region.week_start_day
refute region.zip_autofill_enabled
assert_nil region.zip_example
assert_empty region.zip_prefixes
assert_nil region.zip_regex
assert_nil region.example_address
assert_empty region.parents
assert_empty region.zones
end
end
end

0 comments on commit 068275d

Please sign in to comment.