Hi Martin, thanks for answering this. If I understand you correctly, I can
On Fri, 17.04.2009 at 10:15:20 +0800, Martin Aspeli <[email protected]> wrote: > z3c.form uses the zope.i18nmessageid mechanism that Plone itself now > uses. When you see things like: > > from zope.i18nmessageid import MessageFactory > _ = MessageFactory('my.domain') > > ... > > foo = _(u"Foo") > > then the string 'foo' will be translatable. You can be more speciifc, > though: > > foo = _(u'foo_label', default=u"Foo") put this in my zope.schema-derived interface, and then have proper translations, having u'foo_label' as the key to use in my .pot file (see below). Will give this a try... > and you can use a mapping dict to interpolate variables. I'm not sure that I understand this part, but I'll dig Philipp's book a bit more. > Tools should be able to extract all the strings with the special _() > function call. Translation happens when the strings are rendered. The > template doesn't need to have i18n:translate or whatever in it for that > to happen. Hmmm... so far, I was only aware of doing things like this, in page templates: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:metal="http://xml.zope.org/namespaces/metal" xmlns:i18n="http://xml.zope.org/namespaces/i18n" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lang="en" metal:use-macro="context/main_template/macros/master" i18n:domain="some.product"> <a tal:attributes="href string:${area/id}/@@details" i18n:translate="area_details" class="imglink"> <img src="#" tal:attributes="src string:/${context/virtual_url_path}/++resource++some.product.images/magnifier.gif" alt="Area Details" title="Area Details" i18n:translate="alt title" /> I then have a locale.pot + <LANG>.po files, which contain the actual translations. I thought I needed to generate those labels (eg. "area_details") from my Python code, but you say that this is a misconception. Kind regards, --Toni++ _______________________________________________ Product-Developers mailing list [email protected] http://lists.plone.org/mailman/listinfo/product-developers
