Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.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 Pybabel extract在从html模板提取关键字时添加了额外的单引号_Python_Regex_Google App Engine_Internationalization_Python Babel - Fatal编程技术网

Python Pybabel extract在从html模板提取关键字时添加了额外的单引号

Python Pybabel extract在从html模板提取关键字时添加了额外的单引号,python,regex,google-app-engine,internationalization,python-babel,Python,Regex,Google App Engine,Internationalization,Python Babel,我有一个运行python和jinja2 html模板的应用程序引擎应用程序。我正在使用pybabel将其国际化。当我运行命令pybabel extract-F babel.cfg-o./locale/messages.pot./从模板中提取时,它会向带有单引号的字符串添加额外的单引号,并对使用双引号的关键字转义双引号 例如: 我正在提取这些字符串: index.html <h1 class="offset2 span10 pageTitle">{{ _("appname") }}&l

我有一个运行python和jinja2 html模板的应用程序引擎应用程序。我正在使用pybabel将其国际化。当我运行命令
pybabel extract-F babel.cfg-o./locale/messages.pot./
从模板中提取时,它会向带有单引号的字符串添加额外的单引号,并对使用双引号的关键字转义双引号

例如: 我正在提取这些字符串:

index.html
<h1 class="offset2 span10 pageTitle">{{ _("appname") }}</h1> 
<p>{{ _('about') }}</p> 
这是行不通的。预期(如果我手动删除不需要的字符,则已确认工作)输出应为:

messages.pot
#: templates/index.html:57
msgid "appname"
msgstr ""

#: templates/index.html:58
msgid "about"
msgstr ""
在运行pybabel提取后的messages.pot中

当然,当我更新、编译并运行应用程序时,这不起作用,但如果我删除额外添加的单引号和转义引号,它会按预期工作。如果在模板文件中的关键字上不使用引号,则它将不起作用

babel.cfg文件非常简单:

[django: templates/**.*]
[python: /**.py]
encoding = utf-8
[extractors]
jinja2 = jinja2.ext:babel_extract

关于如何使pybabel extract在从模板提取关键字时不包含额外引号的任何建议?或者从文件中提取的任何其他方法?

问题出在babel.cfg文件中。 从

[django: templates/**.*]

[django: templates/**.*]
[jinja2: templates/**.*]