wiki:TranslateProject

Version 3 (modified by davea, 16 years ago) (diff)

--

Web site translation

A BOINC project web site consists of a "generic" part (provided by BOINC's PHP files) and a project-specific part (provided by the project).

Translation files for the generic part are kept in project_root/html/languages/translations. These files are installed when you create the project, and updated when you use upgrade. You can also copy them manually from boinc/html/languages/translations.

Translation files for the project-specific part should be kept in project_root/html/project/project_specific_translations. These files have names of the form es.po (es = Spanish).

When any translation file changes, you must run the script html/ops/update_translations.php for them to take effect on your web site. This script combines the generic and project-specific files into a single compiled version, e.g. html/languages/compiled/es.po.inc.

Making web pages translatable

Translatable web pages must be PHP, and must include

require_once("../inc/translation.inc");

Literal text is replaced with tra("text"). For example,

page_head("Current version");

is replaced with

page_head(tra("Current version"));

Keep in mind that word order differs between languages, so you should avoid breaking a sentence up into multiple translation units. For example, use constructs like

msgid "Already have an original 'Classic' account as of May 14, 2004?"
"%1We've transferred it, just %2activate it%3. "
"%4Otherwise %5create a new account%6."
msgstr ""

with the corresponding PHP:

printf(tra("Already have an original 'Classic' account as of May 14, 2004? %1We've transferred it, just %2activate it%3. %4Otherwise %5create a new account%6."),
"<br>", "<a href=\"sah_email_form.php\">", "</a>",
"<p><img src=\"images/arrow_right.gif\">",
"<a href=create_account_form.php>", "</a>"
);

Generating a translation template

To generate a translation template (en.po), edit the script html/ops/build_po.php so that it processes your project-specific PHP files, and run it from project_root/html.

Getting volunteers to do translations

At this point you can use whatever mechanism you want to create translations of your translation template.

The easiest way is to use the BOINC Translation Service, a web-based system that's used for BOINC itself and for SETI@home. To do this:

  • Create a Subversion repository called locale, with a subdirectory for each language. This repository must be accessable by user boinc_trans.
  • Post a request to the boinc_loc@ssl.berkeley.edu email list, asking that your project be added to the BOINC Translation Service.

When this is set up, translations will automatically be checked into your locale/ repository. You'll need to periodically update the working copy of this on your web server. You'll also need to move translation files from, e.g., locale/es/web.po to project_root/html/project/project_specific_translations/es.po. The easiest way to do this is to create a symbolic link from the latter to the former.