Django Internationalization, gettext and Mac OS X

The Django Internationalization translation machinery uses the standard gettext module that comes with Python (supposedly). When I tried to update the message file for our translation with the following command:

python makemessages -l nl

I received the following error:

Error: errors happened while running xgettext on
/bin/sh: xgettext: command not found

Uh seemed that my Mac OS X (Snow Leopard) was missing gettext, a set of tools that provides a framework to help other GNU packages produce multi-lingual messages. Even though I have Xcode installed on my system, I was still missing the gettext program.

How to solve this problem?

First, I did a Spotlight search for gettext and found that there was a gettext program in /sw/bin/ that seemed to be part of Fink (an open source software collection and package manager I played with for a little while when I tried fixing other installation problems). That gettext did not seem to be working correctly however, so I continued my search online.

There was not a lot of information to be found on this problem through Google but one hint was to install a program called Poedit and add a reference to it to the PATH variable (add this line to your .bash_profile or .profile - depending on which one you use - PATH=$PATH:/Applications/ ).

Now, however I got another error message when trying to update the message file:

Error: errors happened while running msguniq
/bin/sh: msguniq: command not found os x

I was unable to find any useful information on that error message online so I decided to try and start over again. Because I did not trust the solution to gettext completely, I decided to take a look at the /sw/bin/ version of gettext. That lead me to take another look into Fink - a distribution of Unix Open Source software for Mac OS X and Darwin and a package manager. It brings a wide range of free command-line and graphical software developed for Linux and similar operating systems to your Mac.

After having updated my Fink configuration (sudo fink configure) and repaired it (my Fink installation somehow got damaged), I searched through the package list (fink list) and installed gettext and gettext-tools (sudo fink install gettext-tools).

After adding the path to the gettext directory /sw/bin/ to my PATH variable (add PATH=$PATH:/sw/bin/ to your .bash_profile or .profile) and trying to update the message file again: it worked!

I am going to try out using Fink more often for installing certain open source software and libraries.

  • Enjoyed this post? Please share it with others:
  • Favicon
  • Digg Favicon
  • Facebook Favicon
  • Google Favicon
  • LinkedIn Favicon
  • Reddit Favicon
  • Technorati Favicon
  • TwitThis Favicon
Page 1 of 1 pages