From 4a43335d300da942602fbf216cd0a53b60827ab4 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Wed, 8 Sep 2021 08:37:27 +0200 Subject: Fixed #30086, Refs #32873 -- Made floatformat template filter independent of USE_L10N. --- docs/ref/templates/builtins.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'docs/ref') diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index 936c80cdb5..baf0608a40 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -1736,6 +1736,18 @@ example, when the active locale is ``en`` (English): ``34232.00`` ``{{ value|floatformat:"-3g" }}`` ``34,232`` ============ ================================= ============= +Output is always localized (independently of the :ttag:`{% localize off %} +` tag) unless the argument passed to ``floatformat`` has the ``u`` +suffix, which will force disabling localization. For example, when the active +locale is ``pl`` (Polish): + +============ ================================= ============= +``value`` Template Output +============ ================================= ============= +``34.23234`` ``{{ value|floatformat:"3" }}`` ``34,232`` +``34.23234`` ``{{ value|floatformat:"3u" }}`` ``34.232`` +============ ================================= ============= + Using ``floatformat`` with no argument is equivalent to using ``floatformat`` with an argument of ``-1``. @@ -1743,6 +1755,13 @@ with an argument of ``-1``. The ``g`` suffix to force grouping by thousand separators was added. +.. versionchanged:: 4.0 + + ``floatformat`` template filter no longer depends on the + :setting:`USE_L10N` setting and always returns localized output. + + The ``u`` suffix to force disabling localization was added. + .. templatefilter:: force_escape ``force_escape`` -- cgit v1.3