Automatic generation of translation templates
Tuesday, May 4th, 2010Last year, we integrated Launchpad Translations with Launchpad’s code hosting, meaning you could import both translations and templates from a Bazaar branch and also export translations to a branch.
Even at the time, we knew that the story wasn’t complete: you still had to somehow generate your translation templates (in the form of GNU gettext’s .pot files) and get them into your Bazaar branch before people could start translating your project in Launchpad.
However, we also knew that automatically generating translation templates was a big task.
Now, though, I’m pleased to say that Launchpad can automatically generate the templates on your behalf.
How to get it all set up for your project?
Automatic translation template generation relies on something called intltool. You’ll need to be familiar with intltool before you can get started with automatic template generation.
You first need to enable your branches for intltool and then set up a translation template import fromn the Bazaar branch that is linked to your project’s release series.
This means that, provided your branch has proper structure, you don’t even have to keep the POT file committed anymore (as a matter of fact, it’s better if you don’t). If your branch is not recognized as intltool branch, everything will keep working as before.
At this time, limits to what branches we consider intltool based are pretty strict: it has to have a POTFILES.in
file in each of the template subdirectories, and be able to derive the domain name from Makevars
DOMAIN
variable or Makefile.in.in
, configure.ac
or configure.in
gettext_PACKAGE
variable (with very limited substitution supported). This will be further improved in the future, but plan is to support much more different layouts than just the intltool one.
We’ll be writing more about how to make the most of this in the coming weeks.