summaryrefslogtreecommitdiff
path: root/django/utils/translation
diff options
context:
space:
mode:
authorSergio <smaisidoro@gmail.com>2022-10-02 13:59:13 +0300
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-10-13 10:38:26 +0200
commit94e7f471c4edef845a4fe5e3160132997b4cca81 (patch)
treee470a0ca3cb2ac861b2ac62b805c042381ba3c72 /django/utils/translation
parent004f985b918d5ea36fbed9b050459dd22edaf396 (diff)
Fixed #34069 -- Made LocaleMiddleware respect language from requests when i18n patterns are used.
Diffstat (limited to 'django/utils/translation')
-rw-r--r--django/utils/translation/trans_null.py2
-rw-r--r--django/utils/translation/trans_real.py6
2 files changed, 2 insertions, 6 deletions
diff --git a/django/utils/translation/trans_null.py b/django/utils/translation/trans_null.py
index c8bfb1256e..595a705e2b 100644
--- a/django/utils/translation/trans_null.py
+++ b/django/utils/translation/trans_null.py
@@ -53,7 +53,7 @@ def check_for_language(x):
def get_language_from_request(request, check_path=False):
- return settings.LANGUAGE_CODE
+ return None
def get_language_from_path(request):
diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
index 423f30eaba..595a9ec2e4 100644
--- a/django/utils/translation/trans_real.py
+++ b/django/utils/translation/trans_real.py
@@ -578,11 +578,7 @@ def get_language_from_request(request, check_path=False):
return get_supported_language_variant(accept_lang)
except LookupError:
continue
-
- try:
- return get_supported_language_variant(settings.LANGUAGE_CODE)
- except LookupError:
- return settings.LANGUAGE_CODE
+ return None
@functools.lru_cache(maxsize=1000)