2

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

Rajeev
  • 44,985
  • 76
  • 186
  • 285

1 Answers1

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:

  1. change the code (that potentially has translation strings),
  2. run python manage.py makemessages -l [language]
  3. edit the .po
  4. (optional, to check possible mistakes: run python manage.py compilemessages -l [language] and runserver to test translations)
  5. commit the changes of both the code and the .po
  6. push to master

In production machine:

  1. pull from origin
  2. 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