Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Internationalisation Django (on OSX)

I'm trying to get gettext to work in Django on my OSX Leopard

django_manage.py makemessages -l nl
Importing Django settings module settings
processing language nl
Error: errors happened while running xgettext on __init__.py
/bin/sh: xgettext: command not found

In Terminal I get the same error, unless I put this in my bash profile:

PATH=$PATH:/Applications/Poedit.app/Contents/MacOS/

But then I get this error:

Error: errors happened while running msguniq
/bin/sh: msguniq: command not found os x 
like image 821
Cluesane Avatar asked Jul 28 '11 14:07

Cluesane


3 Answers

After installing, try linking gettext. This solved the problem for me.

brew install gettext
brew link gettext --force
like image 181
dominik Avatar answered Nov 01 '22 04:11

dominik


I think you need to install gettext. Poedit includes only some of the programs provided by the gettext package.

Probably the easiest way to install (not only) gettext is via homebrew. Once you have homebrew installed, run brew install gettext. After that, make sure that the programs in /usr/local/Cellar/gettext/0.18.1.1/bin are on your $PATH.

Note that you need to have Xcode installed for homebrew to work as it usually installs packages from source (you can get Xcode for Lion for free from the Mac App Store).

Edit: I overlooked that you don't use Lion. For Snow Leopard, you can get XCode from the App Store for $5. XCode For Leopard is I think on the installation disk.

like image 10
Jakub Roztocil Avatar answered Nov 01 '22 04:11

Jakub Roztocil


Forcing brew link may result in negative consequences. It's better to modify virtual environment's PATH instead of force-linking. So,

  1. Install GNU gettext:

    brew install gettext
    
  2. Add it to your virtual environment:

    # Get this from the brew's "Summary"
    GETTEXT_PATH="/usr/local/Cellar/gettext/0.19.8.1/bin" 
    
    # Change "postactivate" to "activate" if you're using python3's venv
    FILE="YOUR_VENV/bin/postactivate"   
    
    echo "" >> $FILE
    echo "export PATH=\$PATH:$GETTEXT_PATH" >> $FILE
    
like image 7
Max Malysh Avatar answered Nov 01 '22 03:11

Max Malysh