Skip to content

Conversation

@tpaksu
Copy link
Contributor

@tpaksu tpaksu commented Jul 5, 2021

All Submissions:

Changes proposed in this Pull Request:

Related fix for Automattic/woocommerce-payments#2246.

This PR will add support for other currencies and locale specific settings for WooCommerce, which will also solve the need for locale-currency-country matching when the customer's location is detected via geolocation system, also will be used as a base for the other multi-currency related plugins, e.g. WooCommerce Payments.

It includes the new country and locale data while preserving the original content, with some additional formatting fixes, all obtained from data provided by the CLDR (http://cldr.unicode.org/).

Existing keys still remain the same:

  • currency_code: The 3-letter ISO-4217 currency code
  • currency_pos: Whether the symbol is placed on left or right while formatting
  • thousand_sep: The thousand separator used in the default locale for the country
  • decimal_sep: The decimal separator used in the default locale
  • num_decimals: Number of decimal digits used for the currency
  • weight_unit: Common unit of weight used in the country
  • dimension_unit: Common unit of length used in the country

New keys added to the existing country data:

  • direction: The text direction of the country's default locale
  • default_locale: Default locale for the country
  • name: Name of the currency
  • singular: Singular form of the currency display
  • plural: Plural form of the currency display
  • short_symbol: Currency symbol
  • locales: The locales used for the country

The new countries are:

Country Country Country Country Country
AD: Andorra AE: United Arab Emirates AF: Afghanistan AG: Antigua & Barbuda AI: Anguilla
AM: Armenia AO: Angola AR: Argentina AS: American Samoa AW: Aruba
AX: Åland Islands AZ: Azerbaijan BB: Barbados BF: Burkina Faso BG: Bulgaria
BH: Bahrain BI: Burundi BJ: Benin BL: St. Barthélemy BM: Bermuda
BN: Brunei BO: Bolivia BQ: Caribbean Netherlands BS: Bahamas BT: Bhutan
BW: Botswana BY: Belarus BZ: Belize CC: Cocos (Keeling) Islands CD: Congo - Kinshasa
CF: Central African Republic CG: Congo - Brazzaville CI: Côte d’Ivoire CK: Cook Islands CL: Chile
CM: Cameroon CN: China CO: Colombia CR: Costa Rica CU: Cuba
CV: Cape Verde CW: Curaçao CX: Christmas Island CY: Cyprus CZ: Czechia
DG: Diego Garcia DJ: Djibouti DM: Dominica DO: Dominican Republic DZ: Algeria
EA: Ceuta & Melilla EC: Ecuador EE: Estonia EG: Egypt EH: Western Sahara
ER: Eritrea ET: Ethiopia FJ: Fiji FK: Falkland Islands FM: Micronesia
FO: Faroe Islands GA: Gabon GD: Grenada GE: Georgia GF: French Guiana
GG: Guernsey GH: Ghana GI: Gibraltar GL: Greenland GM: Gambia
GN: Guinea GP: Guadeloupe GQ: Equatorial Guinea GR: Greece GT: Guatemala
GU: Guam GW: Guinea-Bissau GY: Guyana HK: Hong Kong SAR China HN: Honduras
HR: Croatia HT: Haiti IC: Canary Islands ID: Indonesia IE: Ireland
IL: Israel IM: Isle of Man IN: India IO: British Indian Ocean Territory IQ: Iraq
IR: Iran IS: Iceland JE: Jersey JO: Jordan KG: Kyrgyzstan
KH: Cambodia KI: Kiribati KM: Comoros KN: St. Kitts & Nevis KP: North Korea
KW: Kuwait KY: Cayman Islands KZ: Kazakhstan LA: Laos LB: Lebanon
LC: St. Lucia LK: Sri Lanka LR: Liberia LS: Lesotho LT: Lithuania
LU: Luxembourg LV: Latvia LY: Libya MA: Morocco MC: Monaco
ME: Montenegro MF: St. Martin MG: Madagascar MH: Marshall Islands MK: North Macedonia
ML: Mali MM: Myanmar (Burma) MN: Mongolia MO: Macao SAR China MP: Northern Mariana Islands
MQ: Martinique MR: Mauritania MS: Montserrat MT: Malta MU: Mauritius
MV: Maldives MW: Malawi MX: Mexico MY: Malaysia MZ: Mozambique
NA: Namibia NC: New Caledonia NE: Niger NF: Norfolk Island NG: Nigeria
NI: Nicaragua NR: Nauru NU: Niue NZ: New Zealand OM: Oman
PA: Panama PE: Peru PF: French Polynesia PG: Papua New Guinea PH: Philippines
PK: Pakistan PM: St. Pierre & Miquelon PN: Pitcairn Islands PR: Puerto Rico PS: Palestinian Territories
PT: Portugal PW: Palau QA: Qatar RE: Réunion RU: Russia
RW: Rwanda SA: Saudi Arabia SB: Solomon Islands SC: Seychelles SD: Sudan
SE: Sweden SG: Singapore SH: St. Helena SI: Slovenia SJ: Svalbard & Jan Mayen
SK: Slovakia SL: Sierra Leone SM: San Marino SN: Senegal SO: Somalia
SR: Suriname SS: South Sudan ST: São Tomé & Príncipe SV: El Salvador SX: Sint Maarten
SY: Syria SZ: Eswatini TC: Turks & Caicos Islands TD: Chad TG: Togo
TJ: Tajikistan TK: Tokelau TL: Timor-Leste TM: Turkmenistan TN: Tunisia
TO: Tonga TT: Trinidad & Tobago TV: Tuvalu TW: Taiwan UA: Ukraine
UM: U.S. Outlying Islands UY: Uruguay UZ: Uzbekistan VA: Vatican City VC: St. Vincent & Grenadines
VE: Venezuela VG: British Virgin Islands VI: U.S. Virgin Islands VN: Vietnam VU: Vanuatu
WF: Wallis & Futuna WS: Samoa XK: Kosovo YE: Yemen YT: Mayotte
ZM: Zambia ZW: Zimbabwe

How to test the changes in this Pull Request:

  1. Run npm run docker:up to prepare the testing environment
  2. Run npm run test:e2e to run the E2E tests

Manual Test:

  1. While onboarding, select Aruba as your country, and finish onboarding. If you have already finished onboarding, you can go to WooCommerce > Orders, then on the above tab drawer, choose Help > Setup Wizard, then click on the Setup Wizard button to re-access the onboarding workflow.
  2. After you finish onboarding, go to WooCommerce > Settings > General and on the Currency select, you should see Aruban florin (Afl.) as the selected currency for that store.

Other information:

Note The tests will be added separately on this PR: #30350

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?

Changelog entry

Enter a summary of all changes on this Pull Request. This will appear in the changelog if accepted.

Enhancement - Update locale-info.php to contain all the countries, currency specs and locale information. #30216

@tpaksu tpaksu self-assigned this Jul 5, 2021
@tpaksu tpaksu added focus: i18n The issue/PR is related to internationalization. component: currency Payments Issues related to payments. status: in progress This is being worked on. Enhancement The issue is a request for an enhancement. labels Jul 5, 2021
@tpaksu tpaksu marked this pull request as ready for review July 6, 2021 07:02
@tpaksu tpaksu added release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] and removed status: in progress This is being worked on. release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] labels Jul 6, 2021
@tpaksu tpaksu marked this pull request as draft July 6, 2021 12:17
@tpaksu tpaksu added the status: in progress This is being worked on. label Jul 6, 2021
@tpaksu tpaksu marked this pull request as ready for review July 13, 2021 17:43
@dwainm dwainm added this to the Multi-Currency MVP milestone Jul 15, 2021
@vedanshujain vedanshujain requested review from a team and roykho and removed request for a team July 26, 2021 09:29
@vedanshujain vedanshujain removed the status: in progress This is being worked on. label Jul 26, 2021
Copy link
Contributor

@roykho roykho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Tested well per your instructions. I've left some comments which needs to be addressed and also a question.

@tpaksu tpaksu requested a review from roykho July 26, 2021 14:02
Copy link
Contributor

@roykho roykho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the changes.

@roykho roykho merged commit 081e725 into trunk Jul 26, 2021
@roykho roykho deleted the add/new-locale-info-file branch July 26, 2021 14:32
@roykho roykho added release: add changelog Mark all PRs that have not had their changelog entries added. [auto] release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] labels Jul 26, 2021
@tpaksu
Copy link
Contributor Author

tpaksu commented Jul 26, 2021

@roykho thanks for the approval and merge!

@roykho roykho modified the milestones: Multi-Currency MVP, 5.7.0 Aug 17, 2021
@roykho roykho added the release: highlight Issues that have a high user impact and need to be discussed/paid attention to. label Aug 20, 2021
@rodelgc rodelgc added testing instructions added and removed release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] labels Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement The issue is a request for an enhancement. focus: i18n The issue/PR is related to internationalization. Payments Issues related to payments. release: add changelog Mark all PRs that have not had their changelog entries added. [auto] release: highlight Issues that have a high user impact and need to be discussed/paid attention to.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants