[Zope3-dev] Re: date parsing: explicit is better

Stephan Richter stephan.richter@tufts.edu
Fri, 22 Nov 2002 12:23:18 -0500


On Friday 22 November 2002 10:05, Shane Hathaway wrote:
> Ooh, ooh, I smell a new method for the locale service.
> ILocaleService.parseDate() or somesuch would return a date given a text
> string, raising an error if it's ambiguous.  This would even let us deal
> with non-US month names, as in "05-OUT-02" (Portuguese), or whatever
> unusual conventions people use around the world.

Right, but I think the problem is much broader. What we really need is a way 
of saying: For the German Locale, give me the long version datetime 
formatter. This formatter can then be used to (i) parse and (ii) create a 
datetime object. This is the way Java approaches the issue, and I think it is 
the best possible way and it covers all problems. 
For example you could also say: Give me the currency representation for the 
German Locale. 

A long time ago I wrote the I18nFormatLocalSupport proposal (not much there) 
and I updated the links just now:

http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/I18nFormatLocaleSupport

If someone will write a parser for the (we only need numbers and datetimes for 
now) formatting strings, I would be glad to implement the rest. BTW, the 
parser was the reason I did not complete that project in the summer.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training