diff --git a/django/views/i18n.py b/django/views/i18n.py index c7ee1b33bd..37ec10b552 100644 --- a/django/views/i18n.py +++ b/django/views/i18n.py @@ -6,7 +6,7 @@ from django import http from django.conf import settings from django.template import Context, Template from django.utils import importlib -from django.utils.translation import check_for_language, activate, to_locale, get_language +from django.utils.translation import check_for_language, to_locale, get_language from django.utils.encoding import smart_text from django.utils.formats import get_format_modules, get_format from django.utils._os import upath @@ -205,17 +205,18 @@ def javascript_catalog(request, domain='djangojs', packages=None): go to the djangojs domain. But this might be needed if you deliver your JavaScript source from Django templates. """ - if request.GET: - if 'language' in request.GET: - if check_for_language(request.GET['language']): - activate(request.GET['language']) + default_locale = to_locale(settings.LANGUAGE_CODE) + locale = to_locale(get_language()) + + if request.GET and 'language' in request.GET: + if check_for_language(request.GET['language']): + locale = to_locale(request.GET['language']) + if packages is None: packages = ['django.conf'] if isinstance(packages, six.string_types): packages = packages.split('+') packages = [p for p in packages if p == 'django.conf' or p in settings.INSTALLED_APPS] - default_locale = to_locale(settings.LANGUAGE_CODE) - locale = to_locale(get_language()) t = {} paths = [] en_selected = locale.startswith('en')