Difference between revisions of "GUI Translation"

m (Generating a translation template)
(GUI Translation (currently not available for OXAppsuite))
 
(40 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 +
=  GUI Translation =
 +
 
This page describes the steps required to translate the AJAX GUI into a new language.
 
This page describes the steps required to translate the AJAX GUI into a new language.
  
== Preparation ==
+
== File format ==
 
 
Before translating anything, it is recommended that the server and the GUI are installed as described in [[Open_Xchange_Installation|the installation tutorial]]. If translations are tested somewhere else, the server is not strictly necessary. In this case, only sections [[Open_Xchange_Installation#II.1._Operating_System|II.1]], [[Open_Xchange_Installation#II.2._Java|II.2]], [[Open_Xchange_Installation#II.7._GNU_Gettext_Tools|II.7]], [[Open_Xchange_Installation#III.1._Java|III.1]], the Saxon library from section [[Open_Xchange_Installation#III.2._Apache_Ant_and_3rd_party_dependencies|III.2]], and section [[Open_Xchange_Installation#IV.4._Open-Xchange_GUI|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:
 
* [http://gted.sourceforge.net/ gted] (Eclipse Plugin)
 
* [http://kbabel.kde.org/ KBabel] (Unix/Linux only (KDE))
 
* [http://www.poedit.net/ 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 [[Open_Xchange_Installation#IV.4._Open-Xchange_GUI|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.''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.
 
  
For example:
+
The translations use portable object (PO) files from [http://www.gnu.org/software/gettext/ GNU gettext] as file
/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:
+
== Pootle account ==
  
/usr/src/open-xchange-gui/build.xml
+
First, you need to get a Pootle account. Pootle is a web-based translation tool i. e., you do not need to download files and install translation tools. You can translate directly in Pootle.   
/usr/src/open-xchange-gui/js/check.js
 
/usr/src/open-xchange-gui/js/global.js
 
  /usr/src/open-xchange-gui/js/timezone.js
 
  
The following code-snippets only have to be enhanced by some characters, just search for the code and add what you need:
+
* Enter https://l10n.open-xchange.com in a browser.
 +
* Click the Register button
 +
* Enter your details
 +
* Enter the Pootle activation code sent by E-Mail or click on the link provided in the registration E-Mail.
  
'''/usr/src/open-xchange-gui/build.xml'''
+
Contact us via [http://www.open-xchange.com/forum/forumdisplay.php?f=26 the forum]. We then will give you the respective permissions in order to allow you to edit the files.
<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'''
+
== Translating in Pootle ==
  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'''
+
* Under Projects click on Open-Xchange
same changes as js/check.js
+
* Click on your language
 +
* If your language is not visible yet, please contact us via the forum
 +
* To make an entry click on Edit
 +
* When having finished click on Submit
  
'''/usr/src/open-xchange-gui/js/timezone.js'''
+
When having clicked the Submit button a field for the next entry opens.  
var languages    = new Array(
+
You can also skip entries by clicking the respective button.
  "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:
+
The entry field can be adjusted to your needs.
  
ant -Dlib.dir=/opt/open-xchange/lib/ deploy
+
When you are done with your translations please contact us and request for committing your changes into our repositories. It is not possible anymore to provide commit permissions due to Git repositories and complex committing mechanisms.
  
== Testing ==
+
== Test your translations ==
  
TODO: find a way to actually select new languages in the GUI.
+
To test your translations for the backend, just download the backend.po file and place it in the directory /opt/open-xchange/i18n on a backend installation. Take care to rename the file according to the language your are translating, meaning to extend the filename with two letter language and country codes. If you installed language packages on your backend installation, you can see a lot of examples for filenames in the directory /opt/open-xchange/i18n.
  
Until then, manually finding and replacing the current language setting of a user in the database should work until that user tries to change the language.
+
To test your translations for the frontend, we are working on a plugin to inject the PO files into the App Suite frontend.

Latest revision as of 08:25, 12 August 2015

GUI Translation

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

File format

The translations use portable object (PO) files from GNU gettext as file

Pootle account

First, you need to get a Pootle account. Pootle is a web-based translation tool i. e., you do not need to download files and install translation tools. You can translate directly in Pootle.

  • Enter https://l10n.open-xchange.com in a browser.
  • Click the Register button
  • Enter your details
  • Enter the Pootle activation code sent by E-Mail or click on the link provided in the registration E-Mail.

Contact us via the forum. We then will give you the respective permissions in order to allow you to edit the files.

Translating in Pootle

  • Under Projects click on Open-Xchange
  • Click on your language
  • If your language is not visible yet, please contact us via the forum
  • To make an entry click on Edit
  • When having finished click on Submit

When having clicked the Submit button a field for the next entry opens. You can also skip entries by clicking the respective button.

The entry field can be adjusted to your needs.

When you are done with your translations please contact us and request for committing your changes into our repositories. It is not possible anymore to provide commit permissions due to Git repositories and complex committing mechanisms.

Test your translations

To test your translations for the backend, just download the backend.po file and place it in the directory /opt/open-xchange/i18n on a backend installation. Take care to rename the file according to the language your are translating, meaning to extend the filename with two letter language and country codes. If you installed language packages on your backend installation, you can see a lot of examples for filenames in the directory /opt/open-xchange/i18n.

To test your translations for the frontend, we are working on a plugin to inject the PO files into the App Suite frontend.