Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django intcomma not working with localization

Tags:

django

I'm using django and I realized that intcomma template tag not working in special languages!

When the locale is en it works fine, but when I want to use persian language (locale fa) nothing really happens and django doesn't humanize the number

like image 636
kianoosh Avatar asked Aug 10 '16 06:08

kianoosh


1 Answers

The tag does not know how to format numbers for the Persian language and leaves them unchanged. Try to use tag like this

{{ value|intcomma:False }}

The first argument of intcomma is use_l10n. Passing False to it force tag to use default behavior.

like image 96
Sergey Gornostaev Avatar answered Oct 16 '22 09:10

Sergey Gornostaev