gpt4 book ai didi

plone - 您没有在 Plone 的 [genericsetupprofile registration] 中为 ... 指定 i18n 翻译域

转载 作者:行者123 更新时间:2023-12-05 01:20:53 25 4
gpt4 key购买 nike

在 Plone 启动时,我收到来自定制产品的警告

/Users/mikko/code/buildout-cache/eggs/zope.configuration-3.7.4-py2.7.egg/zope/configuration/fields.py:416:
UserWarning: You did not specify an i18n translation domain for the 'title' field in /Users/mikko/code/xxx-dev/src/xxx-eggs/Products.xxxExternal/Products/xxxExternal/configure.zcml

然而在 configure.zcmli18:domain放。我还直接使用一些额外的属性对其进行了设置,以确保:

<configure  xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:i18n="http://namespaces.zope.org/i18n"
i18n:domain="xxxPatient"
>

<include package=".browser" />
<include package="plone.app.z3cform" />

<!-- Register the installation GenericSetup extension profile -->
<genericsetup:registerProfile
name="default"
title="xxxExternal"
directory="profiles/default"
provides="Products.GenericSetup.interfaces.EXTENSION"
i18n:attributes="title; description"
i18n:domain="xxxPatient"
/>


</configure>

这是给出警告的相关代码:

def fromUnicode(self, u):
context = self.context
domain = getattr(context, 'i18n_domain', '')
if not domain:
domain = 'untranslated'
import pdb ; pdb.set_trace()
warnings.warn(
"You did not specify an i18n translation domain for the "\
"'%s' field in %s" % (self.getName(), context.info.file )
)
v = super(MessageID, self).fromUnicode(u)

知道为什么 i18n:domain 没有出现或如何摆脱警告吗?

最佳答案

请注意,代码正在寻找 i18n_domain带有下划线,但您将其指定为 i18n:domain ,而是命名空间值。

以下工作:

<configure  xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="xxxPatient"
>

<include package=".browser" />
<include package="plone.app.z3cform" />

<!-- Register the installation GenericSetup extension profile -->
<genericsetup:registerProfile
name="default"
title="xxxExternal"
directory="profiles/default"
provides="Products.GenericSetup.interfaces.EXTENSION"
/>

</configure>

在国际化方面,ZCML 与 ZPT 不同。 :-)

关于plone - 您没有在 Plone 的 [genericsetupprofile registration] 中为 ... 指定 i18n 翻译域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12518245/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com