Django does not create .po translation files

I have translation strings only in templates (stored in the project_dir / Templates file), I tried to run $ django-admin.py createmessages -l ru both in the project root directory and in application directories that use templates with trans. strings. He created the locale / ru / LC_MESSAGES folders, but the folders were empty. I tried adding django.po files manually (with the syntax specified in l10n docs). And executed the createmessages -a and compilemessages commands. He created .mo files, but translations did not appear in the browser.

  • When I created the .po files manually, I did not have lines starting with C #. What should I write there?
  • My template files are located in a different folder than the .py files for applications. Should I add some additional links to them?
+4
source share
1 answer

Have you tried:

 python manage.py makemessages -a 

from the root of the project and application?

this should create the .po you need to edit. don't forget to remove “fuzzy” things everywhere.

then:

 python manage.py compilemessages 

You need to restart the server

+8
source

Source: https://habr.com/ru/post/1334433/


All Articles