You did not specify an i18n translation domain for ... in your [genericsetupprofrof registration] in Plone

When I launch Plone, I get a warning from a custom product

/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 

However, configure.zcml i18:domain installed. I also set it directly with some additional attributes to be sure:

 <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> 

This is the related code warning:

 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) 

Any idea why i18n: domain is not suitable or how to get rid of the warning?

+4
source share
1 answer

Note that the code looks for i18n_domain with underscore, but instead you specified it as i18n:domain , instead of names.

The following works:

 <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 doesn't match ZPT when it comes to internationalization. :-)

+5
source

Source: https://habr.com/ru/post/1435350/


All Articles