django makemessages 问题 [英] django makemessages issue

查看:30
本文介绍了django makemessages 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

添加必要的翻译字符串文字后,我正在尝试翻译我的网站.我已按照

我已尝试(暂时)从目录中删除 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 文件?

解决方案

我不确定如何或为什么,但是当我昨天尝试时,它不起作用,但现在起作用了.非常令人沮丧.

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

我希望这对那里的人有所帮助.

I am running python 2.7 and django 1.8.11 on Windows 7.

After adding in the necessary translation string literals, I am trying to translate my site. I have followed the instructions as per the docs. This includes installing the GNU gettext utilities for windows 7 and the necessary locale folders/directories in the correct language code.

In the virtual environment & at the command prompt of the root directory of my project, I run:

django-admin makemessages -l de

I get the following error at the command prompt:

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

In the root directory of my project, I have the following files, which is where the fabfile.py is located:

I have tried (temporarily) removing the fabfile.py from the directory. When I tried this, the error message I received when running django-admin makemessages -l de is:

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

It appears that the makemessages command is including all the .py and .txt files in the root directory. I am not sure if this is the correct procedure or not.

How do I not include the .py & .txt files in the root directory of my project when I run the makemessages command?

解决方案

I am not sure how or why, but when I tried this yesterday, it did not work, but now does work. Very frustrating.

I had to run the makemessages command one extra directory inside my project root directory.

I hope this helps someone out there.

这篇关于django makemessages 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆