Translations/YourProject/ImportingTemplates

Not logged in - Log In / Register

Revision 3 as of 2009-08-05 15:32:54

Clear message

Launchpad Help > Translations > Importing templates

Importing your project's translation templates

Before anyone can help translate your project, you need to tell Launchpad which English strings appear in your software's interface.

You do this by importing one or more GNU gettext .pot template files. If you're unfamiliar with .pot files or GNU gettext in general, see the gettext manual.

Launchpad can automatically import your translation templates from a Bazaar branch. Each time you commit a change in your templates to your Bazaar branch, and then push the branch to Launchpad, Launchpad will update the strings available for translation in your project.

If you also have .po translation files in that branch, you can ask Launchpad import those as well.

Note:

You can also manually upload .pot files using the web interface. This method is no longer recommended.

Push the branch to Launchpad

You can run concurrent separate translation efforts for each series of your project. For now, let's work with the trunk series that Launchpad created by default when you registered your project.

If you've already set a default branch for your trunk series, you can skip straight to Enabling automatic template imports.

Step 1: Open a terminal and change directory to your Bazaar branch.

Note:

Don't worry if your Bazaar branch is empty. If you're new to Bazaar and Launchpad Code Hosting, see our quick-start.

Step 2: Push your Bazaar branch to Launchpad:

bzr push lp:~your-id/your-project/trunk

Of course, you need to replace the relevant parts of that line with your own Launchpad user id, the project name and, if it isn't trunk, the series name.

Once Bazaar has pushed the branch to Launchpad, Launchpad will automatically associate it with the trunk series.

Enabling automatic template imports

Now you need to tell Launchpad to automatically import any translation templates, and subsequent changes to those templates, that it finds in the series' default branch.

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

Step 2: Next, select Import template files, then click Save settings.

We can ignore the other option for now, as that's explained in our Importing translations article.

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.

Important:

You should follow our translations import policy when creating and adding your templates.

Naming templates

Since a template file does not carry any metadata, all information about it must be derived from its path.

Launchpad needs this metadata 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).

Automatic approval

As you'll have seen in our translations import policy, the first time you import a template -- particularly for a project that is new to Launchpad -- we scrutinise it more closely than subsequent imports. Often, this can mean that one of the Launchpad team reviews your template manually.

One of the big advantages of importing templates directly from your series default Bazaar branch is that your templates stand a better chance of automatic approval.

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 one of the Launchpad team.

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.

Manual translation template imports

If you prefer, you can also upload your template -- or an archive containing several template files -- through Launchpad's web interface.

Visit your project's translations overview page and click the link for the trunk series.

Next steps

If you're likely to make translations elsewhere, you can have Launchpad automatically import them from the same Bazaar branch.

< Translation your project

Importing translations >