Adding Translations to Perforce QAC

Perforce QAC translations for both the GUI and CLI interfaces can now be added for any language of your choice, using the third party Qt Linguist tool1. These translations will then appear in both the GUI and CLI interfaces.

The following steps describe the process of adding a translation to Perforce QAC, using the German language as an example.

  • You need to find the default.ts in the translations subdirectory of the Perforce QAC installation directory.
    • On Windows this location would be:
    • C:\Perforce\QAC-<version>\common\translations

    • On Linux, assuming that Perforce QAC was installed in the home folder of user bloggs, this location would be:
    • /home/bloggs/QAC-<version>/common/translations/

  • The file default.ts must be copied to create a new file, and this new file given a suitable name. Because, in this case, German translations are to be added, it is recommended that the copied file is renamed to de.ts, since de is the two-character language code for the German language. A link to a table containing the ISO list of language codes is provided in the links at the end of this section.
  • The newly created file can then be opened using the Qt Linguist tool. On opening the file, Qt Linguist will prompt you to select the source and target languages. The source language must be left unchanged but you can select your target language. For this example, German must be selected.
  • Links to both the Qt Linguist tool and manual can be found at the end of this section.
  • Translations may then be added using Qt Linguist.
  • Once the translation file has been updated and saved, the translations can be ’released’ to generate a .qm file. This can be achieved by using either Qt Linguist (select File : Release), or the terminal/command prompt.
  • To generate the .qm file in a terminal/command prompt, you need to navigate to the translations subdirectory and run the lrelease command as follows:

    On Linux:

    cd /home/bloggs/QAC-<version>/common/translations/lrelease de.ts

    On Windows:

    cd C:\Perforce\QAC-<version>\common\translations\ lrelease.exe de.ts

    The file that is generated in our example is called de.qm, which is the file used by Perforce QAC for translation. This new language will appear in the Admin : Languages menu of the GUI and can also be used when setting the language using the CLI.

  • For messages containing strings of the type "%1", "%2", and so on, these strings must also be present in the translation. Removal of these strings will cause unexpected behavior in Perforce QAC.
  • For example, considering the following source:

    Open files %1 and %2

    A valid German translation would be:

    Dateien %1 und %2 öffnen

    • If a .ts file is modified, the release step must be repeated to generate a new .qm file
    • It is not necessary to translate all strings before running the release step. Unfinished translations are simply ignored by Perforce QAC.
    • The above procedure can be repeated several times to add translations for multiple languages
    • Using the two-character language codes to name the .qm files is recommended since using this convention causes the localized name of the language to be displayed in the Admin : Languages menu. Considering the above example, the additional language would appear as Deutsch and not German.

Useful links: