DateTime instance provide the strftime() method (according to the docs).

-aj

On Mon, Mar 23, 2009 at 14:21, Kees Hink <[email protected]> wrote:

> How can i translate a DateTime object from TAL?
>
> My use case is a custom content type (AT) which has a DateTime field. I
> would
> like to show the date for this field as '%d %B %Y', where %B is the full
> name of
> the month in the site's language. (Site language is Dutch, this is also set
> in
> portal_languages.)
>
> I tried to create a translation using toLocalizedTime()
>  <span tal:define="translation python: context.toLocalizedTime(datetime)"
>      tal:replace="translation" />
> where 'datetime' is a DateTime object. However, this renders the date in
> '%d-%m-%Y' format.
>
> Possibly related: Dates in document bylines are shown in English. I have
> set the
> site language to Dutch and the site property localLongTimeFormat to '%d %B,
> %Y
> %I:%M %p'. It shows the right format, but untranslated.
>
> setup:
>    *  Plone 3.2.1
>    * CMF 2.1.2
>    * Zope (Zope 2.10.6-final, python 2.4.5, linux2)
>    * Python 2.4.5 (#2, Aug 1 2008, 02:22:02) [GCC 4.3.1]
>    * PIL 1.1.6
>
> _______________________________________________
> Product-Developers mailing list
> [email protected]
> http://lists.plone.org/mailman/listinfo/product-developers
>
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to