Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Solved Exporting an empty ts file

    General and Desktop
    3
    7
    566
    Loading More Posts
    • 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
      MasterBlade last edited by

      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 Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by aha_1980

        Do you use TRANSLATIONS variable in your .pro file?

        [Edit ~aha_1980]: Fixed link

        (Z(:^

        M 1 Reply Last reply Reply Quote 0
        • M
          MasterBlade @sierdzio last edited by 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.Hilk 1 Reply Last reply Reply Quote 0
          • J.Hilk
            J.Hilk Moderators @MasterBlade last edited by

            @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

            Qt Needs YOUR vote: https://bugreports.qt.io/browse/QTQAINFRA-4121


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

            M 1 Reply Last reply Reply Quote 0
            • M
              MasterBlade @J.Hilk last edited by 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.Hilk 1 Reply Last reply Reply Quote 0
              • J.Hilk
                J.Hilk Moderators @MasterBlade last edited by

                @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

                Qt Needs YOUR vote: https://bugreports.qt.io/browse/QTQAINFRA-4121


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

                M 1 Reply Last reply Reply Quote 0
                • M
                  MasterBlade @J.Hilk last edited by

                  @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 Reply Quote 2
                  • First post
                    Last post