1 | | == Writing translatable web pages == |
| 1 | = Web site translation = |
| 2 | |
| 3 | A BOINC project web site consists of a "generic" part (provided by BOINC's PHP files) |
| 4 | and a project-specific part (provided by the project). |
| 5 | |
| 6 | Translation files for the generic part are kept in |
| 7 | '''project_root/html/languages/translations'''. |
| 8 | These files are installed when you create the project, |
| 9 | and updated when you use [http://boinc.berkeley.edu/trac/wiki/ToolUpgrade upgrade]. |
| 10 | You can also copy them manually from '''boinc/html/languages/translations'''. |
| 11 | |
| 12 | Translation files for the project-specific part should be kept in |
| 13 | '''project_root/html/project/project_specific_translations'''. |
| 14 | These files have names of the form '''es.po''' (es = Spanish). |
| 15 | |
| 16 | When any translation file changes, you must run the script |
| 17 | '''html/ops/update_translations.php''' |
| 18 | for them to take effect on your web site. |
| 19 | This script combines the generic and project-specific files into |
| 20 | a single compiled version, e.g. '''html/languages/compiled/es.po.inc'''. |
| 21 | |
| 22 | == Making web pages translatable == |
21 | | For 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 | | |
23 | | 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 |
| 37 | Keep in mind that word order differs between languages, |
| 38 | so you should avoid breaking a sentence up into multiple translation units. |
| 39 | For example, use constructs like |
49 | | To allow translations of both types of pages, a project can have 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. |
| 67 | At this point you can use whatever mechanism you want to create translations of |
| 68 | your translation template. |
| 69 | |
| 70 | The easiest way is to use the |
| 71 | [TranslateIntro BOINC Translation Service], |
| 72 | a web-based system that's used for BOINC itself and for SETI@home. |
| 73 | To do this: |
| 74 | |
| 75 | * Create a Subversion repository called '''locale''', with a subdirectory for each language. This repository must be accessable by user '''boinc_trans'''. |
| 76 | * Post a request to the [http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_loc boinc_loc@ssl.berkeley.edu] email list, asking that your project be added to the BOINC Translation Service. |
| 77 | |
| 78 | When this is set up, translations will automatically be checked into your locale/ repository. |
| 79 | You'll need to periodically update the working copy of this on your web server. |
| 80 | 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'''. |
| 81 | The easiest way to do this is to create a symbolic link from the latter to the former. |