Menu

HOWTO Translate

Jens Nissen
Attachments
add-qm-file.png (24676 bytes)
linguist-actions.png (6841 bytes)
project-tree.png (26456 bytes)

Maintained translations:

(en) - English - ChessX development team
(de) - German - Jens Nissen, Joachim Katzer

Translations not up to date

(fr) - French - Sylvain Philip, Olivier Roset, Jens Nissen
(it) - Italian - Bruno Rizzuti, Jens Nissen
(da) - Danish - Byrial Jensen, Jens Nissen
(es) - Spanish - Benigno Hernández Bacallado, Eduardo Sadier
(ru) - Russian - Alexander L.
(cz) - Czech - Filip Rubner
(zh) - Chinese - Anthony Jiang
(nl) - Dutch - Ron Oortwijn
(pl) - Polish - Michal Rudolf
(pt_BR) - Brazilian Portuguese - Leandro de Oliveira

Participate - short instruction

If your language is not available and you want to translate ChessX yourself, all you need is a working Qt installation. Here are the steps you should follow:

  1. Send an e-mail to chessx-devel mailing list and tell you are going to translate ChessX into your language. This is to avoid duplicate translations.
  2. Find the two-letter i18n code for your language. Below, xx is used to mark this code.
  3. If there is already a i18n/chessx_xx.ts file, use it. If there is not, go to main ChessX directory and run:

    lupdate chessx.pro -ts -target-language xx i18n/chessx_xx.ts

  4. Open the file in Linguist and translate messages. The program has some builtin help, you can also find details in Qt documentation
  5. Save and compile the file using lrelease chessx_xx.ts
  6. Put the resulting chessx_xx.qm file in data/lang directory and test it. After running ChessX, it should work in your language.
  7. If everything is OK, send the file chessx_xx.ts to the current maintainer. You can find the address in Help->About dialog of ChessX.

Instead of (5) and (6) above you may edit chessx.pro, adding your file to the list that begins with TRANSLATION =. This will result in putting your translation in the binary. Note that ChessX first checks whether a translation is present in data/lang directory; if no appropriate file is there, the translation compiled into the binary is used.

Participate - detailed version

Let's follow the complete process with a little example. Let's assume, we want to make an addition to the French translation.
First of all: we need to get the latest source code for the project - read on here: Fetch the Code and you need a roughly up-to-date installation of the Qt development environment which contains the creator and linguist.

You should now have the unzipped code on your hard disk. Let's open a terminal / cmd shell in the root of chessx . you should see the following important parts of chessx:

iMac$ ls chessx.pro i18n/
chessx.pro

i18n/:
chessx_cz.ts    chessx_de.ts    chessx_it.ts    chessx_pt_BR.ts chessx_zh.ts
chessx_da.ts    chessx_es.ts    chessx_nl.ts    chessx_ro.ts
chessx_de.qm    chessx_fr.ts    chessx_pl.ts    chessx_ru.ts

chessx.pro is the project file which contains referencs to the translations.
Open QtCreator by double-clicking the project file (this assumes you have installed Creator and Qt).
We now need to edit the project file: Around line 565 (search for the string "TRANSLATIONS") you will find the following:

TRANSLATIONS = i18n/chessx_de.ts

#\
#        i18n/chessx_da.ts \
#        i18n/chessx_fr.ts \
#        i18n/chessx_it.ts \
#        i18n/chessx_cz.ts \
#        i18n/chessx_ru.ts \
#        i18n/chessx_es.ts

#   i18n/chessx_nl.ts \
#   i18n/chessx_pl.ts \
#   i18n/chessx_pt_BR.ts \
#   i18n/chessx_ro.ts \
#   i18n/chessx_zh.ts

Assuming we edit the French translation, we need to modify the project file. Move the line with "_fr" upwards and remove the hashtag:

TRANSLATIONS = i18n/chessx_de.ts \
    i18n/chessx_fr.ts

Make sure you insert the line continuation "\" after the chessx_de.ts !
Save the file and compile the complete project. (I assume that you configured your Qt installation with the project and BTW: I recommend to disable the shadow build. This might make things less confusing).

You will then find a hint on the current state of affairs in the compilation output:

22:01:29: Starting: "/Library/Developer/CommandLineTools/usr/bin/make" -j16
/Users/jens/Qt/5.15.2/clang_64/bin/lrelease i18n/chessx_fr.ts -qm i18n/chessx_fr.qm
Updating 'i18n/chessx_fr.qm'...
    919 Übersetzungen wurden erzeugt (881 abgeschlossen und 38 nicht abgeschlossen)
    27 nicht übersetzte Texte wurden ignoriert

There are 38 incomplete translations and 27 missing string - a lot of work needs to be done!

ProjectTree

Start Linguist by Right clicking, select "Open With" -> "Linguist".
Linguist has a toolbar and that's pretty much all you need to start with:

LinguistActions

See the orange button - press it and you will be guided to the first missing text.
You can now type in a translation and press one of the green check mark buttons. The right one will also lead you to the next missing translation.
After you are done with Linguist, close the linguist and go back to Creator. We are nearly done:

Select the "Tools"-menu: Tools->External->Linguist->Update Translations (lupdate)
You will get a message like this:

Updating 'i18n/chessx_de.ts'...
    Found 1014 source text(s) (5 new and 1009 already existing)
Updating 'i18n/chessx_fr.ts'...
    Found 1014 source text(s) (103 new and 911 already existing)
    Kept 35 obsolete entries
    Same-text heuristic provided 28 translation(s)

Now you can compile the complete project. Creator will create a binary translation resource.
Let's add this resource into ChessX:

AddResource

Right click i18n and select the menu entry "Add existing Files ...". Select the file chessx_fr.qm
Final action: You need to compile ChessX one more time now.

Congratulations - you got it!

Start ChessX, open the Preferences Menu, go to the App tab, select your translation file ("fr" in our example). Close the Preferences and restart ChessX.
Et voilà: ChessX parle français.


Discussion

  • Josue Danilo Pineda Castaneda

    Hello, someone helps me to get the original language file in English, to be able to translate it into Spanish. I have "QT creator", I don't know if that's the program I need.
    Thank you.

     
  • Jens Nissen

    Jens Nissen - 2021-06-29

    I have updated instructions, I hope this helps. After fetching the ChessX code, you will find already a lot has been done for the Spanish translation. Just follow my steps and whereever the instructions say "fr" use "es" instead.

     
    • Josue Danilo Pineda Castaneda

      Thanks.
      I will try to follow the instructions adapting them to Windows.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.