Opened 9 years ago

Closed 9 years ago

#24913 closed Bug (duplicate)

Localize filter tag doesn't work for thousand separator then USE_L10N is False

Reported by: Krupin Dmitry Owned by: Ana Balica
Component: Internationalization Version: 1.7
Severity: Normal Keywords: localize
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Ana Balica)

In settings.py set
USE_L10N = False
USE_THOUSAND_SEPARATOR = True

In the template do this:

 {% localize on %}
      {{ object.price }}
 {% endlocalize %}

or

{{ object.price|localize }}

Switching on the localization doesn't trigger the USE_THOUSAND_SEPARATOR setting in case it's set to True.

I think in util.formats.number_format function should be something like this

 if use_l10n:
      force_grouping = True

Change History (5)

comment:1 by Ana Balica, 9 years ago

Triage Stage: UnreviewedAccepted

Been able to reproduce with the latest Django 1.9.dev20150604012012. The documentation isn't very specific on this topic, even though it would feel natural that by switching on localization, the setting of USE_THOUSAND_SEPARATOR should be respected.

comment:2 by Ana Balica, 9 years ago

Needs tests: set
Owner: changed from nobody to Ana Balica
Status: newassigned

comment:3 by Ana Balica, 9 years ago

Description: modified (diff)
Summary: localize filter tag not work for thousand separator then USE_L10N is FalseLocalize filter tag doesn't work for thousand separator then USE_L10N is False

comment:4 by Tim Graham, 9 years ago

Elsewhere docs say, "When USE_L10N is set to True and if this is also set to True, Django will use the values of THOUSAND_SEPARATOR and NUMBER_GROUPING to format numbers." so I think this might be invalid.

comment:5 by Markus Holtermann, 9 years ago

Resolution: duplicate
Status: assignedclosed

This is a duplicate of #21544 which I think is a valid issue.

Note: See TracTickets for help on using tickets.
Back to Top