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 = ( This option is also possible:
for x in (0, 1, 2, 3, 4): if not x & 1: print ""%d is even"" % x Log in to leave an answer