django makemessages问题

时间:2016-06-01 04:47:52

标签: python django translation

我在Windows 7上运行python 2.7和django 1.8.11。

添加必要的翻译字符串文字后,我正在尝试翻译我的网站。我按照docs按照说明操作。这包括installing the GNU gettext utilities for windows 7以及正确语言代码中必要的语言环境文件夹/目录。

在虚拟环境中&在我的项目的根目录的命令提示符下,我运行:

django-admin makemessages -l de

我在命令提示符处遇到以下错误:

CommandError: Unable to find a locale path to store translations for file fabfile.py

在我的项目的根目录中,我有以下文件,这是fabfile.py所在的位置:

enter image description here

我已尝试(暂时)从目录中删除fabfile.py。当我尝试这个时,运行django-admin makemessages -l de时收到的错误消息是:

CommandError: Unable to find a locale path to store translations for file manage.py

makemessages命令似乎包含根目录中的所有.py.txt文件。我不确定这是否是正确的程序。

我如何不包含.py&运行makemessages命令时,项目根目录中的.txt文件?

2 个答案:

答案 0 :(得分:4)

我不确定如何或为什么,但是当我昨天尝试这个时,它没有用,但现在确实有效。非常令人沮丧。

我必须在项目根目录中运行makemessages命令一个额外目录。

我希望这可以帮助那些人。

答案 1 :(得分:1)

You must mkdir locale at folder of fabfile.py and manage.py.