Manage Translations of the Wazo Client

This sections describes how to manage Wazo Client translations from a developer point of view. If you want to help translate the Wazo Client, see Translating Wazo

You need to install these tools:

pip install transifex-client
apt-get install qt4-dev-tools

How to Add a New Translated String

String to be translated is marked using the tr macro in the source code.

Example:

tr("Number");

Updating translations on transifex

Run the following commands from the root of the wazo-client-qt project:

make pushtr

After this command, you can visit Transifex, and check that the wazo-client is 100% translated for your language. Once all the translations have been checked, run the 3 following commands:

make pulltr
git commit
git push

Warning

Under Arch Linux, you must have qt5 installed and prepend QT_PATH=/usr/bin before make {pull,push}tr.

Add a new Wazo Client locale

Localizing the Wazo Client goes through four steps :

  • Creating the new translation in Transifex
  • Generatint the translation files
  • Embedding the translation in the binaries
  • Displaying the new locale to be chosen

Creating the new translation in Transifex

Log into Transifex and click the Create language option.

Generate translation files

The translation files will be automatically generated from the source code.

For the command to create files for your locale, you need to ensure it is listed in the project file.

There are a few project files you should edit, each one will translate a module of the Wazo Client :

  • baselib/baselib.pro
  • wazoclient/wazoclient.pro
  • wazoclient/xletlib.pro
  • wazoclient/src/xlets/*/*.pro

In these files, you should add a line like this one:

TRANSLATIONS += $$ROOT_DIR/i18n/wazoclient_fr.ts

This line adds a translation file for french. Please replace fr by the code of your locale. The $$ROOT_DIR variable references either wazoclient or baselib.

You can use a command like the following to automate this ($LANG is the new language):

find . -name '*.pro' -exec sed -i -e 's|^TRANSLATIONS += $${\?ROOT_DIR}\?/i18n/\(.*\)_en.ts|\0\nTRANSLATIONS += $$ROOT_DIR/i18n/\1_$LANG.ts|' {} \;

To actually create the files, you will have to use the translation managing script. But first, you must tell the script about your new locale. Edit the utils/translations.sh file and add your locale to the LOCALES variable. Then, you can run the script:

$ make pulltr

Embed the translation files

For each project previously edited, you should have a corresponding .qrc file. These resource files list all files that will be embedded in the Wazo Client binaries. You should then add the corresponding translation files like below:

<file>obj/wazoclient_fr.qm</file>

This embeds the French translation of the wazoclient module, corresponding to the translation file above. The path is changed to obj/ because the .qm file will be generated from the .ts file.

You can use a command like the following to automate this ($LANG is the new language):

find . -name '*.qrc' -exec sed -i -e 's|^\( *\)<file>\(.*\)obj/\(.*\)_fr.qm</file>|\0\n\1<file>\2obj/\3_$LANG.qm</file>|' {} \;

Display the new locale

You have to edit the source file wazoclient/src/configwidget.cpp and add the entry corresponding to your locale in the locale-choosing combobox.