我正在使用 dexterity xml 模型,并正在寻找一种从我的模型中提取 i18n 字符串的方法。它看起来不像 i18ndude 或 infrae.i18nextract 这样做。因此,我的 xml 模型中的所有翻译字符串都不会显示在生成的 .pot 文件中。
一些模型有超过30个字段,因此手动提取变得繁琐。
最佳答案
i18ndude 从模型文件中提取 i18n 消息没有任何问题;检查您是否包含您的域名并标记要提取的字符串。
查看我们的i18n script并检查比较,例如 collective.cover's model与你的:
<?xml version="1.0" ?>
<model xmlns="http://namespaces.plone.org/supermodel/schema"
xmlns:form="http://namespaces.plone.org/supermodel/form"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="collective.cover">
<schema>
<field name="template_layout" type="zope.schema.Choice" form:widget="collective.cover.widgets.selectpreview.SelectFieldWidget"
form:omitted="z3c.form.interfaces.IEditForm:true">
<description i18n:translate=""
>Choose one of the predefined layouts</description>
<title i18n:translate="">Layout</title>
<vocabulary>collective.cover.AvailableLayouts</vocabulary>
<default>Empty layout</default>
</field>
<field name="cover_layout" type="zope.schema.Text"
form:omitted="z3c.form.interfaces.IForm:true
z3c.form.interfaces.IAddForm:true
z3c.form.interfaces.IEditForm:true">
<description i18n:translate=""
>The layout to be used to render groups and tiles</description>
<title i18n:translate="">Cover Layout</title>
</field>
</schema>
</model>
关于Plone:从 dexterity xml 模型中提取 i18n 字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25644648/