Plone:从 dexterity xml 模型中提取 i18n 字符串

标签 plone dexterity

我正在使用 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/

相关文章:

jquery - 如何使 prepOverlay 与 createObject 一起使用?

Plone 目录重建 : AttributeError portal_setup

Plone/dexterity - 在事件中,如何更改只有所有者拥有查看权限的内容类型对象的所有权角色?

error-handling - 向用户添加共享权限时发生AttributeError

email - 如何使用模板方法在 Plone 中发送带有附件的邮件?

plone - 列出敏捷对象的字段

描述字段后的 Plone 敏捷注入(inject)行为字段

plone - ConnectionStateError 的可能原因是什么?

forms - 如何创建一个类似于 MultiContentTreeFieldWidget 但保留项目顺序的 Plone 表单小部件