[schooltool-dev] Date in views
kit BLAKE
kitblake at gmail.com
Wed Dec 6 13:22:43 EST 2006
2006/12/6, Jean-François Roche <jfroche at jfroche.be>:
> Wondering what's the best way to translate dates ? For the moment (in
> calendar) a date is printed: "Wednesday, 2006-12-06" , i need it in
> french and to the European format (Mercredi, 06-12-2006).
>
> What's the nicest solution ?
>
> * Work in the view so that calling from the template for ex:
> "view/currentDate" just return the date in the right language with the
> right format.
>
> * Call a method from a tool with the date that will translate the
> date. Ex: "python:datetimeTool.translate(view.currentDate)" in the
> template ? [solution used in Plone] Next question such a tool already
> exists ?
>
> * Work with i18n:translate ?
Somewhere in Zope3 there are locales.
We extracted them a while back to use with a news product (Zope2):
https://infrae.com/viewvc/z3locales/
From the README:
Z3locales is a library, extracted from Zope X3, that provides generic
localization functionality outside of Z3. It is used by Infrae to implement
(partial) localization of Zope 2 products.
The locales integrate nicely with i18n, but presentation-wise there's
one caveat: the standard date displays include seconds. Most users
don't care about seconds, and don't want to see them presented. The
easist way to change that - unfortunately - is to edit the data files
in the product.
Hopefully this is better solvable in more recent Z3 code.
Kit
--
Kit BLAKE · Infrae · http://infrae.com/ + 31 10 243 7051
Hoevestraat 10 · 3033 GC · Rotterdam + The Netherlands
Contact = http://xri.net/=kitblake
More information about the Schooltool-dev
mailing list