Skip to content

Commit

Permalink
Merge pull request #205 from Shopify/instructional-informative-error-…
Browse files Browse the repository at this point in the history
…translation-fix

All error translations now have a _instructional and _informative message key
  • Loading branch information
rochlefebvre authored Jun 10, 2024
2 parents 5bdef8b + f842580 commit 5dbd44f
Show file tree
Hide file tree
Showing 17 changed files with 208 additions and 124 deletions.
12 changes: 8 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Security in case of vulnerabilities.

## [Unreleased]
- Additional field definitions in AE, CR, KW, PA, PE, SA, updated decorators for PH, VN [#206](https://github.com/Shopify/worldwide/pull/206)
- update street_name and street_number too_long error message [#203](https://github.com/Shopify/worldwide/pull/203)
- Update translations for neighborhood too_long error message, add translations for localized neighborhood errors in MX, PH [#191](https://github.com/Shopify/worldwide/pull/191)
- Generate concatenated address1/2 values when some additional field values are present [#199](https://github.com/Shopify/worldwide/pull/199)

--

## [1.3.0] - 2024-06-10

- Update translations for neighborhood too_long error message, add translations for localized neighborhood errors in MX, PH [#191](https://github.com/Shopify/worldwide/pull/191)
- Generate concatenated address1/2 values when some additional field values are present [#199](https://github.com/Shopify/worldwide/pull/199)
- update street_name and street_number too_long error message [#203](https://github.com/Shopify/worldwide/pull/203)
- Additional field definitions in AE, CR, KW, PA, PE, SA, updated decorators for PH, VN [#206](https://github.com/Shopify/worldwide/pull/206)
- All error messages now contain an `_instructional` and `_informative` key. If the `Worldwide::Field::error` method is called with a `code` that does not end in either `_instructional` or `_informative`, the `Worldwide::Field::error` method will append `_instructional` to the `code` and returns this error message. [#205](https://github.com/Shopify/worldwide/pull/205)

## [1.2.0] - 2024-06-05

- Merge duplicate language definition on some region yaml files to restore missing languages; `NO` adds "en" and "nb", `SA` adds "en", SG does not change [#188](https://github.com/Shopify/worldwide/pull/188)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ GIT
PATH
remote: .
specs:
worldwide (1.2.0)
worldwide (1.3.0)
activesupport (>= 7.0)
i18n
phonelib (~> 0.8)
Expand Down
3 changes: 2 additions & 1 deletion db/data/regions/AT/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ en:
default: Additional address
optional: Additional address (optional)
errors:
blank: Enter additional address information
blank_instructional: Enter additional address information
blank_informative: Additional address information is missing
3 changes: 2 additions & 1 deletion db/data/regions/CA/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ en:
unknown_for_city_informative: Province isn't valid for %{city}
unknown_for_zip_instructional: Select a valid province for %{zip}
unknown_for_zip_informative: Province isn't valid for %{zip}
unknown_for_address: Province may be incorrect
unknown_for_address_instructional: Province may be incorrect
unknown_for_address_informative: Province may be incorrect

34 changes: 22 additions & 12 deletions db/data/regions/CL/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,28 @@ en:
default: Commune
optional: Commune (optional)
errors:
blank: Enter a commune
too_long: Commune is too long (maximum is %{limit} characters)
contains_emojis: Commune cannot contain emojis
contains_mathematical_symbols: Commune cannot contain mathematical symbols
contains_restricted_characters: Commune can only contain letters, numbers,
blank_instructional: Enter a commune
blank_informative: Commune is missing
too_long_instructional: Commune is too long (maximum is %{limit} characters)
too_long_informative: Commune is too long
contains_emojis_instructional: Commune can't contain emojis
contains_emojis_informative: Commune can't contain emojis
contains_mathematical_symbols_instructional: Commune can't contain mathematical symbols
contains_mathematical_symbols_informative: Commune can't contain mathematical symbols
contains_restricted_characters_instructional: Commune can only contain letters, numbers,
local characters, and special characters
contains_too_many_words: Commune cannot have more than %{word_count}
words
contains_html_tags: Commune cannot contain HTML tags.
contains_url: Commune cannot contain URLs.
unknown_for_city: Enter a valid commune name for %{city}.
unknown_for_zip: Enter a valid commune name for %{zip}.
unknown_for_address: Commune may be incorrect.
contains_restricted_characters_informative: Commune can't contain restricted characters
contains_too_many_words_instructional: Commune must have fewer than %{word_count} words
contains_too_many_words_informative: Commune must have fewer than %{word_count} words
contains_html_tags_instructional: Commune can't contain HTML tags
contains_html_tags_informative: Commune can't contain HTML tags
contains_url_instructional: Commune can't contain URLs
contains_url_informative: Commune can't contain URLs
unknown_for_city_instructional: Enter a valid commune for %{city}
unknown_for_city_informative: Enter a valid commune for %{city}
unknown_for_zip_instructional: Enter a valid commune for %{zip}
unknown_for_zip_informative: Enter a valid commune for %{zip}
unknown_for_address_instructional: Commune may be incorrect
unknown_for_address_informative: Commune may be incorrect
warnings:
contains_too_many_words: Commune is recommended to have less than %{word_count} words
34 changes: 22 additions & 12 deletions db/data/regions/MX/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,28 @@ en:
default: Colony
optional: Colony (optional)
errors:
blank: Enter a colony
too_long: Colony is too long (maximum is %{limit} characters)
contains_emojis: Colony cannot contain emojis
contains_mathematical_symbols: Colony cannot contain mathematical symbols
contains_restricted_characters: Colony can only contain letters, numbers,
blank_instructional: Enter a colony
blank_informative: Colony is missing
too_long_instructional: Colony is too long (maximum is %{limit} characters)
too_long_informative: Colony is too long
contains_emojis_instructional: Colony can't contain emojis
contains_emojis_informative: Colony can't contain emojis
contains_mathematical_symbols_instructional: Colony can't contain mathematical symbols
contains_mathematical_symbols_informative: Colony can't contain mathematical symbols
contains_restricted_characters_instructional: Colony can only contain letters, numbers,
local characters, and special characters
contains_too_many_words: Colony cannot have more than %{word_count}
words
contains_html_tags: Colony cannot contain HTML tags.
contains_url: Colony cannot contain URLs.
unknown_for_city: Enter a valid colony name for %{city}.
unknown_for_zip: Enter a valid colony name for %{zip}.
unknown_for_address: Colony may be incorrect.
contains_restricted_characters_informative: Colony can't contain restricted characters
contains_too_many_words_instructional: Colony must have fewer than %{word_count} words
contains_too_many_words_informative: Colony must have fewer than %{word_count} words
contains_html_tags_informative: Colony can't contain HTML
contains_html_tags_instructional: Colony can't contain HTML
contains_url_instructional: Colony can't contain a URL
contains_url_informative: Colony can't contain a URL
unknown_for_city_instructional: Enter a valid colony for %{city}
unknown_for_city_informative: Enter a valid colony for %{city}
unknown_for_zip_instructional: Enter a valid colony for %{zip}
unknown_for_zip_informative: Enter a valid colony for %{zip}
unknown_for_address_instructional: Colony may be incorrect
unknown_for_address_informative: Colony may be incorrect
warnings:
contains_too_many_words: Colony is recommended to have less than %{word_count} words
34 changes: 22 additions & 12 deletions db/data/regions/PH/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,28 @@ en:
default: Barangay
optional: Barangay (optional)
errors:
blank: Enter a barangay
too_long: Barangay is too long (maximum is %{limit} characters)
contains_emojis: Barangay cannot contain emojis
contains_mathematical_symbols: Barangay cannot contain mathematical symbols
contains_restricted_characters: Barangay can only contain letters, numbers,
blank_instructional: Enter a barangay
blank_informative: Barangay is missing
too_long_instructional: Barangay is too long (maximum is %{limit} characters)
too_long_informative: Barangay is too long
contains_emojis_instructional: Barangay can't contain emojis
contains_emojis_informative: Barangay can't contain emojis
contains_mathematical_symbols_instructional: Barangay can't contain mathematical symbols
contains_mathematical_symbols_informative: Barangay can't contain mathematical symbols
contains_restricted_characters_instructional: Barangay can only contain letters, numbers,
local characters, and special characters
contains_too_many_words: Barangay cannot have more than %{word_count}
words
contains_html_tags: Barangay cannot contain HTML tags.
contains_url: Barangay cannot contain URLs.
unknown_for_city: Enter a valid barangay name for %{city}.
unknown_for_zip: Enter a valid barangay name for %{zip}.
unknown_for_address: Barangay may be incorrect.
contains_restricted_characters_informative: Barangay can't contain restricted characters
contains_too_many_words_instructional: Barangay must have fewer than %{word_count} words
contains_too_many_words_informative: Barangay must have fewer than %{word_count} words
contains_html_tags_instructional: Barangay can't contain HTML
contains_html_tags_informative: Barangay can't contain HTML
contains_url_instructional: Barangay can't contain a URL
contains_url_informative: Barangay can't contain a URL
unknown_for_city_instructional: Enter a valid barangay name for %{city}
unknown_for_city_informative: Enter a valid barangay name for %{city}
unknown_for_zip_instructional: Enter a valid barangay name for %{zip}
unknown_for_zip_informative: Enter a valid barangay name for %{zip}
unknown_for_address_instructional: Barangay may be incorrect
unknown_for_address_informative: Barangay may be incorrect
warnings:
contains_too_many_words: Barangay is recommended to have less than %{word_count} words
2 changes: 1 addition & 1 deletion db/data/regions/TH/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ en:
default: Province
optional: Province (optional)
errors:
blank_intructional: Select a province
blank_instructional: Select a province
blank_informative: Province is missing
3 changes: 2 additions & 1 deletion db/data/regions/TR/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ en:
unknown_for_city_informative: District isn't valid for %{city}
unknown_for_zip_instructional: Enter a valid district for %{zip}
unknown_for_zip_informative: District isn't valid for %{zip}
unknown_for_address: District may be incorrect
unknown_for_address_instructional: District may be incorrect
unknown_for_address_informative: District may be incorrect
warnings:
contains_too_many_words: District is recommended to have less than %{word_count} words
3 changes: 2 additions & 1 deletion db/data/regions/TW/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ en:
unknown_for_city_informative: District isn't valid for %{city}
unknown_for_zip_instructional: Enter a valid district for %{zip}
unknown_for_zip_informative: District isn't valid for %{zip}
unknown_for_address: District may be incorrect
unknown_for_address_instructional: District may be incorrect
unknown_for_address_informative: District may be incorrect
warnings:
contains_too_many_words: District is recommended to have less than %{word_count} words
10 changes: 6 additions & 4 deletions db/data/regions/US/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ en:
unknown_for_city_informative: State isn't valid for %{city}
unknown_for_zip_instructional: Select a valid state for %{zip}
unknown_for_zip_informative: State isn't valid for %{zip}
unknown_for_address: State may be incorrect
unknown_for_address_instructional: State may be incorrect
unknown_for_address_informative: State may be incorrect
zip:
label:
default: ZIP code
optional: ZIP code (optional)
errors:
blank_instructional: Enter a ZIP code
blank_informative: ZIP code is missing
invalid_for_country_instructional: Enter a valid ZIP code for %{country}
invalid_for_country_informative: ZIP code isn't valid for %{country}
invalid_for_country_instructional: Enter a valid ZIP code for the %{country}
invalid_for_country_informative: ZIP code isn't valid for the %{country}
invalid_for_province_instructional: Enter a valid ZIP code for %{province}
invalid_for_province_informative: ZIP code isn't valid for %{province}
invalid_for_country_and_province_instructional: Enter a valid ZIP code for %{province},
Expand All @@ -41,4 +42,5 @@ en:
contains_restricted_characters_informative: ZIP code can't contain restricted characters
contains_html_tags_instructional: ZIP code can't contain HTML
contains_html_tags_informative: ZIP code can't contain HTML
unknown_for_address: ZIP code may be incorrect
unknown_for_address_instructional: ZIP code may be incorrect
unknown_for_address_informative: ZIP code may be incorrect
4 changes: 2 additions & 2 deletions db/data/regions/UY/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ en:
default: Department
optional: Department (optional)
errors:
blank_informational: Select a department
blank_instructional: Department is missing
blank_instructional: Select a department
blank_informative: Department is missing
5 changes: 3 additions & 2 deletions db/data/regions/VN/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ en:
unknown_for_city_instructional: Enter a valid ward name for %{city}
unknown_for_city_informative: Ward doesn't match %{city}
unknown_for_zip_instructional: Enter a valid ward name for %{zip}
unknown_for_zip_informational: Ward doesn't match %{zip}
unknown_for_address: Ward may be incorrect
unknown_for_zip_informative: Ward doesn't match %{zip}
unknown_for_address_instructional: Ward may be incorrect
unknown_for_address_informative: Ward may be incorrect
warnings:
contains_too_many_words: Ward is recommended to have less than %{word_count} words
Loading

0 comments on commit 5dbd44f

Please sign in to comment.