summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2021-09-09 07:42:05 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-09-14 12:05:43 +0200
commit676bd084f2509f4201561d5c77ed4ecbd157bfa0 (patch)
treebc8dfe6748a6bfc5fe8c728a5f825dfff575cb56 /django/utils
parent04e023e38331d6717af1cbd8da4926af612f7831 (diff)
Fixed #32873 -- Deprecated settings.USE_L10N.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/formats.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/django/utils/formats.py b/django/utils/formats.py
index cffbb34398..781d334a8e 100644
--- a/django/utils/formats.py
+++ b/django/utils/formats.py
@@ -104,7 +104,11 @@ def get_format(format_type, lang=None, use_l10n=None):
If use_l10n is provided and is not None, it forces the value to
be localized (or not), overriding the value of settings.USE_L10N.
"""
- use_l10n = use_l10n or (use_l10n is None and settings.USE_L10N)
+ use_l10n = use_l10n or (use_l10n is None and (
+ settings._USE_L10N_INTERNAL
+ if hasattr(settings, '_USE_L10N_INTERNAL')
+ else settings.USE_L10N
+ ))
if use_l10n and lang is None:
lang = get_language()
cache_key = (format_type, lang)
@@ -168,7 +172,11 @@ def number_format(value, decimal_pos=None, use_l10n=None, force_grouping=False):
If use_l10n is provided and is not None, it forces the value to
be localized (or not), overriding the value of settings.USE_L10N.
"""
- use_l10n = use_l10n or (use_l10n is None and settings.USE_L10N)
+ use_l10n = use_l10n or (use_l10n is None and (
+ settings._USE_L10N_INTERNAL
+ if hasattr(settings, '_USE_L10N_INTERNAL')
+ else settings.USE_L10N
+ ))
lang = get_language() if use_l10n else None
return numberformat.format(
value,