[I18n-sig] Translating doc strings

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Fri, 1 Sep 2000 20:58:16 +0200


> Hmm...  This lumps together *all* documentation for *all* modules and
> packages.  

Yes, it would. In itself, I don't see it as a problem. In the
lumped-together form, only translators see it. This will guarantee
consistency of terminology (eg. is it "Strings" or "Zeichenketten";
what is "Slicing").

> What about documentation for 3rd party packages?

That is indeed a problem.

> For functions, classes, methods and instances, the module name is
> easily accessible, e.g.:
> 
>     >>> import rfc822
>     >>> m = rfc822.Message(open("/dev/null"))
>     >>> m.__class__.__name__
>     'Message'
>     >>> m.__class__.__module__
>     'rfc822'
>     >>> 

I see two problems with using the package name. Exactly how do you
obtain it for functions? f.func_globals['__name__']? And for builtin
functions? As for __module__: I know, it was my idea, after all :-)

The other problem is that this would give an inflation of hundreds of
.mo files. I'd rather prefer to have one per product (in the Zope
sense).

One heuristic would be to the use the catalog that _ is bound to, i.e.

def module_of(symbol):
  as above

def catalog_of(symbol):
  return sys.modules[module_of(symbol)]._.im_self

There could be an official protocol as well, of course, but a global
catalog together with that convention might do.

Regards,
Martin