Why is it that Babel does not use the minus sign used by my locale, in functions like format_decimal()
? It seems to me like this would be the very job of a library like Babel.
Is there a way I can enforce the usage of locale specific minus signs?
>>> import babel
>>> babel.__version__
'2.11.0'
>>> from babel.numbers import format_decimal, Locale
>>> l = Locale("sv_SE")
>>> l.number_symbols["minusSign"]
'−'
>>> format_decimal(-1.234, locale=l)
'-1,234'
Despite the fact that Local.number_symbols
clearly contain a different character (in this case U+2212), format_decimal()
(and other Babel formatting functions) use only the fallback hyphen-minus.
I am getting '-1,234'
(with an hyphen-minus) where I would have expected '−1,234'
(with the U+2212 minus sign).