Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 金字塔本地化:未创建.pot文件_Python_Localization_Pyramid_Mako - Fatal编程技术网

Python 金字塔本地化:未创建.pot文件

Python 金字塔本地化:未创建.pot文件,python,localization,pyramid,mako,Python,Localization,Pyramid,Mako,我需要本地化我的金字塔应用程序,但我有一个问题。 setup.py文件包含以下message\u提取器变量: message_extractors = { '.': [ ('templates/**.html', 'mako', None), ('templates/**.mako', 'mako', None), ('static/**', 'ignore', None) ]}, 我已经创建了目录my\u package\u name/locale。在\u

我需要本地化我的金字塔应用程序,但我有一个问题。
setup.py
文件包含以下
message\u提取器
变量:

message_extractors = { '.': [
      ('templates/**.html', 'mako', None),
      ('templates/**.mako', 'mako', None),
      ('static/**', 'ignore', None)
]},
我已经创建了目录
my\u package\u name/locale
。在
\uuuu init\uuuu.py
中,我添加了
config.add\u translation\u dirs('my\u package\u name:locale')

但是,当我跑步时
(my\u virtual\u env):python setup.py extract\u消息

我收到信息

running extract_messages
error: no output file specified`
如果我理解正确,
extract_messages
在本例中不需要--output file参数


这种行为的原因是什么

您还需要setup.cfg与setup.py位于同一目录中,大致包含以下内容:

[compile_catalog]
directory = YOURPROJECT/locale
domain = YOURPROJECT
statistics = true

[extract_messages]
add_comments = TRANSLATORS:
output_file = YOURPROJECT/locale/YOURPROJECT.pot
width = 80

[init_catalog]
domain = YOURPROJECT
input_file = YOURPROJECT/locale/YOURPROJECT.pot
output_dir = YOURPROJECT/locale

[update_catalog]
domain = YOURPROJECT
input_file = YOURPROJECT/locale/YOURPROJECT.pot
output_dir = YOURPROJECT/locale
previous = true
当然,您将用项目名称替换您的项目。我认为setup.cfg文件在pyramid 1.5之前是项目的一部分,但现在pyramid使用lingua和gettext而不是babel,不再需要它了。如果您遵循当前的金字塔文档,您可能会过得更好:

您还需要setup.cfg与setup.py位于同一目录中,大致包含以下内容:

[compile_catalog]
directory = YOURPROJECT/locale
domain = YOURPROJECT
statistics = true

[extract_messages]
add_comments = TRANSLATORS:
output_file = YOURPROJECT/locale/YOURPROJECT.pot
width = 80

[init_catalog]
domain = YOURPROJECT
input_file = YOURPROJECT/locale/YOURPROJECT.pot
output_dir = YOURPROJECT/locale

[update_catalog]
domain = YOURPROJECT
input_file = YOURPROJECT/locale/YOURPROJECT.pot
output_dir = YOURPROJECT/locale
previous = true
当然,您将用项目名称替换您的项目。我认为setup.cfg文件在pyramid 1.5之前是项目的一部分,但现在pyramid使用lingua和gettext而不是babel,不再需要它了。如果您遵循当前的金字塔文档,您可能会过得更好: