Changes between Initial Version and Version 1 of Ticket #30086


Ignore:
Timestamp:
Jan 9, 2019, 10:10:54 AM (6 years ago)
Author:
Tim Graham
Comment:

As long as the behavior doesn't contract existing documentation, perhaps the solution is the document the current behavior.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #30086

    • Property Component Template systemDocumentation
    • Property Triage Stage UnreviewedAccepted
    • Property Summary The numberformat template filter does not respect local localization settingsDocument how floatformat template filter interacts with the localize template tag
    • Property Type BugCleanup/optimization
  • Ticket #30086 – Description

    initial v1  
    11Specifically, when the filter is used within the `{% localize [on|off] %}` block with the localization setting opposed to the value of `USE_L10N` ('on' when `USE_L10N = False` or 'off' when `USE_L10N = True`), the localization setting has not effect.
    22
    3 This is due to the use of `formats.number_format()` without its `use_l10n` parameter, by the `numberformat` template filter (e.g. https://github.com/django/django/blob/master/django/template/defaultfilters.py#L144, https://github.com/django/django/blob/master/django/template/defaultfilters.py#L163). The value of the `use_l10n` parameter shall be taken out of the template rendering context. But I do not see any easy solution to this, as filters do not take context...
     3This is due to the use of `formats.number_format()` without its `use_l10n` parameter, by the `numberformat` template filter (e.g. https://github.com/django/django/blob/c2c85663e2dd06c9ed9c9ec2d02202d6d668d7f0/django/template/defaultfilters.py#L144, https://github.com/django/django/blob/c2c85663e2dd06c9ed9c9ec2d02202d6d668d7f0/django/template/defaultfilters.py#L163). The value of the `use_l10n` parameter shall be taken out of the template rendering context. But I do not see any easy solution to this, as filters do not take context...
Back to Top