On my system i have changed mgstr in django.po
and compiled it and i get the translation as expected.Now my question is should i run manage.py compilemessages
even on the production machine or checkin the binary file(django.mo
) so that when it is checked out on prod machine compilation step may be skipped. What is the standard way to go about this
Asked
Active
Viewed 215 times
2

Rajeev
- 44,985
- 76
- 186
- 285
1 Answers
0
Typically, .mo files are git-ignored. This means it makes sense to re-compilemessages after you checkout the latest revision.
EDIT:
The procedure I use is the following: .po are part of git rep, .mo are git-ignored.
In development:
- change the code (that potentially has translation strings),
- run
python manage.py makemessages -l [language]
- edit the
.po
- (optional, to check possible mistakes: run
python manage.py compilemessages -l [language]
and runserver to test translations) - commit the changes of both the code and the .po
- push to master
In production machine:
- pull from origin
python manage.py compilemessages -l [language]
At this point, .mo is created on the production from the .po you pulled from the master.
One way to automate this is to use Fabric, a python lib for writing automated scripts for deploying code (e.g. Django) on servers.

Jorge Leitao
- 19,085
- 19
- 85
- 121
-
In production i dont see the translation. What might be the issue? Also how and when are the messages compiled on any new machine – Rajeev Apr 30 '14 at 10:51
-
@Rajeev, I added a more detailed description of the procedure. – Jorge Leitao Apr 30 '14 at 15:01