Difference between revisions of "GUI Translation"

(Checking that the translated Javascript file is valid)
(GUI Translation (currently not available for OXAppsuite))
 
(23 intermediate revisions by 6 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.
Please have a look at [[Hyperion_Translation]] to see which translations are already available and which are missing at the moment.
 
 
== Preparation ==
 
 
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 [http://www.gnu.org/software/gettext/ 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)
 
* [http://www.omegat.org/ OmegaT] (Java, 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 in your open-xchange-gui '''source''' directory:
 
 
ant 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.''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''/ox.''xx_XX''.po.
 
 
For example:
 
/usr/src/open-xchange-gui/i18n/<i>xx_XX</i>/ox.<i>xx_XX</i>.po
 
 
To include the new language in the build process, one line must be added to the file i18n/languages.js:
 
 
var all_languages = {
 
 
  "de_DE": "Deutsch",
 
  "en_GB": "English (UK)",
 
  "en_US": "English (US)",
 
  "fr_FR": "Français",
 
  "<i>xx_XX</i>": "<i>Language name</i>",
 
 
"":""};
 
 
Please note that each language line 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 [[Open_Xchange_Installation#IV.4._Open-Xchange_GUI|section IV.4]] of the installation tutorial:
 
 
ant deploy
 
 
==Installing a CVS translation on a released version of OX==
 
 
Most people probably use the CVS version of OX to generate the pot file. However, you may want to deploy the translation on a stable, released version of OX. In that case you might want to consider following these instructions.
 
 
First of all, you should "deploy" the translation to a fake directory instead of the default (/var/www). This can be done by editing the ''open-xchange-gui/build.xml'' file. If you look at the ''deploy'' target, you'll notice that the modified files are copied to ''${destdir}/${htdoc}'':
 
  
<target name="deploy" depends="all_with_clean">
+
== File format ==
    <copy todir="'''${destdir}/${htdoc}'''">
 
    --- snip ---
 
  
By default the ${htdoc} points to ''/var/www'', which is not the correct path in any case (should probably be ''/var/www/html/ox6''). We change ''htdoc'' to point to a fake directory:
+
The translations use portable object (PO) files from [http://www.gnu.org/software/gettext/ GNU gettext] as file
  
<project name="HEAD-gui" default="all" basedir=".">
+
== Pootle account ==
        <!-- Changed deploy path to avoid troubles -->
 
        <property name="htdoc" value="'''/tmp/ox/'''"/>
 
        --- snip ---
 
  
After modifying the ''build.xml'' we do a couple of simple steps:
+
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. 
  
* Create the directory ''/tmp/ox''
+
* Enter https://l10n.open-xchange.com in a browser.
* Run ''ant deploy'' in ''open-xchange-gui''
+
* Click the Register button
* Copy the ''/tmp/ox/lang/xx_XX.js'' to the correct OX directory (usually ''/var/www/html/ox6/lang'')
+
* Enter your details
* Edit the ''/var/www/html/ox6/lang/languages.js'' as shown above
+
* Enter the Pootle activation code sent by E-Mail or click on the link provided in the registration E-Mail.
  
The translation should now be ready for use. However, to avoid unnecessary trouble, also do the following steps:
+
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.
  
* Restart Open X-change server (e.g. ''/etc/init.d/open-xchange-groupware restart'')
+
==  Translating in Pootle ==
* Restart Apache (e.g. ''/etc/init.d/httpd restart'')
 
* Clear your browser's cache
 
  
==Checking that the translated Javascript file is valid==
+
* 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
  
If your translated ''xx_XX.js'' file does not seem to work correctly, you can used ''grep'' to verify that it's correctly formatted. In my case OmegaT translation tool generated a faulty ''po''-file, which in turn was converted into faulty ''js'' file:
+
When having clicked the Submit button a field for the next entry opens.  
 +
You can also skip entries by clicking the respective button.
  
$ '''grep -v ".*:.*" fi_FI.js'''
+
The entry field can be adjusted to your needs.
        msgid "New Appointment"
 
msgstr ""
 
  
This kind of faulty lines need to be removed or things won't work correctly.
+
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.
  
You should also verify that the first line of the translated ''js'' file is the same or similar to the existing, working translations:
+
==  Test your translations ==
  
$ '''head -n 1 de_DE.js'''
+
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.
{nplurals: 2, plural: function(n) { return (n != 1); }, dictionary: {
 
  
In my case the header did not look anything like this, so I had to fix it.
+
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.