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

旧城冷巷雨未停 提交于 2019-12-05 05:04:06

Django removed this explanation from the recent docs and it took me some time to found it so i pasted it here before this old documentation goes offline:

Source: Django Docs 1.7

Download the following zip files from the GNOME servers

  • gettext-runtime-X.zip
  • gettext-tools-X.zip

X is the version number (It needs to be 0.15 or higher)

Extract the contents of the bin\ directories in both files to the same folder on your system (i.e. C:\Program Files\gettext-utils)

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-utils\bin value.

You may also use gettext binaries you have obtained elsewhere, so long as the xgettext --version command works properly. Do not attempt to use Django translation utilities with a gettext package if the command xgettext --version entered at a Windows command prompt causes a popup window saying “xgettext.exe has generated errors and will be closed by Windows”.

After doing this I tested and ./manage.py makemessages -l pt works

Bruno Lucena

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/', )

I also had the same problem. After that I downloaded and installed this and everything worked.https://mlocati.github.io/articles/gettext-iconv-windows.html.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!