Marking translatable strings

François Pinard pinard at iro.umontreal.ca
Sun Sep 19 13:59:44 EDT 1999


Bernhard Herzog <herzog at online.de> writes:

> To begin with, I'd say that docstrings should not be translated
> automagically when a module is imported [...]

Fully agreed.  Getting translations should be implemented as lazily as
possible (I mean, of course, that the action should be postponed until the
latest possible moment).  And further, it should be possible to switch
language at run time.  Hmph!  Thinking about it, I wonder how `gettext'
manages language switching, when using one cache per textual `gettext'
call in a program.  Does someone happen to know?

> Implementing automatic translation of docstrings on access seems to be
> quite simple at first glance [...] but I fear there could be some very
> tricky issues.

The marking I suggested in earlier messages does not involve the interpreter,
but only textual tricks on the program sources: enough to drive an automatic
extractor, but not enough to alter strings as Python see them.

I guess automatic translation of strings on access is lurking for internal
modifications to Python.  Currently, Python does not have the concept
of internal marks for translatability.  And if we want to involve the
interpreter in the process and do it right, much thinking is needed.
I guess we might come to that over time, but I do not feel ready now,
for one, to suggest anything precise to Guido.  In any case, you are much
more experienced than I may be with Python!  Let's help each other! :-)

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard





More information about the Python-list mailing list