金字塔 i18n 和 HTML5
.pt 文件的 Pyramid i18n 是否支持 HTML5 标记?目前,i18n 标签提取器(Babel?)似乎需要基于 XHTML 的输入,并且不接受 HTML5 标记。因此,如果您想在 .pt 文件中使用 i18n,您必须以 XML 的方式编写它们?
Does Pyramid i18n of .pt files support HTML5 mark-up? Currently the i18n tag extractor (Babel?) seems to want XHTML based input and does not accept HTML5 mark-up. Thus if you want to use i18n in .pt files you are forced to write them in XML'ish way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Chameleon 1 包含两个 Babel 提取插件(一个用于 python 代码,一个用于 XML 文件),这就是 Pyramid 文档所指的内容。 Chameleon 2 不再包含这些插件,而是专注于其作为模板库的核心功能。这两个插件已被清理,现在包含在新的 lingua 包中。金字塔文档已更新以反映自 Pyramid 1.1 以来的情况(正如您可以在金字塔 1.1 国际化章节)。
lingua XML 插件使用 expat 来解析其输入,因此在 HTML 上确实会失败不使用 XML 表示法的文件。因为我个人强烈地认为 XML 表示法是一个更好的选择,所以我不太可能让 lingua 实现支持非 XML 语法。有一个例外:lingua 确实允许缺少名称空间声明。
Chameleon 1 included two Babel extraction plugins (one for python code and one for XML files), which is what the Pyramid documentation is referring to. Chameleon 2 no longer includes those plugins and focuses on its core functionality of being a template library. These two plugins have been cleaned up and are now included in the new lingua package. The pyramid documentation has been updated to reflect that since Pyramid 1.1 (as you can see in the Pyramid 1.1 i18n chapter).
The lingua XML plugin uses expat to parse its input, so will indeed fail on HTML files that do not use XML notation. Since I personally feel quite strongly that XML notation is a much better choice I am not likely to chance the lingua implementation to support non-XML syntax. There is one exception: lingua does allow for missing namespace declaration.