Add the ability to search for a currency by ISO code (#45512)
* Fix - #33503 Added ISO code along with the string. So it can be searched by using country code. * Fixing linting issues Added space with single quote to fix linting issue. * fix linting issues * add changelog file * use emdash for separating data * update test to new format * include ISO code in settings test fixture --------- Co-authored-by: daniyal.ahmad1992@gmail.com <daniyal.ahmad1992@gmail.com>
This commit is contained in:
parent
1c068ce3a4
commit
a917efc44e
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: add
|
||||
|
||||
Add the ability to search for a currency by ISO code.
|
|
@ -36,7 +36,7 @@ class WC_Settings_General extends WC_Settings_Page {
|
|||
$currency_code_options = get_woocommerce_currencies();
|
||||
|
||||
foreach ( $currency_code_options as $code => $name ) {
|
||||
$currency_code_options[ $code ] = $name . ' (' . get_woocommerce_currency_symbol( $code ) . ')';
|
||||
$currency_code_options[ $code ] = $name . ' (' . get_woocommerce_currency_symbol( $code ) . ') — ' . esc_html( $code );
|
||||
}
|
||||
|
||||
$settings =
|
||||
|
|
|
@ -8,168 +8,168 @@
|
|||
*/
|
||||
|
||||
const currencies = {
|
||||
AED: 'United Arab Emirates dirham (د.إ)',
|
||||
AFN: 'Afghan afghani (؋)',
|
||||
ALL: 'Albanian lek (L)',
|
||||
AMD: 'Armenian dram (AMD)',
|
||||
ANG: 'Netherlands Antillean guilder (ƒ)',
|
||||
AOA: 'Angolan kwanza (Kz)',
|
||||
ARS: 'Argentine peso ($)',
|
||||
AUD: 'Australian dollar ($)',
|
||||
AWG: 'Aruban florin (Afl.)',
|
||||
AZN: 'Azerbaijani manat (₼)',
|
||||
BAM: 'Bosnia and Herzegovina convertible mark (KM)',
|
||||
BBD: 'Barbadian dollar ($)',
|
||||
BDT: 'Bangladeshi taka (৳ )',
|
||||
BGN: 'Bulgarian lev (лв.)',
|
||||
BHD: 'Bahraini dinar (.د.ب)',
|
||||
BIF: 'Burundian franc (Fr)',
|
||||
BMD: 'Bermudian dollar ($)',
|
||||
BND: 'Brunei dollar ($)',
|
||||
BOB: 'Bolivian boliviano (Bs.)',
|
||||
BRL: 'Brazilian real (R$)',
|
||||
BSD: 'Bahamian dollar ($)',
|
||||
BTC: 'Bitcoin (฿)',
|
||||
BTN: 'Bhutanese ngultrum (Nu.)',
|
||||
BWP: 'Botswana pula (P)',
|
||||
BYR: 'Belarusian ruble (old) (Br)',
|
||||
BYN: 'Belarusian ruble (Br)',
|
||||
BZD: 'Belize dollar ($)',
|
||||
CAD: 'Canadian dollar ($)',
|
||||
CDF: 'Congolese franc (Fr)',
|
||||
CHF: 'Swiss franc (CHF)',
|
||||
CLP: 'Chilean peso ($)',
|
||||
CNY: 'Chinese yuan (¥)',
|
||||
COP: 'Colombian peso ($)',
|
||||
CRC: 'Costa Rican colón (₡)',
|
||||
CUC: 'Cuban convertible peso ($)',
|
||||
CUP: 'Cuban peso ($)',
|
||||
CVE: 'Cape Verdean escudo ($)',
|
||||
CZK: 'Czech koruna (Kč)',
|
||||
DJF: 'Djiboutian franc (Fr)',
|
||||
DKK: 'Danish krone (kr.)',
|
||||
DOP: 'Dominican peso (RD$)',
|
||||
DZD: 'Algerian dinar (د.ج)',
|
||||
EGP: 'Egyptian pound (EGP)',
|
||||
ERN: 'Eritrean nakfa (Nfk)',
|
||||
ETB: 'Ethiopian birr (Br)',
|
||||
EUR: 'Euro (€)',
|
||||
FJD: 'Fijian dollar ($)',
|
||||
FKP: 'Falkland Islands pound (£)',
|
||||
GBP: 'Pound sterling (£)',
|
||||
GEL: 'Georgian lari (₾)',
|
||||
GGP: 'Guernsey pound (£)',
|
||||
GHS: 'Ghana cedi (₵)',
|
||||
GIP: 'Gibraltar pound (£)',
|
||||
GMD: 'Gambian dalasi (D)',
|
||||
GNF: 'Guinean franc (Fr)',
|
||||
GTQ: 'Guatemalan quetzal (Q)',
|
||||
GYD: 'Guyanese dollar ($)',
|
||||
HKD: 'Hong Kong dollar ($)',
|
||||
HNL: 'Honduran lempira (L)',
|
||||
HRK: 'Croatian kuna (kn)',
|
||||
HTG: 'Haitian gourde (G)',
|
||||
HUF: 'Hungarian forint (Ft)',
|
||||
IDR: 'Indonesian rupiah (Rp)',
|
||||
ILS: 'Israeli new shekel (₪)',
|
||||
IMP: 'Manx pound (£)',
|
||||
INR: 'Indian rupee (₹)',
|
||||
IQD: 'Iraqi dinar (د.ع)',
|
||||
IRR: 'Iranian rial (﷼)',
|
||||
IRT: 'Iranian toman (تومان)',
|
||||
ISK: 'Icelandic króna (kr.)',
|
||||
JEP: 'Jersey pound (£)',
|
||||
JMD: 'Jamaican dollar ($)',
|
||||
JOD: 'Jordanian dinar (د.ا)',
|
||||
JPY: 'Japanese yen (¥)',
|
||||
KES: 'Kenyan shilling (KSh)',
|
||||
KGS: 'Kyrgyzstani som (сом)',
|
||||
KHR: 'Cambodian riel (៛)',
|
||||
KMF: 'Comorian franc (Fr)',
|
||||
KPW: 'North Korean won (₩)',
|
||||
KRW: 'South Korean won (₩)',
|
||||
KWD: 'Kuwaiti dinar (د.ك)',
|
||||
KYD: 'Cayman Islands dollar ($)',
|
||||
KZT: 'Kazakhstani tenge (₸)',
|
||||
LAK: 'Lao kip (₭)',
|
||||
LBP: 'Lebanese pound (ل.ل)',
|
||||
LKR: 'Sri Lankan rupee (රු)',
|
||||
LRD: 'Liberian dollar ($)',
|
||||
LSL: 'Lesotho loti (L)',
|
||||
MAD: 'Moroccan dirham (د.م.)',
|
||||
MDL: 'Moldovan leu (MDL)',
|
||||
MGA: 'Malagasy ariary (Ar)',
|
||||
MKD: 'Macedonian denar (ден)',
|
||||
MMK: 'Burmese kyat (Ks)',
|
||||
MNT: 'Mongolian tögrög (₮)',
|
||||
MOP: 'Macanese pataca (P)',
|
||||
MRU: 'Mauritanian ouguiya (UM)',
|
||||
MUR: 'Mauritian rupee (₨)',
|
||||
MVR: 'Maldivian rufiyaa (.ރ)',
|
||||
MWK: 'Malawian kwacha (MK)',
|
||||
MXN: 'Mexican peso ($)',
|
||||
MYR: 'Malaysian ringgit (RM)',
|
||||
MZN: 'Mozambican metical (MT)',
|
||||
NAD: 'Namibian dollar (N$)',
|
||||
NGN: 'Nigerian naira (₦)',
|
||||
NIO: 'Nicaraguan córdoba (C$)',
|
||||
NOK: 'Norwegian krone (kr)',
|
||||
NPR: 'Nepalese rupee (₨)',
|
||||
NZD: 'New Zealand dollar ($)',
|
||||
OMR: 'Omani rial (ر.ع.)',
|
||||
PAB: 'Panamanian balboa (B/.)',
|
||||
PEN: 'Sol (S/)',
|
||||
PGK: 'Papua New Guinean kina (K)',
|
||||
PHP: 'Philippine peso (₱)',
|
||||
PKR: 'Pakistani rupee (₨)',
|
||||
PLN: 'Polish złoty (zł)',
|
||||
PRB: 'Transnistrian ruble (р.)',
|
||||
PYG: 'Paraguayan guaraní (₲)',
|
||||
QAR: 'Qatari riyal (ر.ق)',
|
||||
RON: 'Romanian leu (lei)',
|
||||
RSD: 'Serbian dinar (рсд)',
|
||||
RUB: 'Russian ruble (₽)',
|
||||
RWF: 'Rwandan franc (Fr)',
|
||||
SAR: 'Saudi riyal (ر.س)',
|
||||
SBD: 'Solomon Islands dollar ($)',
|
||||
SCR: 'Seychellois rupee (₨)',
|
||||
SDG: 'Sudanese pound (ج.س.)',
|
||||
SEK: 'Swedish krona (kr)',
|
||||
SGD: 'Singapore dollar ($)',
|
||||
SHP: 'Saint Helena pound (£)',
|
||||
SLL: 'Sierra Leonean leone (Le)',
|
||||
SOS: 'Somali shilling (Sh)',
|
||||
SRD: 'Surinamese dollar ($)',
|
||||
SSP: 'South Sudanese pound (£)',
|
||||
STN: 'São Tomé and Príncipe dobra (Db)',
|
||||
SYP: 'Syrian pound (ل.س)',
|
||||
SZL: 'Swazi lilangeni (E)',
|
||||
THB: 'Thai baht (฿)',
|
||||
TJS: 'Tajikistani somoni (ЅМ)',
|
||||
TMT: 'Turkmenistan manat (m)',
|
||||
TND: 'Tunisian dinar (د.ت)',
|
||||
TOP: 'Tongan paʻanga (T$)',
|
||||
TRY: 'Turkish lira (₺)',
|
||||
TTD: 'Trinidad and Tobago dollar ($)',
|
||||
TWD: 'New Taiwan dollar (NT$)',
|
||||
TZS: 'Tanzanian shilling (Sh)',
|
||||
UAH: 'Ukrainian hryvnia (₴)',
|
||||
UGX: 'Ugandan shilling (UGX)',
|
||||
USD: 'United States (US) dollar ($)',
|
||||
UYU: 'Uruguayan peso ($)',
|
||||
UZS: 'Uzbekistani som (UZS)',
|
||||
VEF: 'Venezuelan bolívar (2008–2018) (Bs F)',
|
||||
VES: 'Venezuelan bolívar (Bs.)',
|
||||
VND: 'Vietnamese đồng (₫)',
|
||||
VUV: 'Vanuatu vatu (Vt)',
|
||||
WST: 'Samoan tālā (T)',
|
||||
XAF: 'Central African CFA franc (CFA)',
|
||||
XCD: 'East Caribbean dollar ($)',
|
||||
XOF: 'West African CFA franc (CFA)',
|
||||
XPF: 'CFP franc (Fr)',
|
||||
YER: 'Yemeni rial (﷼)',
|
||||
ZAR: 'South African rand (R)',
|
||||
ZMW: 'Zambian kwacha (ZK)',
|
||||
AED: 'United Arab Emirates dirham (د.إ) — AED',
|
||||
AFN: 'Afghan afghani (؋) — AFN',
|
||||
ALL: 'Albanian lek (L) — ALL',
|
||||
AMD: 'Armenian dram (AMD) — AMD',
|
||||
ANG: 'Netherlands Antillean guilder (ƒ) — ANG',
|
||||
AOA: 'Angolan kwanza (Kz) — AOA',
|
||||
ARS: 'Argentine peso ($) — ARS',
|
||||
AUD: 'Australian dollar ($) — AUD',
|
||||
AWG: 'Aruban florin (Afl.) — AWG',
|
||||
AZN: 'Azerbaijani manat (₼) — AZN',
|
||||
BAM: 'Bosnia and Herzegovina convertible mark (KM) — BAM',
|
||||
BBD: 'Barbadian dollar ($) — BBD',
|
||||
BDT: 'Bangladeshi taka (৳ ) — BDT',
|
||||
BGN: 'Bulgarian lev (лв.) — BGN',
|
||||
BHD: 'Bahraini dinar (.د.ب) — BHD',
|
||||
BIF: 'Burundian franc (Fr) — BIF',
|
||||
BMD: 'Bermudian dollar ($) — BMD',
|
||||
BND: 'Brunei dollar ($) — BND',
|
||||
BOB: 'Bolivian boliviano (Bs.) — BOB',
|
||||
BRL: 'Brazilian real (R$) — BRL',
|
||||
BSD: 'Bahamian dollar ($) — BSD',
|
||||
BTC: 'Bitcoin (฿) — BTC',
|
||||
BTN: 'Bhutanese ngultrum (Nu.) — BTN',
|
||||
BWP: 'Botswana pula (P) — BWP',
|
||||
BYR: 'Belarusian ruble (old) (Br) — BYR',
|
||||
BYN: 'Belarusian ruble (Br) — BYN',
|
||||
BZD: 'Belize dollar ($) — BZD',
|
||||
CAD: 'Canadian dollar ($) — CAD',
|
||||
CDF: 'Congolese franc (Fr) — CDF',
|
||||
CHF: 'Swiss franc (CHF) — CHF',
|
||||
CLP: 'Chilean peso ($) — CLP',
|
||||
CNY: 'Chinese yuan (¥) — CNY',
|
||||
COP: 'Colombian peso ($) — COP',
|
||||
CRC: 'Costa Rican colón (₡) — CRC',
|
||||
CUC: 'Cuban convertible peso ($) — CUC',
|
||||
CUP: 'Cuban peso ($) — CUP',
|
||||
CVE: 'Cape Verdean escudo ($) — CVE',
|
||||
CZK: 'Czech koruna (Kč) — CZK',
|
||||
DJF: 'Djiboutian franc (Fr) — DJF',
|
||||
DKK: 'Danish krone (kr.) — DKK',
|
||||
DOP: 'Dominican peso (RD$) — DOP',
|
||||
DZD: 'Algerian dinar (د.ج) — DZD',
|
||||
EGP: 'Egyptian pound (EGP) — EGP',
|
||||
ERN: 'Eritrean nakfa (Nfk) — ERN',
|
||||
ETB: 'Ethiopian birr (Br) — ETB',
|
||||
EUR: 'Euro (€) — EUR',
|
||||
FJD: 'Fijian dollar ($) — FJD',
|
||||
FKP: 'Falkland Islands pound (£) — FKP',
|
||||
GBP: 'Pound sterling (£) — GBP',
|
||||
GEL: 'Georgian lari (₾) — GEL',
|
||||
GGP: 'Guernsey pound (£) — GGP',
|
||||
GHS: 'Ghana cedi (₵) — GHS',
|
||||
GIP: 'Gibraltar pound (£) — GIP',
|
||||
GMD: 'Gambian dalasi (D) — GMD',
|
||||
GNF: 'Guinean franc (Fr) — GNF',
|
||||
GTQ: 'Guatemalan quetzal (Q) — GTQ',
|
||||
GYD: 'Guyanese dollar ($) — GYD',
|
||||
HKD: 'Hong Kong dollar ($) — HKD',
|
||||
HNL: 'Honduran lempira (L) — HNL',
|
||||
HRK: 'Croatian kuna (kn) — HRK',
|
||||
HTG: 'Haitian gourde (G) — HTG',
|
||||
HUF: 'Hungarian forint (Ft) — HUF',
|
||||
IDR: 'Indonesian rupiah (Rp) — IDR',
|
||||
ILS: 'Israeli new shekel (₪) — ILS',
|
||||
IMP: 'Manx pound (£) — IMP',
|
||||
INR: 'Indian rupee (₹) — INR',
|
||||
IQD: 'Iraqi dinar (د.ع) — IQD',
|
||||
IRR: 'Iranian rial (﷼) — IRR',
|
||||
IRT: 'Iranian toman (تومان) — IRT',
|
||||
ISK: 'Icelandic króna (kr.) — ISK',
|
||||
JEP: 'Jersey pound (£) — JEP',
|
||||
JMD: 'Jamaican dollar ($) — JMD',
|
||||
JOD: 'Jordanian dinar (د.ا) — JOD',
|
||||
JPY: 'Japanese yen (¥) — JPY',
|
||||
KES: 'Kenyan shilling (KSh) — KES',
|
||||
KGS: 'Kyrgyzstani som (сом) — KGS',
|
||||
KHR: 'Cambodian riel (៛) — KHR',
|
||||
KMF: 'Comorian franc (Fr) — KMF',
|
||||
KPW: 'North Korean won (₩) — KPW',
|
||||
KRW: 'South Korean won (₩) — KRW',
|
||||
KWD: 'Kuwaiti dinar (د.ك) — KWD',
|
||||
KYD: 'Cayman Islands dollar ($) — KYD',
|
||||
KZT: 'Kazakhstani tenge (₸) — KZT',
|
||||
LAK: 'Lao kip (₭) — LAK',
|
||||
LBP: 'Lebanese pound (ل.ل) — LBP',
|
||||
LKR: 'Sri Lankan rupee (රු) — LKR',
|
||||
LRD: 'Liberian dollar ($) — LRD',
|
||||
LSL: 'Lesotho loti (L) — LSL',
|
||||
MAD: 'Moroccan dirham (د.م.) — MAD',
|
||||
MDL: 'Moldovan leu (MDL) — MDL',
|
||||
MGA: 'Malagasy ariary (Ar) — MGA',
|
||||
MKD: 'Macedonian denar (ден) — MKD',
|
||||
MMK: 'Burmese kyat (Ks) — MMK',
|
||||
MNT: 'Mongolian tögrög (₮) — MNT',
|
||||
MOP: 'Macanese pataca (P) — MOP',
|
||||
MRU: 'Mauritanian ouguiya (UM) — MRU',
|
||||
MUR: 'Mauritian rupee (₨) — MUR',
|
||||
MVR: 'Maldivian rufiyaa (.ރ) — MVR',
|
||||
MWK: 'Malawian kwacha (MK) — MWK',
|
||||
MXN: 'Mexican peso ($) — MXN',
|
||||
MYR: 'Malaysian ringgit (RM) — MYR',
|
||||
MZN: 'Mozambican metical (MT) — MZN',
|
||||
NAD: 'Namibian dollar (N$) — NAD',
|
||||
NGN: 'Nigerian naira (₦) — NGN',
|
||||
NIO: 'Nicaraguan córdoba (C$) — NIO',
|
||||
NOK: 'Norwegian krone (kr) — NOK',
|
||||
NPR: 'Nepalese rupee (₨) — NPR',
|
||||
NZD: 'New Zealand dollar ($) — NZD',
|
||||
OMR: 'Omani rial (ر.ع.) — OMR',
|
||||
PAB: 'Panamanian balboa (B/.) — PAB',
|
||||
PEN: 'Sol (S/) — PEN',
|
||||
PGK: 'Papua New Guinean kina (K) — PGK',
|
||||
PHP: 'Philippine peso (₱) — PHP',
|
||||
PKR: 'Pakistani rupee (₨) — PKR',
|
||||
PLN: 'Polish złoty (zł) — PLN',
|
||||
PRB: 'Transnistrian ruble (р.) — PRB',
|
||||
PYG: 'Paraguayan guaraní (₲) — PYG',
|
||||
QAR: 'Qatari riyal (ر.ق) — QAR',
|
||||
RON: 'Romanian leu (lei) — RON',
|
||||
RSD: 'Serbian dinar (рсд) — RSD',
|
||||
RUB: 'Russian ruble (₽) — RUB',
|
||||
RWF: 'Rwandan franc (Fr) — RWF',
|
||||
SAR: 'Saudi riyal (ر.س) — SAR',
|
||||
SBD: 'Solomon Islands dollar ($) — SBD',
|
||||
SCR: 'Seychellois rupee (₨) — SCR',
|
||||
SDG: 'Sudanese pound (ج.س.) — SDG',
|
||||
SEK: 'Swedish krona (kr) — SEK',
|
||||
SGD: 'Singapore dollar ($) — SGD',
|
||||
SHP: 'Saint Helena pound (£) — SHP',
|
||||
SLL: 'Sierra Leonean leone (Le) — SLL',
|
||||
SOS: 'Somali shilling (Sh) — SOS',
|
||||
SRD: 'Surinamese dollar ($) — SRD',
|
||||
SSP: 'South Sudanese pound (£) — SSP',
|
||||
STN: 'São Tomé and Príncipe dobra (Db) — STN',
|
||||
SYP: 'Syrian pound (ل.س) — SYP',
|
||||
SZL: 'Swazi lilangeni (E) — SZL',
|
||||
THB: 'Thai baht (฿) — THB',
|
||||
TJS: 'Tajikistani somoni (ЅМ) — TJS',
|
||||
TMT: 'Turkmenistan manat (m) — TMT',
|
||||
TND: 'Tunisian dinar (د.ت) — TND',
|
||||
TOP: 'Tongan paʻanga (T$) — TOP',
|
||||
TRY: 'Turkish lira (₺) — TRY',
|
||||
TTD: 'Trinidad and Tobago dollar ($) — TTD',
|
||||
TWD: 'New Taiwan dollar (NT$) — TWD',
|
||||
TZS: 'Tanzanian shilling (Sh) — TZS',
|
||||
UAH: 'Ukrainian hryvnia (₴) — UAH',
|
||||
UGX: 'Ugandan shilling (UGX) — UGX',
|
||||
USD: 'United States (US) dollar ($) — USD',
|
||||
UYU: 'Uruguayan peso ($) — UYU',
|
||||
UZS: 'Uzbekistani som (UZS) — UZS',
|
||||
VEF: 'Venezuelan bolívar (2008–2018) (Bs F) — VEF',
|
||||
VES: 'Venezuelan bolívar (Bs.) — VES',
|
||||
VND: 'Vietnamese đồng (₫) — VND',
|
||||
VUV: 'Vanuatu vatu (Vt) — VUV',
|
||||
WST: 'Samoan tālā (T) — WST',
|
||||
XAF: 'Central African CFA franc (CFA) — XAF',
|
||||
XCD: 'East Caribbean dollar ($) — XCD',
|
||||
XOF: 'West African CFA franc (CFA) — XOF',
|
||||
XPF: 'CFP franc (Fr) — XPF',
|
||||
YER: 'Yemeni rial (﷼) — YER',
|
||||
ZAR: 'South African rand (R) — ZAR',
|
||||
ZMW: 'Zambian kwacha (ZK) — ZMW',
|
||||
};
|
||||
|
||||
const externalCurrencies = {
|
||||
|
|
|
@ -101,8 +101,8 @@ class WC_Settings_General_Test extends WC_Settings_Unit_Test_Case {
|
|||
$currencies = $currency_setting['options'];
|
||||
|
||||
$expected = array(
|
||||
'c1' => 'Currency 1 (symbol for c1)',
|
||||
'c2' => 'Currency 2 (symbol for c2)',
|
||||
'c1' => 'Currency 1 (symbol for c1) — c1',
|
||||
'c2' => 'Currency 2 (symbol for c2) — c2',
|
||||
);
|
||||
|
||||
$this->assertEquals( $expected, $currencies );
|
||||
|
|
Loading…
Reference in New Issue