Uploaded image for project: 'Qt Installer Framework'
  1. Qt Installer Framework
  2. QTIFW-2102

The qsTr method does not work on component scripts.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 4.0.0, 4.0.1
    • Translations
    • All

    Description

      I created a simple installer with a translated string test post.

      all lines are translated except those in installscript.qs

      <?xml version="1.0" encoding="utf-8"?>
      <!DOCTYPE TS>
      <TS version="2.1" language="ru_RU">
      <context>
          <name>Page</name>
          <message>
              <source>Translations Example</source>
              <translation>Пример переводов</translation>
          </message>
          <message>
              <source>This is some text.</source>
              <translation>Это какой то текст</translation>
          </message>
      </context>
      <context>
          <name>installscript</name>
          <message>
              <source>This is a dynamically created page.</source>
              <translation>Это динамически созданная страница</translation>
          </message>
      </context>
      </TS>
      

      installscript.qs

      function Component()
      {
          // constructor
          component.loaded.connect(this, Component.prototype.loaded);
          installer.addWizardPage(component, "Page", QInstaller.TargetDirectory)
      }
      
      Component.prototype.createOperations = function()
      {
          try {
              // call the base create operations function
              component.createOperations();
          } catch (e) {
              console.log(e);
          }
      }
      
      Component.prototype.loaded = function ()
      {
          var page = gui.pageByObjectName("DynamicPage");
          if (page != null) {
              page.entered.connect(Component.prototype.dynamicPageEntered);
          }
      }
      
      Component.prototype.dynamicPageEntered = function ()
      {
          var pageWidget = gui.pageWidgetByObjectName("DynamicPage");
          if (pageWidget != null) {
              pageWidget.m_pageLabel.text = qsTr("This is a dynamically created page.");
          }
      }
      

      package.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <Package>
          <DisplayName>The root component</DisplayName>
          <Description>This component contains a license and translations to German.</Description>
          <Version>0.5.0-1</Version>
          <ReleaseDate>2015-01-29</ReleaseDate>
          <Licenses>
              <License name="Beer Public License Agreement" file="license.txt" />
          </Licenses>
          <Default>true</Default>
          <Script>installscript.qs</Script>
          <UserInterfaces>
              <UserInterface>page.ui</UserInterface>
          </UserInterfaces>
          <Translations>
              <Translation>de.qm</Translation>
              <Translation>pl.qm</Translation>
              <Translation>ru.qm</Translation>
          </Translations>
      </Package>
      

      For debugging of this bug see translations.tar.xz project. This project based on qt translations example.

      Attachments

        1. translations.tar.xz
          9.05 MB
        2. qstrBug.png
          qstrBug.png
          47 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              installerteam Installer Team
              endrii Andrei Yankovich
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes