In my settings.py file, I have:
settings.py
LANGUAGE_CODE = 'ru-RU'
In addition, django-admin-tools are installed and working for me. But the administrator language is still English. What am I doing wrong?
PS.
$ cat settings.py | grep USE | grep -v USER USE_I18N = True USE_L10N = True USE_TZ = True
You need to set the language specifically for the admin application. Since django does not provide a drop-down language as part of the default login, you have several options:
Log in to your normal (non-administrative mode), with superuser / staff privileges and the correct language, and then go to the admin URL.
Update admin templates and add a drop-down list to this snippet .
Create your own custom middleware to set the language for the administrator:
from django.conf import settings from django.utils import translation class AdminLocaleMiddleware: def process_request(self, request): if request.path.startswith('/admin'): request.LANG = getattr(settings, 'ADMIN_LANGUAGE_CODE', settings.LANGUAGE_CODE) translation.activate(request.LANG) request.LANGUAGE_CODE = request.LANG
Add it to MIDDLEWARE_CLASSES
MIDDLEWARE_CLASSES
MIDDLEWARE_CLASSES = { # ... 'foo.bar.AdminLocaleMiddleware', # ... }
Set the language you want for the administrator in settings.py :
ADMIN_LANGUAGE_CODE = 'ru-RU'
Check if you have translation and localization in settings.py :
USE_I18N = True USE_L10N = True
Also check if you have a translation file ( .mo , .po ) for the Russian language.
.mo
.po
Source: https://habr.com/ru/post/918871/More articles:Proxy authentication requires error while using web service - c #Should commands be asynchronous in CQRS? - designConverting Modperl configuration to Plack - running different handlers using the file extension - perlDeployment with capistrano ignores group setting - chmodConditional group on sql server? - sql-serverWhat is the relationship between OnModelCreating and non automatic Migrations? - code-first-migrationsWhat is the difference between arrays of arrays and multidimensional arrays? - cIs it faster to use Python or Java data structures? - javaHow to create an Android project with openjdk on Ubuntu? - androidRails resource pipeline - how to include an asset not in the asset path? - ruby-on-railsAll Articles