Create translations for Commander Wars - Robosturm/Commander_Wars GitHub Wiki

Basics

Commander Wars uses Qt's translation tools and translation process. Please refer to qt's Linquist manual for example: https://doc.qt.io/qt-6/qtlinguist-index.html On how to use lupdate and qt's inquist tools.

The tools search for text which can have one of the following syntaxes:

  • tr("My nice text") in cpp files
  • qsTr("My nice text") in js files
  • QT_TRANSLATE_NOOP("GAME","My nice text") in xml files

Those are/can be added to the .ts-File which is used for translating files from one language to another. The base game provides a a ts-File for all texts found and marked in the source code here: https://github.com/Robosturm/Commander_Wars/blob/master/translation/lang_en.ts

Add a new Language

Requirements:

  • Have a downloaded version of the source code
  • Have at least qt's linquist tool installed. --> Provided by installing Qt
  1. Copy lang_en.ts and change the ending of en to the correct language code of your region e.g. de_DE for German in Germany
  2. Translate the entries using linquist
  3. Use the release option to create the binary file e.g. lang_de_DE.qm
  4. Create the folder translation and copy the file into it.
  5. Start the game the language should now be selectable
  6. Create an issue or pull request provding the ts file. So the language can be made available for everyone

Add translations to a mod

1 Create a lang_*.ts file using Qt's lupdate tool provided by qt. Note please refer to the qt-documentation on how to use the command line tool 2 Continue in step 2 of the section Add a new language