Skip to content

ContributingQtelLanguageTranslation

Tobias Blomberg edited this page Oct 18, 2015 · 4 revisions

Qtel language translation

Qtel is designed to support translation of the GUI (Graphical User Interface) to other languages than English. It works like this:

  1. All texts in the application are written in English

  2. Each text string is extracted by a special utility (lupdate) and written to a ts-file (e.g. qtel_xyz.ts, where xyz is a language code)

  3. The ts-file can then be processed using a graphical tool, called Qt linguist, to translate each string into another language. The translations are written back to the ts-file.

  4. When Qtel is built, the ts-files will be translated into qm-files (e.g. qtel_xyz.qm). These files will be installed and can be used by Qtel to display the GUI in another language.

It may sound complicated but anyone can do it, even if you don’t know anything about programming, so don’t be afraid to give it a try.

Required software

To be able to do any translating work, the Qt linguist application need to be installed. Just search the package repository of your linux distribution and you will probably find it.

It should be possible to install the application on Windows as well but I have not tried this.

The version of Qt linguist that should be used is the one for Qt4.

Creating a translation for a new language

If there is no existing translation for a language, a few steps are needed before starting the actual translation work. The first step is to download a language template file (i.e. qtel_tmpl.ts).

Rename the downloaded template file, replacing "tmpl" with your ISO 639 language code. The language code consists of two or three letters (e.g. sv=Swedish, en=English). If you are not sure what your language code is, have a look on this page for example. Use the two letter variant if available.

Finding an existing translation

If a language translation already exist for a language, it can be found in the SvxLink source tree. The easiest way to get the hands on a translation file is to download it from this directory on GitHub or use one of the links below.

Each language translation file is named qtel_xx.ts, where xx is the language code. If you are not sure what your language code is, have a look on this page for example.

These are the translations that are available at the present moment:

Editing the translation

We now have a language translation file (ts-file). Time to start editing! This is done using the Qt linguist tool. Either start Qt Linguist from the menu 'Development/Qt4 Linguist' and open the template file or launch it directly on the command line with:

linguist qtel_xx.ts

or possibly

linguist-qt4 qtel_xx.ts

Help on using Qt Linguist is available inside the application so I won’t repeat any of it here.

Testing your work

To test your work you must first process your ts-file into a qm-file. This is normally done during the SvxLink build process but Qt linguist can also be used to process one single file. In the application menu, select 'File/Release' or 'File/Release As…​' and the qm-file will be created.

For Qtel to find your new translation file it need to be copied to the correct directory. Where Qtel look for translation files depend on how it was built. It is possible to change the path during the build process. The most common paths are:

/usr/share/qtel/translations
/usr/local/share/qtel/translations

If your system is set up to use the language that you just created a translation for, Qtel should now automatically use your language file. If you are not running your desktop in the language you just created a translation for it is possible to force qtel to use a specific language. This is done by setting the 'LC_MESSAGES' environment variable before running Qtel. For example:

LC_MESSAGES=sv qtel

Submitting your work

When you are done, compress the file:

gzip qtel_xx.ts

Then send it to the svxlink-devel mailing list.

If you are able to handle Git and GitHub, it is of course also OK (or even preferable) to submit the new translation file as a pull request. It should then be in uncomressed form and put into the 'src/qtel/translations' source directory.

Clone this wiki locally