I am the opportunity to switch between the Russian, English and Ukrainian version on the site. He wrapped the lines in the templates that must be translated into the { % Trans %} tag, the lines in the code, translated everything and compiled the translation. He also installed
Switch the tongue through django.conurls.i18n , so I created the following idea:
def select_lang ( request, Code ): go_next = redest.meta.get ( 'http_referer' , '/' ) response = Httpresponshedirect (go_next) if code and worklation.check_for_language (Code): if hasttr (request, 'session' ): read.session [ 'django_language' ] = code else : response.set_cookie (settings.language_cookie_name, code) Translation.activate (Code) retu response I go to the browser to/lang/uk, the page is rebooted and the tongue remains the same. If you enter the address/uk/about - the page is translated, but when moving to another tongue, it retus again.
what is the problem, tell me, please!
here are my workleware , they may business:
Middleware_classes = [ '' django.middleware class = ""> 'django.contrib.sessions.middleware Class = ""> 'django.middleware.csrf.csrfViewmidleware' , 'Django.contrib.auth.middenware.auticalNeticationMidleware' , 'Django.contrib.middenware.sessionauticalwareware' , 'django.contrib.messages.middleware.messagemidleware'
, 'django.middleware.clickjacking.xframeoptionsmidleware' , 'django.middleware.locale.localemidleware' , ] p.s. The language of the site on default is Russian, like the whole text in the code and in templates. But I have English by default. Through the headlines of the "" "Accept-Language En-Sus, En; Q = 0.5" "
p.s.s. I checked the vyuhi function, at the output of read.session ['django_language'] is a language code that I need.
question@mail.ru
·