我正试图让gettext在我的OSX Leopard上使用Django
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
在终端我得到同样的错误,除非我把它放在我的bash配置文件中:
PATH=$PATH:/Applications/Poedit.app/Contents/MacOS/
但后来我收到了这个错误:
Error: errors happened while running msguniq
/bin/sh: msguniq: command not found os x
答案 0 :(得分:97)
安装后,尝试链接gettext。这解决了我的问题。
brew install gettext
brew link gettext --force
答案 1 :(得分:10)
我认为您需要安装gettext。 Poedit仅包含gettext包提供的一些程序。
安装(不仅仅是)gettext的最简单方法可能是通过homebrew。安装自制软件后,运行brew install gettext
。之后,请确保/usr/local/Cellar/gettext/0.18.1.1/bin
中的程序位于$PATH
。
请注意,您需要为自制软件安装Xcode,因为它通常从源代码安装软件包(您可以从Mac App Store免费获取Xcode for Lion)。
编辑:我忽略了你不使用Lion。对于Snow Leopard,您可以从App Store以5美元的价格购买XCode。我认为LeC的XCode是安装盘上的。
答案 2 :(得分:7)
强制brew link
可能会导致负面后果。修改虚拟环境的PATH而不是强制链接更好。所以,
安装GNU gettext:
brew install gettext
将其添加到您的虚拟环境中:
# 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