0.1.1 fix lang

This commit is contained in:
SDE
2023-12-08 15:33:04 +03:00
parent e336ed38aa
commit b4cdacda57
2 changed files with 6 additions and 0 deletions

View File

@@ -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/<str:url>/', StaticPageView, name='static_page'),

View File

@@ -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']