[Python-Dev] Fwd: i18n

Anders J. Munch ajm at flonidan.dk
Thu Aug 26 10:42:00 CEST 2010


Terry Reedy wrote:
> Localized messages should be in addition to rather than a replacement
> for the English version. I thought we had this discussion somewhere --
> here? ideas? maybe a tracker issue?

This could be done as a free-standing library, there's no reason to
involve core CPython.  Just do message translation at a later stage,
e.g. in a custom sys.excepthook. 

I did a quick demo:
|  Python 3.2a1 (r32a1:83346, Jul 31 2010, 18:36:39) [MSC v.1500 32 bit
(Intel)] on
|   win32
|  Type "help", "copyright", "credits" or "license" for more
information.
|  >>> import localise_exceptions
|  >>> localise_exceptions.install_excepthook('DK')
|  >>> None.no_such_attr
|  Traceback (most recent call last):
|  
|    File "<stdin>", line 1, in <module>
|  
|  AttributeError: 'NoneType' objektet har ingen attribut 'no_such_attr'

localise_exceptions.py is at http://pastebin.com/QJCn8gmd

regards, Anders



More information about the Python-Dev mailing list