I create a site-portfolio on django for studying and I wanted to make it possible to view the site in 3 languages ​​(en, ru, uk). Before I started doing this, the dates were displayed in Russian ( http://cashik.pythonanywhere.com/ ) and now they are always displayed in English, no matter what language I choose. I understand why the dates are displayed in English (the translation of the names of the months, etc. is not in my local file), but I do not want to translate all the files (admin panel, dates.py, etc.). Perhaps there is an option to make the django look at the phrase in the local .po file, and if it does not find it, then translate it with standard means?

  • The formatting system is disabled by default. To enable it, it’s necessary to set USE_L10N = True in your settings file. docs.djangoproject.com/en/1.10/topics/i18n/formatting - Igor
  • This option is enabled. But when you read the language of the Russian data rates to be displayed in English. This is an important format! - Alexandr Ovdienko
  • code settings.py, where and when it continues to be displayed, this code is responsible for the locale. If the translation is a different way, template tags are used. - Igor

1 answer 1

Solved a problem. It turned out that the django.po files in the $ PYTHONPATH / django / conf / locale / (ru and uk) directories were completely commented out in some way. I just found how these files should look like and replaced them with my corrupted files.

Most likely, the problem was due to the fact that I dabbled with the commands makemessages and compilemessages.

So far, everything works correctly for commands with parameters

makemessages -l lang -e html compilemessages -l lang