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
After installing, try linking gettext. This solved the problem for me.
brew install gettext
brew link gettext --force
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.
Forcing brew link
may result in negative consequences. It's better to modify virtual environment's PATH instead of force-linking. So,
Install GNU gettext:
brew install gettext
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
精彩评论