Avatar ·

How to change the language for a user on a Django site?

📁 Advanced Python Topics, django

I am implementing the ability to switch between Russian, English, and Ukrainian versions on the site. I wrapped the strings in templates that need to be translated in the {% trans %} tag, strings in the code, translated everything and compiled the translation. I also set locale_url.

In settings.py I specified:

LANGUAGE_CODE = 'Ru-ru'LANGUAGES = (    ('en', 'English'),    ('ru', 'Russian'),    ('uk', 'Ukrainian'),)TIME_ZONE = 'Europe/Kiev'USE_I18N = TrueUSE_L10N = TrueUSE_TZ = TrueLOCALE_PATHS = (