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.
Just below solution solved my problem. I am using Windows 10 64bit
1- Go to this link : https://mlocati.github.io/articles/gettext-iconv-windows.html
2- Download 32 or 64 bit shared and static windows installation files
3-Install both of files
4-Restart your computer
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
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install gettext
brew link gettext --force
Hi first of all make sure that your virtual environment is not in your root folder. I think it's better practice to keep your virtual environment outside of the root folder. Obviously make sure your environment is activated. Of course make sure you have gettext installed as well.
If your env folder is in your root folder
To test this just make sure you add {% load i18n %} in all your templates, choose a template and do something like this:
Now run this command
(Make sure you replace
your_venv
to the name of your virtual environment.After you run the above command, you should get this in your terminal.
Now you should have a locale folder like this:
locale/cn/LC_MESSAGES/django.po
Now you will need to compile the messages. Run this command
In your locale folder, now you should get you should see django.mo file as well, but you will notice the difference in django.po file. Just add your translation there, and you can test again by setting your en language to LANGUAGE_CODE = 'zh_CN' then just refresh and test the h1 string will be translated to Chinese.
In order for the above to work in your settings.py ensure you have this here, for now most important is the LOCALE_PATHS, but please check if this ('zh_CN', _('Chinese')), is correct
In this reply, the most important part is to realize where your virtual environment is located. Reason why you get all these errors.
Please make sure you refer to this video here, it's a great tutorial. https://www.youtube.com/watch?v=xI97sLMd1rM