Collecting messages from third-party applications in Django

How can I generate messages (manage.py makemessages) from a third-party library located in the virtualenv directory?

I tried just adding messages to the .po file, but every time I run the makemessages command, my translation disappears.

Many thanks

+5
source share
1 answer

manage.py makemessages only looks for directories in the current directory. Therefore, you need to create a symbolic link from a third-party application to your project directory:

 ln -s ~/.virtualenvs/myvenv/local/lib/python2.7/site-packages/app app mkdir locale python manage.py makemessages -l cz -s 

Note the -s . It forces makemessages follow symbolic links.

Another caveat is that if app already localized, then .po will create the app/locale/cz file instead of locale .

+6
source

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


All Articles