Search code examples
pythondjangowindowsgnugettext

How to install gnu gettext (>0.15) on windows? So I can produce .po/.mo files in Django


When runing django make messages:

./manage.py makemessages -l pt

I get:

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

I tried to install but the last version I find with an Instalation Setup is 0.14. Where may I find a recent version and how do I install it?


Solution

  • The easiest way is to download the precompiled binary installer. Download the "static" flavor of your Operating System (32bit or 64bit) and simple run the installer.

    Update the system PATH:

    Control Panel > System > Advanced > Environment Variables

    In the System variables list, click Path, click Edit and then New. Add C:\Program Files\gettext-iconv\bin value.

    To check if it's working, go to cmd, navigate to your project folder and type

    "manage makemessages -l de".

    You may have to configure the path to store translations. Create a dir named "locale" in your project dir and point to it at settings.py

    Also make sure to set the local path in settings.py file:

    LOCALE_PATHS = (
        BASE_DIR + 'locale/', )