You can ask Launchpad to automatically import your translation templates from your project's official Bazaar branches hosted in Launchpad.

Activating automatic translation imports for Bazaar branches

First off, you -- the project owner -- need to link each project series, for which you want to automatically import translation templates, to its Bazaar branch. When a project is registered in Launchpad, its 'trunk' series is created by default.

  1. Visit the project series overview page and click Link to branch.

  2. Next, select the branch and click Update.

If you've previously linked the series to a branch, you can skip straight to enabling automatic template imports.

  1. Visit the translations overview page for the series and click Settings.

  2. Next, select Import template files, then click Save settings. (The other available setting is explained further below under Importing translations.)

The order in which you complete the two stages does matter to an extent: the Translations Settings form shows you the branch associated with the series, making it easier to confirm that you've selected the branch.

Once you've completed both stages, Launchpad will schedule its first import to take place within the next 15 minutes.

Adding and updating templates

To update or add a template all you need to do is commit the template file to the branch.

Launchpad's branch scanner will find the templates and then add them to the import queue. Once approved, the template will appear in the translation tab for the product series.

Naming templates

Since a template file does not carry any metadata, all information about it must be derived from its path. The metadata is needed to either create a new template entry in Launchpad Translations or to match the file to an existing entry. The metadata consists of the translation domain and the template name. The latter is derived from the former which in turn is extracted from the path.

These are the ways to specifiy the translation domain, the first match will be used:

  1. In the file name itself: domain.pot or po/domain.pot, etc.

  2. If the file name is generic (one of messages.pot, template.pot or untitled.pot), in the containing directory: domain/messages.pot or po/domain/messages.pot

  3. Or in the module directory: domain/po/messages.pot (only "po" is recognized as an intermediate directory in the path).

The template name is derived from the domain by replacing underscores (_) with dashes (-).

Automatic approval

One of the big advantages of importing templates directly from your series Bazaar branch is that your templates may be automatically approved.

To assure automatic approval, these conditions must be met:

The latter condition is there to avoid creating new template entries when in reality the existing template entry was to be renamed. This and any other case will not be approved automatically and must be reviewed by a queue admin.

Exception: In the simple case of having only one template file in the branch and one entry in Launchpad Translations, these two are always matched and the translation domain attribute of the Launchpad Translations entry is updated with whatever the file name provides. The template name is never updated as it identifies the template in the UI and is also used in URLs.

Importing translations

There are two ways to get translation files (.po) imported into Launchpad from your branch.

  1. On the Settings page choose Import template and translation files to import .po files in addition to .pot files whenever they are updated in the branch.

  2. Or go to the Request Bazaar Import page to request a one-time import of all .pot and .po files in the tree.

Naming translation files

In order to ensure automatic approval and subsequent import of the translation files, two rules need to be followed, just like when uploadding tarballs (See a sample directory layout here).

  1. Place the files in the same directory as the template for which they are meant. Each template and its translation files must have its own directory. This rules out the first naming option for templates that was mentioned above.
  2. Name the files according to the language code of the language they contain. So for Spanish translations use es.po.

In addition to that the normal instructions for uploading translation files apply.

Translations/ImportingFromBazaarBranches (last edited 2009-08-03 01:29:13 by 12-50-184-194)