Skip to content

Commit

Permalink
Merge pull request #267 from eduNEXT/jlc/revert-language-selector-error
Browse files Browse the repository at this point in the history
FIX : Revert "feat: add site language config"
  • Loading branch information
johanseto committed Jul 28, 2022
2 parents 8901991 + 4dea2cc commit e08be24
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
10 changes: 0 additions & 10 deletions openedx/core/djangoapps/dark_lang/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

from openedx.core.djangoapps.dark_lang import DARK_LANGUAGE_KEY
from openedx.core.djangoapps.dark_lang.models import DarkLangConfig
from openedx.core.djangoapps.site_configuration.helpers import get_value
from openedx.core.djangoapps.user_api.preferences.api import get_user_preference

# If django 1.7 or higher is used, the right-side can be updated with new-style codes.
Expand Down Expand Up @@ -91,17 +90,8 @@ def process_request(self, request):
return

self._clean_accept_headers(request)
self._set_site_or_microsite_language(request)
self._activate_preview_language(request)

def _set_site_or_microsite_language(self, request):
"""
Apply language specified in site configuration.
"""
language = get_value('LANGUAGE_CODE', None)
if language:
request.session[LANGUAGE_SESSION_KEY] = language

def _fuzzy_match(self, lang_code):
"""Returns a fuzzy match for lang_code"""
match = None
Expand Down
11 changes: 0 additions & 11 deletions openedx/core/djangoapps/dark_lang/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

from openedx.core.djangoapps.dark_lang.middleware import DarkLangMiddleware
from openedx.core.djangoapps.dark_lang.models import DarkLangConfig
from openedx.core.djangoapps.site_configuration.tests.test_util import with_site_configuration
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
from common.djangoapps.student.tests.factories import UserFactory

Expand Down Expand Up @@ -263,16 +262,6 @@ def _set_client_session_language(self, session_language):
session[LANGUAGE_SESSION_KEY] = session_language
session.save()

@with_site_configuration(configuration={'LANGUAGE_CODE': 'rel'})
def test_site_configuration_language(self):
# `LANGUAGE_CODE` in site configuration should override session lang
self._set_client_session_language('notrel')
self.client.get('/home')
self.assert_session_lang_equals(
'rel',
self.client.session
)

def test_preview_lang_with_released_language(self):
# Preview lang should always override selection
self._post_set_preview_lang('rel')
Expand Down

0 comments on commit e08be24

Please sign in to comment.