GNOME Website - Plone and Translation
Plone is used to support several languages at www.gnome.org. There are two layers in Plone where translation happens: template layer and content layer.
Templates in Plone are used to create the XHTML markup of the site, except of the main content. This includes menues, labels, instructionary text, footers and so on. Templates are also used to create views on content or on folders.
Translating them is a built-in feature of Plone, in short: In Zope-Page-Templates the programmer or web-designer provides message-ids for each string. They are extracted manually or with help of i18ndude and are written to a gettext pot-file. The pot-file resides in the corresponding python-package and lives in filesystem. So it can be managed by a VCS. Translators can pick up the files, translate them and store them back into the python-package. After update on the server and restart of the application server the translations are loaded.
In Plone content is usally added through the web. Content are items like a Document, a News Item, an Image or an File. The addon LinguaPlone is used to translate those items.
Default Strategy of LinguaPlone
this is the process Plone offers without the proposed add-ons for wgo. Gnome-translators will never touch it.
LinguaPlone builds up linked parallel trees of content. One tree for each language. In Plone content is organizes in folders and subfolders. A folder may have a default view (i.e. listing of contained items) or an item in the folder can be picked as the default item showed when accessing the folder.
The default process to create translated content works this way:
Create an item and select its language, save it. Its the so called canonical item.
- Select the language for translation in the content menu. A copy is created and a side-by-side view shows the new items form on the left and the canonical items content on the right.
This need to be repeated for every language needed.
The translated item is created parallel to the existent canonical item. But if the folder the item is contained in is already translated, the item will be stored in the translated folder and not in the canonical items folder. This works up the tree for the complete website structure. This way the url to the translated content item is different and translated as well. After each translation an internal reference between the canonical and all translated objects is kept. This helps to keep translations together.
If content is not translated there is by default no fallback language! The content just does not exist for the visitor of the non-canonical language.
Integration Plone content with gnome's translation process
the wgo-plone team is only 90% sure about the process and how best to integrate, here a proposal from plones point of view how integration can be solved.
Gnome Translation Team uses GNU-Gettext PO/POT files to translate everything. Those files are stored somewhere in a VCS (like GIT).
Image-Handling: Original english images are stored in a subfolder "figures" of the english po-files. Translations are stored with the same filename in the subfolder figures of the translation.
Also we assume the technicians of the gnome translation team are able to interface with webservices (simple XML-RPC) offered to fetch a list of items. For each item it pulls XML files from the webservice and pushes back translated xml-files. This xml-files can be processed with xml2po in both directions.
A fallback to english is needed if the item is not (yet) translated.
If english text has changed, existing translations are replaced by the english original, accuracy in the strings takes priority over having them localised.
All content items (e.g. page, news item, event) are created in English through the web browser using Plone's user interface. That's the 'canonical item' in LinguaPlone's terminology.
- Translations are never edited through the Plone UI!
- When item is saved a translation is created automatically for every supported language.
- When an item is edited each, each field with changes is copied to all translations. The translated item shows the english text.
- As long as no translation is uploaded by the gnome i18n team, the item will always show the current content of the English original.
- Translation team pulls a list of unique ids (UID) of items from a webservice offered by the website. For each a UID it pulls one xml-file from the web service.
- Translation team takes (automation is needed here) each xml-file and uses xml2po to create the gettext format template. This is stored in the VCS. Now translations are created.
- The gettext files are transformed back to the XML format using xml2po. A language-identifier is added in the xml. Now the file is pushed back to the webservice. The webservice picks up the translation and dispathces it to the translated item according to the language set in the XML.
- If someone changes a field of the English item the translated item's field is overwritten immediately. The field of the translated item is english again. Up-to-date content has priority over translated content.
Inside Plone we are using the built-in feature of marshalling and de-marshalling content to a well-formed XML format called ATXML (Example ATXML Document) The ATXML will only export relevant fileds (different from the example shown).
The webservice has three features:
fetch: takes a date/time as an optional parameter, returns a list of UIDS of all canonical items modified after the given date (or all if no date was given).
pull: takes an UID as parameter, returns the ATXML text of the item.
push: takes an ATXML document as parameter, returns Boolean (True=success).