[fix] online_currency.py: if more alternatives, use the last in the list

If there are more than one ISO 4217 numeric codes [1] for a currency use the
last one in the list of alternatives [2].

[1] https://en.wikipedia.org/wiki/ISO_4217#Active_codes_(list_one)
[2] https://en.wikipedia.org/wiki/ISO_4217#Historical_codes

Closes: https://github.com/searxng/searxng/issues/3713
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2024-08-08 18:26:46 +02:00 committed by Markus Heiser
parent 2986681b31
commit c96ba25f5b

View file

@ -23,7 +23,7 @@ def name_to_iso4217(name):
currency = CURRENCIES['names'].get(name, [name]) currency = CURRENCIES['names'].get(name, [name])
if isinstance(currency, str): if isinstance(currency, str):
return currency return currency
return currency[0] return currency[-1]
def iso4217_to_name(iso4217, language): def iso4217_to_name(iso4217, language):