Translation docstrings with gettext

Gabriel Genellina gagsl-py2 at
Tue Apr 6 12:29:41 EDT 2010

En Tue, 06 Apr 2010 06:52:57 -0300, sapient <aleksey.rezvov at>  

> Lie Ryan, thank you for your answer!
>> Why would you want to translate docstring? Docstring is meant for
>> developers not users.
> I have mentioned that I want to provide API for existing image-
> processing applicaion in Python.
> In my case "developers" are "users".
> Python provides great possibilities for documenting objects, I want to
> use it for things such context help about API modules, classes,
> methods, and want to do it in several languages.

There were some efforts in this direction in the past (like the -D option  
of pygettext; and there was even a .po file for Python itself and the  
standard library) but they seem to have been abandoned long time ago.

> Yes, it will be better to avoid them, is it any existing tool/lib/
> workaround that can do it?

The turtle module contains a *very* basic translation mechanism; see  
turtle.write_docstringdict() and read_docstringdict(). They don't use  

> I am follower of aproved, stable solutions, do not like to reinvent
> the wheel.

I'm afraid this particular kind of wheel has not been invented yet.
You may find more interested people in the i18n SIG - but it does not  
appear to have a lot of traffic lately:

Gabriel Genellina

More information about the Python-list mailing list