Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Exporting an empty ts file
QtWS25 Last Chance

Exporting an empty ts file

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 1.0k 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.
  • M Offline
    M Offline
    MasterBlade
    wrote on last edited by
    #1

    Hello I want to translate my program and use
    lupdate.exe -verbose -pro xx.pro -ts xx.ts
    to export a ts file.

    But the ts file is empty. I can see only 1 line in the file that looks like this.
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE TS>
    <TS version="2.1">
    </TS>

    I am pretty sure I used tr() in my source files. At least 100+
    What's wrong with it?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by aha_1980
      #2

      Do you use TRANSLATIONS variable in your .pro file?

      [Edit ~aha_1980]: Fixed link

      (Z(:^

      M 1 Reply Last reply
      0
      • sierdzioS sierdzio

        Do you use TRANSLATIONS variable in your .pro file?

        [Edit ~aha_1980]: Fixed link

        M Offline
        M Offline
        MasterBlade
        wrote on last edited by MasterBlade
        #3

        @sierdzio said in Exporting an empty ts file:

        lhttps://doc.qt.io/qt-5/qmake-variable-reference.html#translations

        Yes, I followed another guide and added TRANSLATIONS += xx.ts to the pro file. Still got the same ts file.

        EDIT: I deleted the original ts file and ran lupdate -verbose xx.pro
        again, no ts file came out this time.

        J.HilkJ 1 Reply Last reply
        0
        • M MasterBlade

          @sierdzio said in Exporting an empty ts file:

          lhttps://doc.qt.io/qt-5/qmake-variable-reference.html#translations

          Yes, I followed another guide and added TRANSLATIONS += xx.ts to the pro file. Still got the same ts file.

          EDIT: I deleted the original ts file and ran lupdate -verbose xx.pro
          again, no ts file came out this time.

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @MasterBlade
          for lupdate to work, all files that contain the tr()- macro need to be derived from QObject, or contain the Q_DECLARE_TR_FUNCTIONS(context)- macro.

          Also iirc, not all lupdate-programs work equally good. What compiler have you set for your program when you want to run it, from out of QtCreator.


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          M 1 Reply Last reply
          0
          • J.HilkJ J.Hilk

            @MasterBlade
            for lupdate to work, all files that contain the tr()- macro need to be derived from QObject, or contain the Q_DECLARE_TR_FUNCTIONS(context)- macro.

            Also iirc, not all lupdate-programs work equally good. What compiler have you set for your program when you want to run it, from out of QtCreator.

            M Offline
            M Offline
            MasterBlade
            wrote on last edited by MasterBlade
            #5

            @J.Hilk said in Exporting an empty ts file:

            for lupdate to work, all files that contain the tr()- macro need to be derived from QObject, or contain the Q_DECLARE_TR_FUNCTIONS(context)- macro.

            Also iirc, not all lupdate-programs work equally good. What compiler have you set for your program when you want to run it, from out of QtCreator.

            Sorry I didn't understand. Do you mean the classes I am using must derive from QObject?

            Most of tr() are called from QLabels and QPushbuttons, I believe they come from QObject.

            I am using MSVC 2017 as compiler. lupdate comes from C:\Qt\5.11.1\msvc2017_64\bin\lupdate.exe. That should match.

            EDIT: This time I tried Qt Command Prompt and ran lupdate. There was an error message saying

            WARNING: Project ERROR: Cannot run compiler 'cl'. Output:
            ===================
            ===================
            Maybe you forgot to setup the environment?
            

            I'm sure I added TRANSLATIONS += xx.ts to the pro file (though xx.ts does not exist)

            J.HilkJ 1 Reply Last reply
            0
            • M MasterBlade

              @J.Hilk said in Exporting an empty ts file:

              for lupdate to work, all files that contain the tr()- macro need to be derived from QObject, or contain the Q_DECLARE_TR_FUNCTIONS(context)- macro.

              Also iirc, not all lupdate-programs work equally good. What compiler have you set for your program when you want to run it, from out of QtCreator.

              Sorry I didn't understand. Do you mean the classes I am using must derive from QObject?

              Most of tr() are called from QLabels and QPushbuttons, I believe they come from QObject.

              I am using MSVC 2017 as compiler. lupdate comes from C:\Qt\5.11.1\msvc2017_64\bin\lupdate.exe. That should match.

              EDIT: This time I tried Qt Command Prompt and ran lupdate. There was an error message saying

              WARNING: Project ERROR: Cannot run compiler 'cl'. Output:
              ===================
              ===================
              Maybe you forgot to setup the environment?
              

              I'm sure I added TRANSLATIONS += xx.ts to the pro file (though xx.ts does not exist)

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by
              #6

              @MasterBlade said in Exporting an empty ts file:

              ============

              Maybe you forgot to setup the environment?

              No, thats exactly what I meant i have the same issue with msvc2015. lupdate simply doesn't work. I explicetly switch to mingw, to run lupdate


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              M 1 Reply Last reply
              0
              • J.HilkJ J.Hilk

                @MasterBlade said in Exporting an empty ts file:

                ============

                Maybe you forgot to setup the environment?

                No, thats exactly what I meant i have the same issue with msvc2015. lupdate simply doesn't work. I explicetly switch to mingw, to run lupdate

                M Offline
                M Offline
                MasterBlade
                wrote on last edited by
                #7

                @J.Hilk said in Exporting an empty ts file:

                @MasterBlade said in Exporting an empty ts file:

                ============

                Maybe you forgot to setup the environment?

                No, thats exactly what I meant i have the same issue with msvc2015. lupdate simply doesn't work. I explicetly switch to mingw, to run lupdate

                I searched the web and found a solution. Add path for cl.exe (C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\Hostx64\x64) to system PATH.

                Everything went alright after that.

                1 Reply Last reply
                2

                • Login

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