localization - How to set python exception messages to use my native language? -


i'm working in python library going used brazilians, official speak language here portuguese! basically, want exception messages in portuguese, example:

instead of get...

>>> float('a') valueerror: not convert string float: 

i wanna this...

>>> float('a') valueerror: não é possível converter string para um float: 

is there way it?

the cpython implementation not provide automatic mean of localizing error messages. hence should rewrite python's error messages in portuguese , either add lot of try...except blocks or replace sys.excepthook handle exceptions.

if plan i'd consider using gettext module localization.

other python implementations do have localized error messages(like ironpython).

in opinion want not practice. these brazilian developer must know bit of english anyway if want @ documentation of python/libraries(which aren't translated in portuguese).

also if localize error messages searching them on web becomes harder.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -