The outdated manual

To make i18ndude aware of the strings you pass context.translate(), you can wrap these calls in a '_' method like so (example taken from PloneInvite):

def _(message): """ Fake MessageFactory, allows calling context.translate() as _(u"") in order to be able to use i18ndude on this script.

We want to use context.translate, but if we do, its input strings aren't recognized by i18ndude as translatable strings. If we call it as _(u""), i18ndude will recognize it and create translation strings in the .pot file. """ domain = 'PloneInvite' msgid = message return context.translate(default=message, domain=domain, msgid=msgid)

Now you can call it as portalmessage = _(u"Sent invitation to %s.") % invite_to_address, and i18ndude will create the appropriate strings in the .pot file.

If you have several scripts in your product which produce messages that should be translated, you might want to consider moving the wrapper method to a separate class. In PloneInvite, i added this to the __init__.py: