I have an application written in Python and Gtk which contains a number of translation string inside, properly marked using _()
.
The repository of this application contains a set of .po
files for different languages which are compiled and sorted out in a directory layout fine to be loaded by gettext
when the setup.py
of the application is run.
The current project looks currently like this:
/
/po/fr.po
/mo/fr/LC_MESSAGES/my-app.mo
/my-app/__init__.py
/setup.py
gettext.install()
is currently called several times, trying various "well-known places" (like /usr/share/locale
, dirname(my-app.__file__ ) + "../mo"
, etc.) As I said before, the .mo
files are not stored in the repository itself, but generated on the fly when setup.py
is launched.
I would like to know what would be the "best way" to deal with those files. Specifically, I would like to find a way which:
- allows the developers to use the translations without having to install the application somewhere (working straight into the repository);
- allows people who wants to install it to have the translation files spread out at the right place;
- allows packagers (for Linux distributions for example) to deal easily with those translation files.
My questions would then be:
- Where do I store my .mo files?
- How do I find where those files are (considering the points above)?
- How do I package those files (Python-wise speaking)?