Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django i18n: Make sure you have GNU gettext tools

Tags:

python

django

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

like image 536
user2492364 Avatar asked Dec 01 '14 00:12

user2492364


4 Answers

In Ubuntu:

$ sudo apt-get install gettext
like image 199
Joe Cheng Avatar answered Nov 19 '22 01:11

Joe Cheng


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.

like image 20
reinaldoluckman Avatar answered Nov 19 '22 02:11

reinaldoluckman


This procedure worked for me (OSX 10.11.2 - python v3.5 and Django 1.8) It should work with your configuration.

Install gettext GNU tools with Homebrew using Terminal

  1. Install Homebrew : /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Install GNU gettext : brew install gettext
  3. Create symlink : brew link gettext --force
like image 13
Louis Barranqueiro Avatar answered Nov 19 '22 02:11

Louis Barranqueiro


This solution worked for me ( win. 7, 8 and 10 )

You need to download two folders:

  • gettext-runtime_0.18.1.1-2_win32
  • gettext-tools-dev_0.18.1.1-2_win32

You can find them here.

  • After you download them, unzip them and add the directory of the bin file of the both folders to the system variables PATH of your pc.

  • You will also need a file named libstdc++-6.dll download it from here and place it in your system directory. You will find adequate details on system directory here.

And that’s it. Hope it is useful for you.

like image 10
Far Avatar answered Nov 19 '22 01:11

Far