Space: Apache OpenOffice Community
(https://cwiki.apache.org/confluence/display/OOOUSERS)
Page: AOO4 - Websites Translation
(https://cwiki.apache.org/confluence/display/OOOUSERS/AOO4+-+Websites+Translation)
Edited by Samer Mansour:
---------------------------------------------------------------------
h2. Idea
Integrate Pootle translation service into the website. Only on static
pages on oo.org and oo.a.org, not for cwiki or mwiki etc.
*Benefits:*
Translations for announcements and the website can be done efficiently.
Translation can be done by anonymous visitors (uncommitted until reviewed).
I looked at the documentation, but I need someone with experience with pootle
to get help on possible ways to integrating it into our site.
h2. Build Solution
Based on idea of builds, pages are pre-generated.
*Template File*
A template file for each page that contains all the HTML/javascript/css it
would normally but strings are replaces with pootle keys. ie. "HomePageTitle",
"News.Apache4Annoucement"
The template file would be checked into the CMS. This would barely change.
*Generating Translated Files*
Batch Mode - Script would iterate over each page for each language for a build
and check it into the CMS.
Individual File - A user would initiate a build for a particular language and
page.
*URL / File Structure*
openoffice.org/index.html
openoffice.org/index.html?force=it
openoffice.org/en/index.html
openoffice.org/fr/index.html
openoffice.org/de/index.html
openoffice.org/it/index.html
*Allow Override*
Variable "force" will send user to their choice of language. Drop down in the
header on the homepage. IE. Someone in Spain chooses view in Italian,
or Canada chooses Romanian.
Incomplete code example of handling from base page, no locale in URL.
{code}
//User hits base page: ie. openoffice.org/index.html
var url = window.location.pathname;
var locale = "en";var force = window.location.search.replace( "?force=", "" );
if (force.length>0) { // Forced
document.cookie = "usr.locale=" + force + ";";
locale = force;
} else { //No language selected, detect it.
locale = getCookie("usr.locale");
if ( locale == null ) { // Not in Cookie
if ( window.navigator.language ) { // Basically Every Browser
locale = window.navigator.language;
} else if ( navigator.browserLanguage ) { // Internet Explorer...
locale = navigator.browserLanguage;
}
}
document.cookie = "usr.locale=" + locale + ";";
}
if (translationExists(file, locale)) { //Simple file check
redirect(file, locale); // openoffice.org/<locale>/index.html
} else {
redirect(file, "en"); // openoffice.org/en/index.html}
{code}
*Allow visitors to contribute to translation*
Surround pootle strings with a javascript onhover function (3 seconds wait, or
double click) "Translation Poor? Click to translate\!" \-> Forwards visitor to
Pootle instance in anonymous mode, visitor can then suggest a better
translation. The suggestion is then reviewed and pushed through.
*Pootle Structure*
Thinking pages would be individual po
files?[|https://translate.apache.org/ca/OOoWebsite/index.po]
[https://translate.apache.org/ca/OOoWebsite/index.po][https://translate.apache.org/ca/OOoWebsite/download.po][https://translate.apache.org/ca/OOoWebsite/why.po]
Change your notification preferences:
https://cwiki.apache.org/confluence/users/viewnotifications.action