[I18n-sig] gettext and distutils

Martin v. Loewis martin@v.loewis.de
07 Nov 2002 16:10:50 +0100

Jiri Baum <jiri@baum.com.au> writes:

> What's the correct way to deal with l10n files (.po / .mo) with gettext
> and distutils (setup.py), please?

There are two approaches:

a) install the MO files into the standard location. This works
   particularly well on Unix, where the standard location already has
   plenty of MO files, for various packages. The standard location is

b) install the MO files in any convenient place, then use
   gettext.bindtextdomain to bind the domain to that
   place. Alternatively, instantiate GNUTranslations objects
   directly, then you can use arbitrary file names.

> It would be nice if it would work under both Linux and MS Windows, too.

Either option a) or b) are suitable for that. On Windows, option a
tends to build quite an impressive directory hierarchy. If that
doesn't bother you, and if you can assume that people have admin
privileges on Unix, I'd recommend this approach.

Now, the tricky question is how to achieve that with distutils, there
is no good answer to that question. The install_data command is
insufficient, so you probably need to extend it.