[Python-Dev] Re: [Patches] Translating doc strings
Peter Funk
pf@artcom-gmbh.de
Fri, 2 Jun 2000 15:57:32 +0200 (MEST)
Hi,
[Barry A. Warsaw]:
> pygettext is in Tools/i18n, and I've been working with James
> Henstridge and Peter Funk on getting a standard gettext module
> integrated into the core. A few other things have bumped that down on
> my list, but it's still there.
I will try to make some progress. Currently I'm not sure how to
define a class 'Translator' ... I'm open for suggestions. James
has also made some interesting points.
> We'll still need xgettext to scan the C code. Also, marking Python
> module docstrings is a bit problematic. I've resorted to Something
> Really Ugly:
>
> -------------------- snip snip --------------------
> try:
> import fintl
> _ = fintl.gettext
> except ImportError:
> def _(s): return s
>
>
> __doc__ = _("""pygettext -- Python equivalent of xgettext(1)
> ...")
> -------------------- snip snip --------------------
>
> Yuck.
I agree: this is really ugly. Since doc-strings are something special,
I don't think, we should travel further down this road. I believe,
we should use a special doc-string extration-tool (possibly build
on top of ping's 'inspect.py'?), which will then create a .pot-file
solely out of __doc__-strings.
Regards, Peter.