Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
880 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 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...