![]() |
CopperSpice API
2.0.0
|
Programmers can mark both text strings and keyboard short cuts as targets for translation to another language such as German, French, or Russian. To generate run time text translations for a CopperSpice application the following steps are required.
For information about how to mark the strings in your source code which should be translated refer to Modifying Your Source Code for Translation.
For information about this step refer to Linguist lupdate Application.
For information about using Linguist refer to Linguist Application.
The instructions about how to modify your CMake files to compile the TS files and generate QM files can be found in our CopperSpice Overview documentation. The following is a link to a sample project which uses multiple translation files.
There are several ways to load the translation files and normally this will be done at program start up.
The following example shows how to use QTranslator::load() to select a translation file based on the user's system locale settings. The exact name for the QM file is concatenated and if the locale is Germany, this will result in "myApp_de.qm". This file must be located in the "resources" directory in a qrc file.
The call to QCoreApplication::installTranslator() must be done after the translation file has been loaded.