From 3d55f2966d6821fd1fd29d90d1d07c195ae8c2cc Mon Sep 17 00:00:00 2001
From: lufafajoshua <77637648+lufafajoshua@users.noreply.github.com>
Date: Mon, 24 Jun 2024 12:02:55 +0200
Subject: [PATCH] [5.1.x] Fixed #35306 -- Documented fallback localization
 formats in templates when localization is disabled.

Backport of 3ac0e43207b4a1b9327ba12612005c285fbff7ee from main.
---
 docs/ref/settings.txt           | 9 ++++++---
 docs/topics/i18n/formatting.txt | 8 ++++++--
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
index ee25eab0dd..292adb3bac 100644
--- a/docs/ref/settings.txt
+++ b/docs/ref/settings.txt
@@ -1843,9 +1843,7 @@ standard :term:`language ID format <language code>`. For example, U.S. English
 is ``"en-us"``. See also the `list of language identifiers`_ and
 :doc:`/topics/i18n/index`.
 
-:setting:`USE_I18N` must be active for this setting to have any effect.
-
-It serves two purposes:
+It serves three purposes:
 
 * If the locale middleware isn't in use, it decides which translation is served
   to all users.
@@ -1853,6 +1851,11 @@ It serves two purposes:
   user's preferred language can't be determined or is not supported by the
   website. It also provides the fallback translation when a translation for a
   given literal doesn't exist for the user's preferred language.
+* If localization is explicitly disabled via the :tfilter:`unlocalize` filter
+  or the :ttag:`{% localize off %}<localize>` tag, it provides fallback
+  localization formats which will be applied instead. See
+  :ref:`controlling localization in templates <topic-l10n-templates>` for
+  details.
 
 See :ref:`how-django-discovers-language-preference` for more details.
 
diff --git a/docs/topics/i18n/formatting.txt b/docs/topics/i18n/formatting.txt
index 1010ce2e84..e1b6213ca2 100644
--- a/docs/topics/i18n/formatting.txt
+++ b/docs/topics/i18n/formatting.txt
@@ -89,6 +89,9 @@ To activate or deactivate localization for a template block, use:
         {{ value }}
     {% endlocalize %}
 
+When localization is disabled, the :ref:`localization settings <settings-l10n>`
+formats are applied.
+
 See :tfilter:`localize` and :tfilter:`unlocalize` for template filters that will
 do the same job on a per-variable basis.
 
@@ -133,8 +136,9 @@ To force localization of a single value, use :tfilter:`localize`. To
 control localization over a large section of a template, use the
 :ttag:`localize` template tag.
 
-Returns a string representation for unlocalized numbers  (``int``, ``float``,
-or ``Decimal``).
+Returns a string representation for numbers  (``int``, ``float``, or
+``Decimal``) with the :ref:`localization settings <settings-l10n>` formats
+applied.
 
 .. _custom-format-files: