Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Sample program hellotr.pro cannot build and run. Why? (Solved)
Forum Updated to NodeBB v4.3 + New Features

Sample program hellotr.pro cannot build and run. Why? (Solved)

Scheduled Pinned Locked Moved Mobile and Embedded
11 Posts 2 Posters 2.7k Views 1 Watching
  • 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.
  • H Offline
    H Offline
    houmingc
    wrote on last edited by
    #2

    under linguist examples, i cannot set the hello world to thai language

    1 Reply Last reply
    0
    • H Offline
      H Offline
      houmingc
      wrote on last edited by
      #3

      i am following the link below
      http://qt.developpez.com/doc/4.7/linguist-hellotr/

      Do i have to do the translation myself, i thought it is done automatically?

      1.in linguist/hellotr, initially there is only two file
      hellotr.pro & main.cpp

      2.after running "lupdate -verbose hellotr.pro"
      hellotr_la.ts file is created.

      3.after running "linguist hellotr_la.ts"
      hellotr_la.qm file is created.

      =xml format =================================
      <?xml version="1.0" encoding="utf-8"?>
      <!DOCTYPE TS>
      <TS version="2.0" language="th_TH" sourcelanguage="en_SG">
      <context>
      <name>QPushButton</name>
      <message>
      <location filename="main.cpp" line="63"/>
      <source>Hello world!</source>
      <translatorcomment>Orbis, te saluto !</translatorcomment>
      <translation>Orbis, te Saluto!</translation>
      </message>
      </context>
      </TS>

      1 Reply Last reply
      0
      • H Offline
        H Offline
        houmingc
        wrote on last edited by
        #4

        i build and run successfully, but it is always same language "hello world"

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #5

          Hi,

          @translator.load(“hellotr_la”); << Used like that it searches for the file in the application path@

          Do you have the translation file in the same folder as your application ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • H Offline
            H Offline
            houmingc
            wrote on last edited by
            #6

            I don't have the translation file. Where to get it? do you have the link?

            i am following the link below
            http://qt.developpez.com/doc/4.7/linguist-hellotr/

            did i miss anything?

            1 Reply Last reply
            0
            • H Offline
              H Offline
              houmingc
              wrote on last edited by
              #7

              there are 13 label that i would like to toggle between thai language and english. I will be using QxmlStreamReader to read both language.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                There's no need to add QxmlStreamReader for this.

                You have generated the hellotr_la.qm file. Probably in your source folder. So you have two solutions here:

                Copy that file in the build directory, in the same folder as your application

                Give the full path to that file to QTranslator

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  houmingc
                  wrote on last edited by
                  #9

                  Can guide on how to toggle between thai and english language using a timer on Mainwindow? Many thanks

                  1 Reply Last reply
                  0
                  • H Offline
                    H Offline
                    houmingc
                    wrote on last edited by
                    #10

                    I managed to toggle between two language. Now my concern is how to plug English and thai from a txt file.
                    In these txt file, there is a translation list. (English & Thai)

                    QString line;

                    do {
                    line =stream.readLine();
                    qDebug()<<line;
                    }while(!line.isNull());

                    1 Reply Last reply
                    0
                    • H Offline
                      H Offline
                      houmingc
                      wrote on last edited by
                      #11

                      https://www.youtube.com/watch?v=V9Gep6-r8ns

                      Attach is the youtube on how translation can be done in Qt

                      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