From b203c672a265bc9d4e6b44cc46359d9414252736 Mon Sep 17 00:00:00 2001 From: Jun Omae Date: Sun, 8 May 2022 00:50:21 +0900 Subject: Fallback count="other" format in format_currency() --- babel/numbers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'babel/numbers.py') 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) -- cgit v1.2.1