Nominate our 2022 Qt Champions!

How to use translate using control script

  • I use QTIFW 2.0.1 to build the installation for a Qt project to be deployed in both Windows and Mac with international support. I set a new welcome message on the introduction page in a control script similar to follows:
    Controller.prototype.IntroductionPageCallback = function(){
    var widget = gui.currentPageWidget(); // get the current wizard page
    if (widget != null) {
    widget.MessageLabel.setText(qsTr("New Message.")); // set the welcome text
    I use "qsTr" to initiate the translation and I also include the name of the translate file (.qm) in config.xml. After building the installation, the "New Message" is not translated.
    Here are my questions:

    1. Is "qsTr" supported in control scripts? Or can it be only used in the component script?
    2. There is an option to set the translation files in config.xml. This is the place I set the qm file for the control script but it is not working. What is the correct way to use it in the installation?
    3. I tried to overwrite the introduction message in component script (Installscript.js) if not using the control script. But the introduction page uses the default text message and the text is not updated. Is there anything wrong with the following code?
      function Component(){
      changeIntroductionLabels = function(){
      page = gui.pageWidgetByObjectName("IntroductionPage");
      page.MessageLabel.setText(qsTr("New Message"));
      Thanks for any help.

Log in to reply