I already set USE_L10N = True in settings.py
But in following view:
from django.contrib.humanize.templatetags.humanize import intcomma
dev view_name(request):
output = intcomma(123456)
Output is always "123,456" for all locales.
I already set USE_L10N = True in settings.py
But in following view:
from django.contrib.humanize.templatetags.humanize import intcomma
dev view_name(request):
output = intcomma(123456)
Output is always "123,456" for all locales.
I think intcomma() does the same for all locales:
def intcomma(value):
"""
Converts an integer to a string containing commas every three digits.
For example, 3000 becomes '3,000' and 45000 becomes '45,000'.
"""
orig = force_unicode(value)
new = re.sub("^(-?\d+)(\d{3})", '\g<1>,\g<2>', orig)
if orig == new:
return new
else:
return intcomma(new)
intcomma.is_safe = True
register.filter(intcomma)
You can modify this function and pass the separator as an argument.