[I18n-sig] pygettext and msgfmt support for distutils

Barry Warsaw barry@python.org
16 Apr 2003 14:10:40 -0400


On Wed, 2003-04-16 at 12:27, Bernhard Herzog wrote:
> Is someone working on integrating the gettext utilities with distutils?
> 
> Some background:
> 
> We've just added some simple gettext support to our geogaphic data
> viewer Thuban[1] but the setup we currently use only works on Unix-like
> systems because it's just a makefile that can be used to call xgettext
> (0.11 which supports python :)) and msgmerge and msgfmt as needed.

I haven't had time to look at the latest xgettext, but do you know if it
supports all the extra features that pygettext supports?  Of primary
importance to me is the -D/--docstrings and -X/--no-docstrings options.

> I've already adapted our setup.py file to include any formatted .mo
> files and any po files in the source distribution and to install the mo
> files together with other data files which works well so far.
> 
> What I'd still like to have is a way to at least get the functionality
> of xgettext (or pygettext) and msgfmt into the distutils setup.py in
> such a way that it works on windows as well as on Unix.

msgfmt I can see, but I'm not so sure about {x,py}gettext.  IME, I don't
want to do message extraction at either build time or tar-it-up time.  I
usually want to do extraction at defined boundaries in the project's
development.  So that seems to me a separate process.  I'm interested in
getting your ideas here.

Hook msgfmt up in some way would definitely be useful.  That way you
wouldn't need to include .mo files in your distro (nor in cvs).

> Is someone working on this kind of thing? 
> 
> If no, what would be needed to get it into the standard distutils?

Let's start with a patch! :)

> AFAICT, for a start it might be good to move pygettext.py and msgfmt.py
> into the standard library so that distutils can easily call them to do
> the actual work.

Hmm, possibly.  They may need to be rewritten or refactored to make them
more appropriate as library modules.  I can see an i18n package being
added to Python's stdlib someday which might contain the raw materials,
with the Tools/i18n scripts being mostly just __main__ and getargs
wrappers.

-Barry