Gavin <gavin.d...@gmail.com> writes: > python-dateutil seems to work very well if everything is in English, > however, it does not seem to work for other languages and the > documentation does not seem to have any information about locale > support.
Probably because I don't think there is much built in. You'll want to supply your own parserinfo to the parse function. I haven't had to parse non-english localized date strings myself yet, but yes, the default parserinfo used by the module is in English. Looks like the docs don't get into it too much, but if you review the parser.py source in the package you can see the default parserinfo definition. I would think defining your own (or subclass of the default) and replacing the WEEKDAYS and MONTHS values would work (you can get localized lists directly from the calendar module) and maybe adding to the jump table if you want to parser longer phrases. At a first glance, the lexer within the module does seem like there may be some possible issues with more esoteric encodings or unicode, but just something to stay aware of. If you already have a i18n/l10n setup in your application (or need to have finer grained control than a global locale setting), you could instead override the lookup methods, though there's a bit more work to do since the initial lookup tables will probably need to be created in each of the locales you may wish to switch between. -- David -- http://mail.python.org/mailman/listinfo/python-list