babel icon indicating copy to clipboard operation
babel copied to clipboard

Unnatural formatting of negative currency

Open michaelfm1211 opened this issue 3 years ago • 0 comments

Overview Description

When using babel.numbers.format_currency, the negative currency is formatted with the negative sign before the currency name, like '-$100.00' and -CHF 100.00. See this Stack Overflow question for more examples. In some locales this doesn't make much of a change (ex: in en_US both -$100 and $-100 looks OK), however, in others it doesn't make as much sense (ex: in de_CH the difference between -CHF 100.50 and CHF -100.50 is more noticeable).

Steps to Reproduce

Run format_currency() with a custom format and pass a negative value for the currency. For example:

format_currency(value, 'CHF', '¤¤ #,##0.00', locale='de_CH')

Actual Results

'-CHF 100.50'

Expected Results

'CHF -100.50'

Reproducibility

This is the default behavior.

michaelfm1211 avatar Dec 23 '22 00:12 michaelfm1211