From b4cdacda5708651e41be52d71105e8499c31f153 Mon Sep 17 00:00:00 2001 From: SDE Date: Fri, 8 Dec 2023 15:33:04 +0300 Subject: [PATCH] 0.1.1 fix lang --- ServicesApp/js_urls.py | 1 + ServicesApp/js_views.py | 5 +++++ 2 files changed, 6 insertions(+) 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']