Changes between Initial Version and Version 1 of TranslateProject


Ignore:
Timestamp:
May 22, 2009, 12:09:08 PM (15 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TranslateProject

    v1 v1  
     1== Writing translatable web pages ==
     2
     3Translatable web pages must be PHP, and must include
     4
     5{{{
     6require_once("../inc/translation.inc");
     7}}}
     8
     9Literal text is replaced with `tra("text")`. For example,
     10
     11{{{
     12page_head("Current version");
     13}}}
     14
     15is replaced with
     16
     17{{{
     18page_head(tra("Current version"));
     19}}}
     20
     21For BOINC projects, the directory [source:trunk/boinc/html/languages/translations/ html/languages/translations] contains a number of 'translation files'. When a person accesses the page, the browser passes a list of languages. The BOINC PHP code finds the first of these languages for which a translation is available, or English if none. As the page is generated, each call to `tr()` replaces the token with the corresponding translated text.
     22
     23In developing web pages, 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
     24
     25{{{
     26msgid "Already have an original 'Classic' account as of May 14, 2004?"
     27"%1We've transferred it, just %2activate it%3. "
     28"%4Otherwise %5create a new account%6."
     29msgstr ""
     30}}}
     31
     32with the corresponding PHP:
     33
     34{{{
     35printf(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."),
     36"<br>", "<a href=\"sah_email_form.php\">", "</a>",
     37"<p><img src=\"images/arrow_right.gif\">",
     38"<a href=create_account_form.php>", "</a>"
     39);
     40}}}
     41
     42== Project-specific translations ==
     43
     44The web site of a BOINC-based project involves both
     45
     46    * BOINC pages, such as the forms for creating accounts. These are part of the BOINC source code distribution, and are updated periodically by BOINC.
     47    * Project-specific pages (and BOINC pages that are modified by the project).
     48
     49To allow translations of both types of pages, a project can haves its own 'project-specific translation files'. These are stored in a directory [source:trunk/boinc/html/user/project_specific_translations html/user/project_specific_translations]. Project-specific translation files override BOINC translation files.