Translations/BazaarIntegrationTutorial

Not logged in - Log In / Register

Bazaar Integration Tutorial

This tutorial explains how to integrate translation files from Bazaar branches into Rosetta.

Template Uploads

Only the upload of translation templates is implemented at the moment. This is the core functionality, though, since it may change whenever the source code changes. Also, if all translations are done in Rosetta, no other uploads of actual translations will ever be needed but this depends on the project's particular workflow.

How it works

The workflow for uploading branches includes these steps:

  1. The owner of the project activates template uploads and sets the bazaar branch for the product series.
  2. The translation template files are uploaded automatically from the branch to the translation import queue.
  3. The uploaded template files are approved automatically if the setup is unambiguous.
  4. The files are imported through the same process as any other upload to Rosetta.
  5. Subsequent commits to the branch will be detected and any changed template file will be uploaded to the queue.

How it is set up

To enable upload of translation templates from branches, two settings must be made.

  1. On the homepage for a product series select "Link to branch". On the following form select the branch that contains the translation templates to be imported and click "Update".
  2. On the translations homepage for a product series select "Settings" from the menu. On the following form select "Import PO Templates" and click "Save settings".

Once both settings are made, an upload of all translation templates in the branch is scheduled and will be executed by a cronscript within the next 15 minutes (current plan).

The order of these two steps matters slightly. The Translations Settings form displays the current selected branch because as mentioned above once this setting is changed, an upload of files from this branch will be triggered. If this is not the correct branch, you may have the wrong files in your import queue. So it is suggested that you follow these two steps in this order.

How to add and update templates

To update or add a template simply commit the template file to the branch. It will be picked up by the branch scanner and then uploaded to the import queue. If it is a new template and it can be approved automatically, the new template will appear in the translations tab of the product series.

How template names are chosen

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 Rosetta 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 (-).

How automatic approval works

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 Rosetta, these two are always matched and the translation domain attribute of the Rosetta 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.

Translations/BazaarIntegrationTutorial (last edited 2009-03-31 12:11:41 by jtv)