Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
873 views
in Technique[技术] by (71.8m points)

python - django i18n: Make sure you have GNU gettext tools

I try django-admin.py makemessages -l zh_CN but has error :

CommandError: Can't find msguniq. Make sure you have GNU gettext tools 0.15 or newer installed.

after I use brew install gettext,it still get wrong.
Do I need to do something? here is my terminal screenshot
Please guide me thank you.

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

For Mac users, after installing Homebrew and gettext as @Louis Barranqueiro says (steps 1 and 2):

  1. Install Homebrew : /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Install GNU gettext : brew install gettext

You shouldn't use brew link gettext --force in step 3, because it is risky (as Brew advises if you try). A better workaround is to set a new PATH variable for your virtual environment. So, in the postactivate file, which is located in the bin folder of your virtual environment folder, type:

export TEMP_PATH=$PATH
export PATH=$PATH:/usr/local/Cellar/gettext/0.19.7/bin

Note that you have to replace 0.19.7 by the version that is installed in your machine.

And in your predeactivate file, which is located in the same folder of postactivate file, type:

export PATH=$TEMP_PATH
unset TEMP_PATH

Now you can use the python manage.py makemessages -l <desired_language> without worries. :)

Cheers.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...