summaryrefslogtreecommitdiff
path: root/babel/numbers.py
diff options
context:
space:
mode:
authorJun Omae <jun66j5@gmail.com>2022-05-08 00:50:21 +0900
committerAarni Koskela <akx@iki.fi>2022-05-10 07:30:54 +0200
commitb203c672a265bc9d4e6b44cc46359d9414252736 (patch)
tree6bd25e6f067c259d596fb1fe758fbf48fc9a9203 /babel/numbers.py
parent3ae540289aa4669f0cab079876b05863abee0f0d (diff)
downloadbabel-b203c672a265bc9d4e6b44cc46359d9414252736.tar.gz
Fallback count="other" format in format_currency()
Diffstat (limited to 'babel/numbers.py')
-rw-r--r--babel/numbers.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/babel/numbers.py b/babel/numbers.py
index 6e15fd3..904ebbe 100644
--- a/babel/numbers.py
+++ b/babel/numbers.py
@@ -127,7 +127,11 @@ def get_currency_name(currency, count=None, locale=LC_NUMERIC):
plural_form = loc.plural_form(count)
plural_names = loc._data['currency_names_plural']
if currency in plural_names:
- return plural_names[currency][plural_form]
+ currency_plural_names = plural_names[currency]
+ if plural_form in currency_plural_names:
+ return currency_plural_names[plural_form]
+ if 'other' in currency_plural_names:
+ return currency_plural_names['other']
return loc.currencies.get(currency, currency)