NOTA BENE - WORK IN PROGRESS - Your Inputs & Thoughts
Technical issues of translation
This page should give overview and details on how the translation of the user interface texts are implemented. It has the focus on developing the main CAcert web page, but may apply to other projects as well. The CAcert Training System (CATS) translation is currently handeld differently, see the CATS Translation Page.
This is a re-engineering work-in-progress. The information on this page is incomplete and may even be wrong! Please help in improving it!
If you are writing PHP code as a software developer and have a text that should be presented to the user in her selected language you just enclose the text in _( and ) like in
<h3><?=_("Are you new to CAcert?")?></h3>
The text in the parentheses is used as "ID" for the text to be shown. If no better translation can be found then the text itself is shown, so it should always be in english.
There is a tool which parses the code for this kind of strings, extract them and transfer them to the translation server, for translation by users.
Another tool fetches the hopefully finished translation from the translation server and creates a messages.po file for each language in its own subdirectory of the www/locale directory.
For Software Developers
The most important thing has already been stated in the Overview paragraph: enclose translateable texts in _( and ) .
ToDo: Which feature, library or code file does the translation? Obviously _("text") is a function call which returns the translated text...
Switching to another language
Do's and Dont's
- Try to re-use existing texts, to reduce work for the translators. But it's still important to use different texts for different things, so don't overdo text recycling!
Don't include functionally relevant things in the translatable text, like hyperlinks or HTML tags in general. The example <?=sprintf(_("This license applies to using the CAcert %s root keys %s."),'<a href="/index.php?id=3">','</a>')?> should give you the idea.
ToDo: Are IDs case sensitive? Are white spaces relevant in IDs?
For Administrators / Software Assessors
Extract new translateable texts from the code
Install updated translation from the server
To manually install an updated translation on a server, call make in the www/locale directory.
On the testservers this seems to be done automatically once every day. ToDo: Which script/service is doing this? Is this the same for the production server?
Inputs & Thoughts
Text / Your Statements, thoughts and e-mail snippets, Please
Brain/Study/Translations handles the topic of translating the texts themselves.
CATS Translation Page explains how translation is handled for the CATS.