2012-09-20 32 views
4

指定一个国际化的翻译领域......在你的[genericsetupprofile注册]在Plone的启动时,我得到一个警告,从定制产品你没有在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) 

任何想法,为什么国际化:域名并没有沿着或如何来摆脱警告?

回答

5

请注意,代码正在寻找带下划线的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,当谈到国际化。 :-)

+0

我想i18n命名空间某种标准是什么来XML本地化......为什么ZCML创造者想做一些如此微妙的不同?这是纯粹的邪恶。 –