我正在尝试从金字塔项目的模板文件中翻译文本。或多或少如本例所示:http://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/chameleon_i18n.html
现在如何删除.pot文件注释中的<dynamic element>
?我想看看代码的其余部分及其标记。在
我的变色龙模板(.pt):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="MyDomain">
<head>
...
</head>
<body>
<div i18n:translate="MyID">
This will appear in the comments.
<span>This will NOT.</span>
While this will again appear.
</div>
</body>
</html>
我使用Babel和Lingua从我的设置.py公司名称:
^{pr2}$我的.pot文件中的相关输出如下所示:
#. Default: This will appear in the comments. <dynamic element> While this will
#. again appear.
#: myproject/templates/base.pt:10
msgid "MyID"
msgstr ""
这是明确不支持的:翻译应该只包含文本-它不应该包含标记。否则你会有两个问题:
通常需要翻译包含动态组件或标记的项:对于那些使用i18n:name属性的项。例如,您可以这样做:
<p i18n:translate="">This is <strong i18n:name="very" i18n:translate="">very</strong> important.
这将给您两个要翻译的字符串:}。在
This is ${very} string
和{相关问题 更多 >
编程相关推荐