Issue
I'm reading the django documentation for makemessages
but the wording is not very clear:
Runs over the entire source tree of the current directory and pulls out all strings marked for translation. It creates (or updates) a message file in the conf/locale (in the Django tree) or locale (for project and application) directory. After making changes to the messages files you need to compile them with compilemessages for use with the builtin gettext support.
In the text above it doesn't seem clear to me what it means that makemessages
would "pull out" strings marked for translation. (pull them out for what? where to?)
Meanwhile the compilemessages
description makes sense as this simply compiles the messages once I've changed the language files.
When, if ever, should I use makemessages
if compilemessages
does the job I am seeking? What is the point of makemessages
?
Solution
makemessages
is used to scan through your apps looking for strings marked for translation. Once it has theses strings it puts them in a po
file. If you then add further strings for translating to your app then you will need to run makemessages
to generate an updated po
file. compilemessages
uses the contents of the po
file to create a mo
file, so the po
file must be updated first.
makemessages
accepts a param for the locale:
pipenv run django-admin makemessages --locale=de
This allows you to create a po
file for each of the locales your app supports.
Answered By - Stu
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.