I'm working on a Plone 4 product, starting from Martin's excellent dexterity
development manual
(http://plone.org/products/dexterity/documentation/manual/developer-manual).
My problem is I can't seem to get all strings translated. The product contains
a dexterity-based content type, for which translatations are working fine. The
translation file is in the i18n/ dir.
The product also contains a page view (Products.Five.BrowserView), which is
unrelated to the content type. Calling '_(u"label_whatever", default="Some
message")' from the view class only returns the 'label_whatever', even if i
submit strings which are translated well otherwise. I've tested this by putting
a pdb break in one the view method of interest.
'_' is the same messagefactory the content type uses, it's simply
zope.i18nmessageid.MessageFactory("my_i18n_domain"). The '_domain' attribute
appears to be set correctly.
I've browsed through
http://plone.org/documentation/manual/upgrade-guide/version/upgrading-plone-3-x-to-4.0/updating-add-on-products-for-plone-4.0/referencemanual-all-pages
and the code examples in http://dev.plone.org/collective/changeset/100277 to
find an alternative way to do it. However, using zope.i18n.translate didn't
work for me, which may also be of interest:
(Pdb) from zope.i18n import translate
(Pdb) translate('no_url', 'my_i18n_domain', context=self.context)
*** TypeError: ('Could not adapt', <PloneSite at /plone>, <InterfaceClass
zope.i18n.interfaces.IUserPreferredLanguages>)
The Zope log shows nothing related, even though the log-level is set to DEBUG.
Could anyone give me a pointer?
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers