Difference between revisions of "GUI Translation"

m (added gettext link)
(Installing: New language registration process.)
Line 22: Line 22:
 
== Installing ==
 
== Installing ==
  
After a POT file is translated or merged, it should be saved as ox.''LANG''.po, where ''LANG'' is the language code like e. g. ''de_DE'' or ''en_US''. Any directory below the ''i18n'' directory of the GUI source will work, but to avoid conflicts with other translations, each translation should be saved as i18n/''LANG''/po/ox.''LANG''.po.
+
After a POT file is translated or merged, it should be saved as ox.''xx_XX''.po, where ''xx_XX'' is the language code like e. g. ''de_DE'' or ''en_US''. Each translation should be saved as i18n/''xx_XX''/po/ox.''xx_XX''.po.
  
 
For example:
 
For example:
 
  /usr/src/open-xchange-gui/i18n/xx_XX/po/ox.xx_XX.po
 
  /usr/src/open-xchange-gui/i18n/xx_XX/po/ox.xx_XX.po
  
Now we have to tell the GUI and and the build script where to find our new translation and how to name it in the user configuration. To make this more transparent, i will use ''xx_XX'' as my new language. Make sure that you have to do all this modifications in the '''source''' files, not at the already compiled scripts. This has to be done at the following places:
+
To include the new language in the build process, one line must be added to the file i18n/languages.js:
 
+
  var all_languages = {
/usr/src/open-xchange-gui/build.xml
+
   
/usr/src/open-xchange-gui/js/check.js
+
  "ca_ES": "Català",
  /usr/src/open-xchange-gui/js/global.js
+
"de_DE": "Deutsch",
  /usr/src/open-xchange-gui/js/timezone.js
+
  "en_US": "English",
 
+
"fr_FR": "Français",
The following code-snippets only have to be enhanced by some characters, just search for the code and add what you need:
+
"ja_JP": "日本語",
 
+
"xx_XX": "Language name"
'''/usr/src/open-xchange-gui/build.xml'''
+
   
  <copy todir="${langdir}" encoding="UTF-8">
+
  };
  <!-- <fileset dir="i18n" includes="**/*.po"/> -->
 
  <fileset dir="${basedir}">
 
    <include name="${builddir}/ox.de_DE.po"/>
 
    <include name="i18n/en_US/po/ox.en_US.po"/>
 
    <include name="i18n/fr_FR/po/ox.fr_FR.po"/>
 
    <include name="i18n/xx_XX/po/ox.xx_XX.po"/>
 
  </fileset>
 
 
 
'''/usr/src/open-xchange-gui/js/check.js'''
 
  if (match) {
 
  if (match[2]) {
 
    lang = match[1].toLowerCase() + "_" + match[3].toUpperCase();
 
    if (!{"de_DE": true, "en_US": true, "fr_FR": true, "xx_XX": true}[lang])
 
      lang = {de: "de", en: "en", fr: "fr", xx: "xx"}[match[1].toLowerCase()] || "de";
 
  } else
 
        lang = {de: "de", en: "en", fr: "fr", xx: "xx"}[match[1].toLowerCase()] || "de";
 
  }
 
 
 
'''/usr/src/open-xchange-gui/js/global.js'''
 
  same changes as js/check.js
 
  
'''/usr/src/open-xchange-gui/js/timezone.js'''
+
Please note that each language line ''except the last one'' must end with a comma.
var languages    = new Array(
 
  "English"
 
  ,"German"
 
  ,"French"
 
  ,"XX-Language");
 
 
var language_code = new Array("en_US", "de_DE", "fr_FR", "xx_XX");
 
  
 
After that, the new translation must be transformed to JavaScript and copied to its final destination on the web server. this is done by starting Ant again, as described in [[Open_Xchange_Installation#IV.4._Open-Xchange_GUI|section IV.4]] of the installation tutorial:
 
After that, the new translation must be transformed to JavaScript and copied to its final destination on the web server. this is done by starting Ant again, as described in [[Open_Xchange_Installation#IV.4._Open-Xchange_GUI|section IV.4]] of the installation tutorial:
  
 
  ant -Dlib.dir=/opt/open-xchange/lib/ deploy
 
  ant -Dlib.dir=/opt/open-xchange/lib/ deploy

Revision as of 11:49, 22 October 2007

This page describes the steps required to translate the AJAX GUI into a new language.

Preparation

Before translating anything, it is recommended that the server and the GUI are installed as described in the installation tutorial. If translations are tested somewhere else, the server is not strictly necessary. In this case, only sections II.1, II.2, II.7, III.1, the Saxon library from section III.2, and section IV.4 of the tutorial are relevant.

The translations use portable object (PO) files from GNU gettext as file format. There are several tools available to edit the translations:

  • gted (Eclipse Plugin)
  • KBabel (Unix/Linux only (KDE))
  • poEdit (Multi-Platform)
  • Any text editor, since PO files are simple UTF-8 text files.

At least one of these will be required by the translator.

Generating a translation template

Translations are usually performed by filling out a translation template. This template (a file with the extension .pot) is generated by executing the pot task in Ant. Execute this at your open-xchange-gui source directory:

ant -Dlib.dir=/opt/open-xchange/lib/ pot

The -D switch should specify the same path as in section IV.4 of the installation tutorial. This will produce a file called ox.pot in the i18n directory of the GUI source. This file contains all untranslated text strings found in the source code. The corresponding entries can be either entered manually or merged automatically with an existing translation created for an older version of the GUI. In the latter case, only new and changed strings need to be updated manually. You will now have to modify (translate) the created .pot file with a translation tool of you choice, the dedicated tools are a great help for this task.

Installing

After a POT file is translated or merged, it should be saved as ox.xx_XX.po, where xx_XX is the language code like e. g. de_DE or en_US. Each translation should be saved as i18n/xx_XX/po/ox.xx_XX.po.

For example:

/usr/src/open-xchange-gui/i18n/xx_XX/po/ox.xx_XX.po

To include the new language in the build process, one line must be added to the file i18n/languages.js:

var all_languages = {

"ca_ES": "Català",
"de_DE": "Deutsch",
"en_US": "English",
"fr_FR": "Français",
"ja_JP": "日本語",
"xx_XX": "Language name"

};

Please note that each language line except the last one must end with a comma.

After that, the new translation must be transformed to JavaScript and copied to its final destination on the web server. this is done by starting Ant again, as described in section IV.4 of the installation tutorial:

ant -Dlib.dir=/opt/open-xchange/lib/ deploy