Deploying Django translations with django-rosetta

by Kevin Grinberg on Feb 25, 2011

One of Django’s big strengths is excellent support for internationalization (“i18n”).

The built-in tooling is great for creating message files to send to translators, and then deploying them with the application. However, what if you need a quick admin-like way to tweak a translation? Enter django-rosetta, an excellent helper tool that gives you an admin-like interface to your translations (.po/.mo files).

The one problem with django-rosetta is how it fits (or doesn’t fit) into our standard deployment workflow. We use git for source control, and the basic assumption is that we can deploy a build from master at any time.

The problem with that is that on the one hand, the locale message files (translations) clearly need to live with the source; on the other hand, translators making changes via django-rosetta aren’t in a position to learn git and commit their changes back.

The solution we’ve started using is two-fold:

1) Keep the translations in a separate repository, symlinked from the main repo for convenience.

2) Before running “makemessages” (which updates the message files with any changes from the application), we commit and push any changes the translators have made on the server using rosetta, then pull them locally (we use Fabric for deployments, so we just made a fab command for this).

Note that any changes should still go through the normal translation/release cycle, since you’ll generally want to update any translations before releasing the update! But at least this way, translators can make minor changes on the fly without you losing the benefits of DVCS.

About Kevin Grinberg

Kevin Grinberg is a partner and developer at Active Frequency. He's been programming since the MARQUEE tag was frequently seen in the wild, and hopes to one day see lemurs in the wild.