Collecting messages from 3rd party apps in Django

五迷三道 提交于 2020-01-01 10:58:32

问题


How can I generate messages (manage.py makemessages) from 3rd party library which is located in virtualenv directory?

I tried simply add the messages to the .po file, but everytime I run makemessages command my translation vanishes.

Many thanks


回答1:


manage.py makemessages looks only for directories under the current dir. So you have to create symlink from 3rd party app to your project's 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 option. It forces makemessages to follow symlinks.

The other caveat is if the app is already localized then .po file will be created under app/locale/cz directory instead of your locale.



来源:https://stackoverflow.com/questions/27988805/collecting-messages-from-3rd-party-apps-in-django

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!