#2780261: resolve currencies missing numeric_code value, #2593083: IQD Missing from currency list, #2256853: Add Georgian Lari to Currencies show the same thing: our currency list needs to be rebuilt. We've done it in 2.x with CLDR. Let's create a script that parses the latest CLDR release and outputs a 1.x currencies array. Keep that script in this issue, commit the result.
The following 8 currencies will be updated to have numeric codes:
- AZN, CUC, GHS, MZN, RON, RSD, SRD, VEF
The following 18 currencies will be added:
- ALL, AMD, BYN, KHR, GEL, IQD, MGA, MWK, MVR, KPW,
- OMR, RWF, SVC, SSP, SDG, TJS, TMT, UZS, ZMW, ZWL
The following 10 currencies will be removed:
- ARM (unused since 1970)
- BYR (replaced in 2016)
- EEK (unused since 2011)
- LTL (unused since 2015)
- LVL (unused since 2014)
- MTP (unused since 2008)
- RHD (unused since 1980)
- SDD (unused since 2007)
- SRG (unused since 2004)
- ZMK (unused since 2013)
(People can implement the currency alter hook if they need to add them back for any reason)
Notes:
- BYR was replaced by BYN in July 2016. See https://www.drupal.org/project/commerce_currency_byn
- ZMK was replaced by ZMW on Dec 31st 2012
- SDD was replaced by SDG on Jan 1st 2007
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | updated-currencies-6.patch | 59.39 KB | bojanz |
| #5 | updated-currencies-5.patch | 64.27 KB | bojanz |
| #3 | updated-currencies.patch | 63.21 KB | bojanz |
Comments
Comment #2
bojanz commentedMade progress on the first flight: https://gist.github.com/bojanz/4fbead42616027f5776851ddb4d4c840
Working on the full generation, that will include formatting info.
Expanded the issue summary with initial results.
Comment #3
bojanz commentedI have updated the Gist with a fully working script: https://gist.github.com/bojanz/4fbead42616027f5776851ddb4d4c840
Attaching a sample patch. Hasn't been verified yet.
Needs discussion:
1) CLDR has no minor_unit / major_unit data. This data is not used anywhere in Commerce, so if we want to regenerate the list automatically (without having to go through Wikipedia and manually adding minor_unit / major_unit) we'll need to drop these keys. I suggest doing that in a separate issue.
2) Commerce 1.x uses a regular space as a symbol spacer. CLDR uses the UTF-8 non-breaking space (which is more correct). This produces a large diff. We can either convert the non-breaking space to a space in the script, maintaining 1.x behavior, or do a separate issue where we first convert the existing spaces into non-breaking spaces.
Also note that currencies are now ordered by name. This too produces a slightly larger patch.
Comment #4
bojanz commentedWe have decided to keep major_unit and minor_unit for now.
TODO:
1) Update the script to reuse old major_unit and minor_unit.
2) Collect unit labels for the new currencies, list them here.
2) After generating the dataset, manually insert the collected unit labels.
The non-breaking space change was approved.
The generation script has been updated with smaller bug fixes.
Comment #5
bojanz commentedUpdated the script to solve #4.1. Removed the sort by currency label, since commerce_currencies() currently resorts the array anyway.
Here's a new patch, which should be easier to review.
Note one interesting thing:
We're using the symbols for the currency default locale (es-AR in this case), which gives us the native symbols, not the disambiguated ones.
The previous dataset was inconsistent (Canada, Australia, New Zealand used just "$"), so I think this change is fine.
EDIT: I suggest we commit a fix that ensures a consistent currency property ordering first, to reduce the size of this patch, making it easier to review.
Comment #6
bojanz commentedRerolled on top of the recently committed:
#2593083: IQD Missing from currency list
#2256853: Add Georgian Lari to Currencies
#2889763: Ensure consistent currency property ordering
Thought it would reduce the patch more than this, but oh well.
Comment #7
bojanz commentedMany iterations later, we are ready.
Change record: https://www.drupal.org/node/2889930