diff --git a/babel/numbers.py b/babel/numbers.py index 83424ec19..2f9894c24 100644 --- a/babel/numbers.py +++ b/babel/numbers.py @@ -696,7 +696,7 @@ def _get_compact_format( plural_form = locale.plural_form(abs(scaled)) if plural_form not in compact_format: plural_form = "other" - if scaled == 1 and "1" in compact_format: + if scaled == 1 and str(magnitude) in compact_format.get("1", {}): plural_form = "1" if str(magnitude) not in compact_format[plural_form]: plural_form = "other" # fall back to other as the implicit default diff --git a/tests/test_numbers_format_decimal.py b/tests/test_numbers_format_decimal.py index 124c5b96d..c9074286b 100644 --- a/tests/test_numbers_format_decimal.py +++ b/tests/test_numbers_format_decimal.py @@ -169,6 +169,7 @@ def test_compact(): assert numbers.format_compact_decimal(1234, locale='it', format_type='long') == '1 mila' assert numbers.format_compact_decimal(1000, locale='fr', format_type='long') == 'mille' assert numbers.format_compact_decimal(1234, locale='fr', format_type='long') == '1 millier' + assert numbers.format_compact_decimal(1000000, locale='fr', format_type='long') == '1 million' assert numbers.format_compact_decimal( 12345, format_type="short", locale='ar_EG', fraction_digits=2, numbering_system='default', ) == '12٫34\xa0ألف'