| 1 | = Web and GUI translations = |
| 2 | |
| 3 | BOINC has mechanisms for non-English translations of |
| 4 | |
| 5 | * Parts of this site (the [http://boinc.berkeley.edu/download.php Download] and [http://boinc.berkeley.edu/poll.php BOINC user survey] pages, and related pages) |
| 6 | * The BOINC Manager |
| 7 | * Parts of the BOINC-supplied portion of project web sites |
| 8 | * The project-specific parts of project web sites |
| 9 | |
| 10 | == Instructions for volunteer translators == |
| 11 | |
| 12 | Translations are done by volunteers. If you're interested in helping: |
| 13 | |
| 14 | * Email the translation manager. For BOINC this is '''translate at boinc.berkeley.edu'''. Use this address also for SETI@home translations. For other projects, contact the project. |
| 15 | * Obtain (typically via CVS) the 'authoritative' translation file. Usually this is en.po (English). |
| 16 | * Create a translation file for your language. You can do this using a text editor or a specialized tool such as [http://sourceforge.net/projects/poedit/ poedit]. |
| 17 | * Send this to the translation manager, who will then install it on the project's web site. Check all relevant pages and fix as needed. |
| 18 | * Subscribe to the [http://ssl.berkeley.edu/mailman/listinfo/boinc_loc boinc_loc at ssl.berkeley.edu] email list, which is for translation-related discussion and announcements. |
| 19 | * Because web sites are dynamic, you will have to periodically update your translation. You can do this efficiently by looking at the CVS diffs of the authoritative translation file. |
| 20 | |
| 21 | == Translation files == |
| 22 | |
| 23 | Most translations are based on translation files. Translation files are in PO format, which is described [http://www.gnu.org/software/gettext/manual/html_node/gettext_9.html#SEC9 here]. These have names like 'da.po' (Danish) and 'en.po' (English). It's very simple. For example: |
| 24 | |
| 25 | {{{ |
| 26 | #!html |
| 27 | <h2 style="text-align: center;">en.po (English)</h2> |
| 28 | }}} |
| 29 | |
| 30 | {{{ |
| 31 | msgid "APPS_VERSION" |
| 32 | msgstr "Current version" |
| 33 | |
| 34 | msgid "APPS_DESCRIPTION" |
| 35 | msgstr "$PROJECT currently has the following applications. " |
| 36 | "When you participate in $PROJECT, work for one or more " |
| 37 | "of these applications will be assigned to your computer. " |
| 38 | "The current version of the application will be downloaded " |
| 39 | "to your computer. This happens automatically; you don't have to do anything. " |
| 40 | }}} |
| 41 | |
| 42 | {{{ |
| 43 | #!html |
| 44 | <h2 style="text-align: center;">da.po (Danish)</h2> |
| 45 | }}} |
| 46 | |
| 47 | {{{ |
| 48 | msgid "APPS_VERSION" |
| 49 | msgstr "Nuværende version" |
| 50 | |
| 51 | msgid "APPS_DESCRIPTION" |
| 52 | msgstr "$PROJECT har i øjeblikket følgende applikationer. " |
| 53 | "Når du deltager i $PROJECT vil arbejde fra en eller flere " |
| 54 | "af disse applikationer blive tildelt din computer. " |
| 55 | "Den nuværende version af applikationen vil blive downloadet " |
| 56 | "til din computer. Dette sker automatisk - du behøver ikke at gøre noget." |
| 57 | }}} |
| 58 | |
| 59 | Each translation has a token CHARSET whose value should be the character set (e.g. iso-8859-1) used in the translation. |
| 60 | |
| 61 | Here are links to the translation files for |
| 62 | |
| 63 | * [http://boinc.berkeley.edu/trac/browser/trunk/boinc/languages/translations/ this web site] |
| 64 | * [http://boinc.berkeley.edu/trac/browser/trunk/boinc/html/languages/translations/ the BOINC-supplied part of project web sites] |
| 65 | * [http://boinc.berkeley.edu/trac/browser/trunk/boinc/locale/client/ the BOINC Manager] |
| 66 | |
| 67 | == Writing translatable web pages == |
| 68 | |
| 69 | Translatable web pages must be PHP, and must include |
| 70 | |
| 71 | {{{ |
| 72 | require_once("../inc/translation.inc"); |
| 73 | }}} |
| 74 | |
| 75 | Literal text is replaced with `tr(TOKEN)`, where TOKEN is a short string representing the text. For example, |
| 76 | |
| 77 | {{{ |
| 78 | page_head("Current version"); |
| 79 | }}} |
| 80 | |
| 81 | is replaced with |
| 82 | |
| 83 | {{{ |
| 84 | page_head(tr(APPS_VERSION)); |
| 85 | }}} |
| 86 | |
| 87 | For BOINC projects, the directory 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. |
| 88 | |
| 89 | In 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 |
| 90 | |
| 91 | {{{ |
| 92 | msgid "ACTIVATE_OR_CREATE" |
| 93 | msgstr "Already have an original 'Classic' account as of May 14, 2004? " |
| 94 | "<br>We've transferred it, just %sactivate it%s. " |
| 95 | "%sOtherwise %screate a new account%s." |
| 96 | }}} |
| 97 | |
| 98 | with the corresponding PHP: |
| 99 | |
| 100 | {{{ |
| 101 | printf(tr(ACTIVATE_OR_CREATE), |
| 102 | "<a href=sah_email_form.php>", "</a>", |
| 103 | "<p><img border=0 src=images/arrow_right.gif width=9 height=7>", |
| 104 | "<a href=create_account_form.php>", "</a>" |
| 105 | ); |
| 106 | }}} |
| 107 | |
| 108 | == Project-specific translations == |
| 109 | |
| 110 | The web site of a BOINC-based project involves both |
| 111 | |
| 112 | * BOINC pages, such as the forms for creating accounts. These are part of the BOINC source code distribution, and are updated periodically by BOINC. |
| 113 | * Project-specific pages (and BOINC pages that are modified by the project). |
| 114 | |
| 115 | To allow translations of both types of pages, a project can haves its own 'project-specific translation files'. These are stored in a directory html/user/project_specific_translations. Project-specific translation files override BOINC translation files. |
| 116 | |
| 117 | == BOINC Manager translations == |
| 118 | |
| 119 | Menu names and other text in the BOINC manager are stored in files in '''boinc/locale/client/'''. |