diff --git a/ServicesApp/js_urls.py b/ServicesApp/js_urls.py index d2ad1de..1a634a4 100644 --- a/ServicesApp/js_urls.py +++ b/ServicesApp/js_urls.py @@ -4,6 +4,7 @@ from django.conf.urls.static import static from django.conf import settings from .js_views import * + urlpatterns = [ path('get_content_for_section/', get_content_for_section_ajax, name='get_content_for_section_ajax'), # path('page//', StaticPageView, name='static_page'), diff --git a/ServicesApp/js_views.py b/ServicesApp/js_views.py index 680b933..dae5506 100644 --- a/ServicesApp/js_views.py +++ b/ServicesApp/js_views.py @@ -14,6 +14,8 @@ from datetime import datetime from django.template.loader import render_to_string from django.urls import reverse from .funcs import * +from django.utils.translation import activate, get_language_info + def get_content_for_section_ajax(request): @@ -26,6 +28,9 @@ def get_content_for_section_ajax(request): if not data and request.body: data = json.loads(request.body) + if 'lang' in data: + activate(data['lang']) + if 'screen_width' in data and data['screen_width']: request.session['screen_width'] = data['screen_width']