diff options
| author | Claude Paroz <claude@2xlibre.net> | 2021-09-09 07:42:05 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-09-14 12:05:43 +0200 |
| commit | 676bd084f2509f4201561d5c77ed4ecbd157bfa0 (patch) | |
| tree | bc8dfe6748a6bfc5fe8c728a5f825dfff575cb56 /docs | |
| parent | 04e023e38331d6717af1cbd8da4926af612f7831 (diff) | |
Fixed #32873 -- Deprecated settings.USE_L10N.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/internals/deprecation.txt | 2 | ||||
| -rw-r--r-- | docs/ref/settings.txt | 13 | ||||
| -rw-r--r-- | docs/releases/1.10.txt | 2 | ||||
| -rw-r--r-- | docs/releases/1.2.txt | 2 | ||||
| -rw-r--r-- | docs/releases/2.0.txt | 2 | ||||
| -rw-r--r-- | docs/releases/3.2.txt | 2 | ||||
| -rw-r--r-- | docs/releases/4.0.txt | 21 | ||||
| -rw-r--r-- | docs/topics/i18n/formatting.txt | 16 | ||||
| -rw-r--r-- | docs/topics/i18n/timezones.txt | 6 | ||||
| -rw-r--r-- | docs/topics/i18n/translation.txt | 6 |
10 files changed, 41 insertions, 31 deletions
diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt index 77642cffd1..6154fefa3b 100644 --- a/docs/internals/deprecation.txt +++ b/docs/internals/deprecation.txt @@ -34,6 +34,8 @@ details on these changes. ``StringAgg`` aggregates will return ``None`` when there are no rows instead of ``[]``, ``[]``, and ``''`` respectively. +* The ``USE_L10N`` setting will be removed. + .. _deprecation-removed-in-4.1: 4.1 diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt index cc58192bd4..12d89142d1 100644 --- a/docs/ref/settings.txt +++ b/docs/ref/settings.txt @@ -2774,7 +2774,7 @@ See also :setting:`LANGUAGE_CODE`, :setting:`USE_L10N` and :setting:`USE_TZ`. ``USE_L10N`` ------------ -Default: ``False`` +Default: ``True`` A boolean that specifies if localized formatting of data will be enabled by default or not. If this is set to ``True``, e.g. Django will display numbers and @@ -2782,10 +2782,15 @@ dates using the format of the current locale. See also :setting:`LANGUAGE_CODE`, :setting:`USE_I18N` and :setting:`USE_TZ`. -.. note:: +.. versionchanged:: 4.0 - The default :file:`settings.py` file created by :djadmin:`django-admin - startproject <startproject>` includes ``USE_L10N = True`` for convenience. + In older versions, the default value is ``False``. + +.. deprecated:: 4.0 + + This setting is deprecated. Starting with Django 5.0, localized formatting + of data will always be enabled. For example Django will display numbers and + dates using the format of the current locale. .. setting:: USE_THOUSAND_SEPARATOR diff --git a/docs/releases/1.10.txt b/docs/releases/1.10.txt index d2f804b8c1..8b0303352a 100644 --- a/docs/releases/1.10.txt +++ b/docs/releases/1.10.txt @@ -918,7 +918,7 @@ Miscellaneous To adapt, move the fragment outside the template tag: ``{% static 'img.svg' %}#fragment``. -* When :setting:`USE_L10N` is ``True``, localization is now applied for the +* When ``USE_L10N`` is ``True``, localization is now applied for the :tfilter:`date` and :tfilter:`time` filters when no format string is specified. The ``DATE_FORMAT`` and ``TIME_FORMAT`` specifiers from the active locale are used instead of the settings of the same name. diff --git a/docs/releases/1.2.txt b/docs/releases/1.2.txt index 30e39ac1be..5d7d6cc836 100644 --- a/docs/releases/1.2.txt +++ b/docs/releases/1.2.txt @@ -936,7 +936,7 @@ Date format helper functions ``django.utils.translation.get_date_formats()`` and ``django.utils.translation.get_partial_date_formats()`` have been deprecated in favor of the appropriate calls to ``django.utils.formats.get_format()``, -which is locale-aware when :setting:`USE_L10N` is set to ``True``, and falls +which is locale-aware when ``USE_L10N`` is set to ``True``, and falls back to default settings if set to ``False``. To get the different date formats, instead of writing this:: diff --git a/docs/releases/2.0.txt b/docs/releases/2.0.txt index 7ad0a27ed4..c3730a794b 100644 --- a/docs/releases/2.0.txt +++ b/docs/releases/2.0.txt @@ -558,7 +558,7 @@ Miscellaneous * :class:`~django.views.generic.base.RedirectView` no longer silences ``NoReverseMatch`` if the ``pattern_name`` doesn't exist. -* When :setting:`USE_L10N` is off, :class:`~django.forms.FloatField` and +* When ``USE_L10N`` is off, :class:`~django.forms.FloatField` and :class:`~django.forms.DecimalField` now respect :setting:`DECIMAL_SEPARATOR` and :setting:`THOUSAND_SEPARATOR` during validation. For example, with the settings:: diff --git a/docs/releases/3.2.txt b/docs/releases/3.2.txt index 828add0fea..76d1ade6d5 100644 --- a/docs/releases/3.2.txt +++ b/docs/releases/3.2.txt @@ -672,7 +672,7 @@ Miscellaneous and underscores. * The :tfilter:`intcomma` and :tfilter:`intword` template filters no longer - depend on the :setting:`USE_L10N` setting. + depend on the ``USE_L10N`` setting. * Support for ``argon2-cffi`` < 19.1.0 is removed. diff --git a/docs/releases/4.0.txt b/docs/releases/4.0.txt index 8f910ad9db..709363a08f 100644 --- a/docs/releases/4.0.txt +++ b/docs/releases/4.0.txt @@ -579,8 +579,11 @@ Miscellaneous Django 3.2. * The :tfilter:`floatformat` template filter no longer depends on the - :setting:`USE_L10N` setting and always returns localized output. Use the - ``u`` suffix to disable localization. + ``USE_L10N`` setting and always returns localized output. Use the ``u`` + suffix to disable localization. + +* The default value of the ``USE_L10N`` setting is changed to ``True``. See the + :ref:`Localization section <use_l10n_deprecation>` above for more details. .. _deprecated-features-4.0: @@ -601,6 +604,20 @@ Note that the default :file:`settings.py` file created by You can set ``USE_TZ`` to ``False`` in your project settings before then to opt-out. +.. _use_l10n_deprecation: + +Localization +------------ + +In order to follow good practice, the default value of the ``USE_L10N`` setting +is changed from ``False`` to ``True``. + +Moreover ``USE_L10N`` is deprecated as of this release. Starting with Django +5.0, by default, any date or number displayed by Django will be localized. + +The :ttag:`{% localize %} <localize>` tag and the :tfilter:`localize`/ +:tfilter:`unlocalize` filters will still be honored by Django. + Miscellaneous ------------- diff --git a/docs/topics/i18n/formatting.txt b/docs/topics/i18n/formatting.txt index 16fd7ca0cb..671901dcdc 100644 --- a/docs/topics/i18n/formatting.txt +++ b/docs/topics/i18n/formatting.txt @@ -18,18 +18,16 @@ necessary to set :setting:`USE_L10N = True <USE_L10N>` in your settings file. .. note:: - The default :file:`settings.py` file created by :djadmin:`django-admin - startproject <startproject>` includes :setting:`USE_L10N = True <USE_L10N>` - for convenience. Note, however, that to enable number formatting with - thousand separators it is necessary to set :setting:`USE_THOUSAND_SEPARATOR - = True <USE_THOUSAND_SEPARATOR>` in your settings file. Alternatively, you - could use :tfilter:`intcomma` to format numbers in your template. + To enable number formatting with thousand separators, it is necessary to + set :setting:`USE_THOUSAND_SEPARATOR = True <USE_THOUSAND_SEPARATOR>` in + your settings file. Alternatively, you could use :tfilter:`intcomma` to + format numbers in your template. .. note:: - There is also an independent but related :setting:`USE_I18N` setting that - controls if Django should activate translation. See - :doc:`/topics/i18n/translation` for more details. + There is a related :setting:`USE_I18N` setting that controls if Django + should activate translation. See :doc:`/topics/i18n/translation` for more + details. Locale aware input in forms =========================== diff --git a/docs/topics/i18n/timezones.txt b/docs/topics/i18n/timezones.txt index 847e5ff593..5b475bd44f 100644 --- a/docs/topics/i18n/timezones.txt +++ b/docs/topics/i18n/timezones.txt @@ -47,12 +47,6 @@ functions in :mod:`django.utils.timezone`. startproject <startproject>` includes :setting:`USE_TZ = True <USE_TZ>` for convenience. -.. note:: - - There is also an independent but related :setting:`USE_L10N` setting that - controls whether Django should activate format localization. See - :doc:`/topics/i18n/formatting` for more details. - If you're wrestling with a particular problem, start with the :ref:`time zone FAQ <time-zones-faq>`. diff --git a/docs/topics/i18n/translation.txt b/docs/topics/i18n/translation.txt index 4c5b8181bc..99fc41ebb6 100644 --- a/docs/topics/i18n/translation.txt +++ b/docs/topics/i18n/translation.txt @@ -31,12 +31,6 @@ make some optimizations so as not to load the internationalization machinery. .. note:: - There is also an independent but related :setting:`USE_L10N` setting that - controls if Django should implement format localization. See - :doc:`/topics/i18n/formatting` for more details. - -.. note:: - Make sure you've activated translation for your project (the fastest way is to check if :setting:`MIDDLEWARE` includes :mod:`django.middleware.locale.LocaleMiddleware`). If you haven't yet, |
