I am using localization in Django 1.11
application. I can exclude the virtual environment folder and node_modules
folder while adding the messages in message file using -i
option like:
django-admin makemessages -l 'no' -i venv
django-admin makemessages -d djangojs --locale no -i venv -i node_modules
After adding the translations I am compiling messages using:
django-admin compilemessages
It processes django.po
files of all installed packages located in virtual environment folder. Thus it takes longer time to finish compiling translations.
I did not find any argument parameter to skip a specific path from compilemessages
command in documentation.
Is there any option to skip the venv
or specific path from compilemessages
?
As others already stated, sadly there are only hacks to deal with this.
The one I found to be most transparent was to debug into
compilemessages
and look at thesubprocess
calls it issues. From that you can derive the direct calls to themsgfmt
tool.For our comparably simple project,
makemessages
collects the*.po
files inlocale/$LANGUAGE/LC_MESSAGES/django.po
. Thenmsgfmt
would put the generated*.mo
in the same folder. So we just wrote a script to perform steps like this:This is of course incredibly clumsy but easy to understand and extend. Hopefully
compilemessages
will get an--ignore
option eventually.THE BEST HACK I FOUND TO IGNORE THE VENV IS:
(This little hack from a workmate avoids compiling the venv .po)
(Method #2)
Before that, I was trying the more complicated way of using the --exclude flag
github
Unfortunately this is for locales, but it is the only thing I found so far
From these internal communications on the development of Django, I can see the ignore flag has been copied from makemessages to compilemessages for a future version
For my own usage I used (excluding es and en)