openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [CONF] Apache OpenOffice Community > AOO4 - Websites Translation
Date Wed, 20 Feb 2013 04:46:00 GMT
Space: Apache OpenOffice Community (
Page: AOO4 - Websites Translation (

Edited by Samer Mansour:
h2. Idea

Integrate Pootle translation service into the website.  Only on static pages on
and, not for cwiki or mwiki etc.


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. Google Translate Solution

After I wrote the build solution below, I googled to see if there is a comparable solution. 
And how about that, Google offers this service...

Satisfies all of the requirements we would need.  See build solution for ideas.

For info see:

h2. Custom 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*

*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.

//User hits base page: ie.

var url = window.location.pathname;
var locale = "en";var force = "?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);  //<locale>/index.html
} else {
  redirect(file, "en"); //}
*Allow visitors to contribute to translation*

Surround pootle strings with a class so that with an 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.&nbsp; The suggestion
is then reviewed and pushed through.
This translation onhover can be omitted on item we don't want translated.

*Pootle Structure*

Thinking pages would be individual po files?[|]


Change your notification preferences:

View raw message