[Python-Dev] Is pygettext.py deprecated?

Philip Jenvey pjenvey at underboss.org
Tue Nov 12 02:51:02 CET 2013

On Nov 11, 2013, at 1:30 PM, A.M. Kuchling wrote:

> I was looking at http://bugs.python.org/issue1098749, which adds
> extraction of multiple-line strings to pygettext.py, but on the ticket
> Mark Lawrence suggested that "pygettext should be deprecated".  Is it
> deprecated?  (It's not listed in PEP 4, but it isn't a module.)
> Debian wrote a man page for pygettext that starts with:
>       pygettext is deprecated. The current version of xgettext
>       supports many languages, including Python.
> GNU xgettext didn't understand any languages other than C at one time,
> so pygettext.py was written to handle Python code but not C code.  But
> now xgettext will parse Python code.  I assume xgettext's
> parsing is just using regexes, not an actual parse tree, so it may
> work equally well for Python 2.x and 3.x.
> Do we want to deprecate pygettext.py?  If so, we should rewrite
> http://docs.python.org/3/library/gettext.html, which encourages people
> to use pygettext, and add it to PEP4.

+1 on deprecating it, though I'd prefer to recommend the pure python Babel instead of xgettext.

Babel can extract gettext messages from Python code and also has has plugins for extracting from various popular Python templating languages. It's also easier to setup against Python projects using distutils/setuptools.

Philip Jenvey

More information about the Python-Dev mailing list