templatetags: work around multiple spaces in newer num2words output (#82017)
gitea/hobo/pipeline/head There was a failure building this commit
Details
gitea/hobo/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
67609853be
commit
62211149b6
|
@ -57,8 +57,12 @@ def as_numeral_currency(number):
|
|||
if not number:
|
||||
return ''
|
||||
try:
|
||||
# workaround newer num2words always specifiying cents
|
||||
return num2words(unlazy(number), lang=get_language(), to='currency').removesuffix(' et zéro centimes')
|
||||
# workaround newer num2words always specifiying cents, and outputting consecutive spaces
|
||||
return (
|
||||
num2words(unlazy(number), lang=get_language(), to='currency')
|
||||
.removesuffix(' et zéro centimes')
|
||||
.replace(' ', ' ')
|
||||
)
|
||||
except (TypeError, ValueError, decimal.InvalidOperation):
|
||||
return ''
|
||||
|
||||
|
|
Loading…
Reference in New Issue