I've been wondering how one can format with the var tag a date value as DD.MM.YYYY or DD/MM/YYYY?
Enclosed is snippet of UNSUPPORTED, NOT-IN-CVS, CAVEAT EMPTOR, YMMV code that you might be able to put in DateTime.py _Possibly_ with Jim's blessing and a little documentation tweak these _might_ get into CVS... [Did I hedge enough?] # New formats def aDotIntlDate(self): """Return a string representing the object\'s value in the format: 21.03.1999""" return '%.2d.%.2d.%.4d' % ( self._day, self._month, self._year) def aSlashIntlDate(self): """Return a string representing the object\'s value in the format: 21/03/1999""" return '%.2d/%.2d/%.4d' % ( self._day, self._month, self._year) you would then use something like: <!--#var bobobase_modification_time fmt=aDotIntlDate--> or <!--#var bobobase_modification_time fmt=aSlashIntlDate--> To answer a related question, we are considering mechanisms by which the process for adding new: o time expressions o timezones o currency expressions etc., is much less dependent on the current patch-the-code mechanism and would thereby let people _easily_ define their own date and currency formats without having to repatch their software every time a release is made. Of course, the Z2 alpha and beta process has taken some attention away from this. I would encourage you to join the Zope Internationalization Project (ZIP). --Rob
On Sat, 24 Jul 1999, Rob Page wrote:
o time expressions o timezones o currency expressions
etc., is much less dependent on the current patch-the-code mechanism and would thereby let people _easily_ define their own date and currency I've been thinking more about property based way. By setting the property "country" to say "de" or "at", one would select localization for the given country. (Yes, there are some minor differences between Austrian and German usage ;) ). This property would influence all formats to behave correctly, be it currency or date values. (There are more ways, for example the Japanese use another format when I recall correctly.)
This way, one could have the following layout: /Document/ index_html <-- layout index_text <-- real text in say English. (main language) /Document/French/ index_text <-- translation to French. country="fr" /Document/German/ index_text <-- translation to German. country="de" ... Only problem with this is, that to mix formats on one page, one would need either: -) extend dtml-var to take an country= parameter. -) create Subfolders that only contain the property, and use dtml-with e.g.: <dtml-with germanfmt><dtml-var somedatevalue></dtml-with>
formats without having to repatch their software every time a release is made. Of course, the Z2 alpha and beta process has taken some attention away from this. I would encourage you to join the Zope Internationalization Project (ZIP). Where can one join?
Andreas -- Andreas Kostyrka | andreas@mtg.co.at phone: +54/1/7070750 | phone: +43/676/4091256 MTG Handelsges.m.b.H. | fax: +43/1/7065299 Raiffeisenstr. 16/9 | 2320 Zwoelfaxing AUSTRIA
On Sat, 24 Jul 1999, Rob Page wrote:
I've been wondering how one can format with the var tag a date value as DD.MM.YYYY or DD/MM/YYYY?
Enclosed is snippet of UNSUPPORTED, NOT-IN-CVS, CAVEAT EMPTOR, YMMV code that you might be able to put in DateTime.py I do have a better solution ;) <dtml-with ZopeTime> <dtml-var %d.%m.%Y> </dtml-with>
Catches: -) the strftime is applied to UTC. -) Trying accessing the attribute differently, produces Permission bugs. So for example <dtml-var "_.getattr(ZopeTime,'%d.%m.%Y')()"> produces: Error Type: AttributeError Error Value: PrincipiaTime%d.%m.%Y Andreas -- Andreas Kostyrka | andreas@mtg.co.at phone: +54/1/7070750 | phone: +43/676/4091256 MTG Handelsges.m.b.H. | fax: +43/1/7065299 Raiffeisenstr. 16/9 | 2320 Zwoelfaxing AUSTRIA
participants (2)
-
Andreas Kostyrka -
Rob Page