Sent again -- here's a slightly more compact version, that avoids
declaring a separate class to hold the expressions in.

Michel Houben wrote:
> How can I fix the date in Dutch, for example Donderdag 17 Augustus 2000 
> instead of Thursday 17 August 2000. I hope someone can solve this problem.

I don't know any Dutch.

However, here's an external method that will convert the months and days
of the week in a string from English to German.

There are probably better names for the variables and such, so don't
take this as as example of clear maintainable programming :)

It ought be be pretty efficient.

Assuming you call the external method D_date, use something like this:

  <dtml-var "D_date('October February July, Tuesday, 23 March 2000')">

import re

# you can remove lines where the words are the same in both languages

for e,d in replacements.items():
        eval("lambda x: re.compile('%s').sub('%s', x)" % (e, d)))

def D_date(datestring):
    return reduce(lambda x,y: y(x), replace_regexes, datestring)

Steve Alexander
Software Engineer
Cat-Box limited

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to