4

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.zcmlていi18: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が登場しない理由や、警告を取り除く方法はありますか?

4

1 に答える 1

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と同じではありません。:-)

于 2012-09-20T19:50:12.260 に答える