[Zope] Re: request.locale - do we have this in 2.9.4?

Maciej Wisniowski maciej.wisniowski at coig.katowice.pl
Thu Sep 7 08:26:08 EDT 2006


> msgid = _('YYYY-MM-DD')
> res = translate(msgid, context=self.request, default=msgid)
> return renderElement("span", contents=escape(res),
>                         cssClass=self.cssClass)

Eh.. some lines disappeared ;) from the above code.
Should be something like:

        from zope.i18nmessageid import MessageFactory
        _ = MessageFactory("calendar")
        msgid = _('%Y-%m-%d')
        format = translate(msgid, context=self.request, default=msgid)
        content = content.strftime(format)
        return renderElement("span",
                             contents=escape(content),
                             cssClass=self.cssClass)

-- 
Maciej Wisniowski


More information about the Zope mailing list