Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to use translate using control script

How to use translate using control script

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
1 Posts 1 Posters 436 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    chun
    wrote on last edited by
    #1

    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(){
      gui.pageWidgetByObjectName("IntroductionPage").entered.connect(changeIntroductionLabels);
      }
      changeIntroductionLabels = function(){
      page = gui.pageWidgetByObjectName("IntroductionPage");
      page.MessageLabel.setText(qsTr("New Message"));
      }}
      Thanks for any help.
      Chun
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved