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. qt5_create_translation does not update .ts
Forum Updated to NodeBB v4.3 + New Features

qt5_create_translation does not update .ts

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 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.
  • S Offline
    S Offline
    Sauntor
    wrote on last edited by
    #1

    When using cmake to build qt5 project on openSUSE tumbleweed(qt 5.15.11), the cmake command qt5_create_translation and qt5_add_translation does nothing, they do not update .ts and do not genrate .qm .
    What's wrong?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      How do you use them? Please show your CMakeLists.txt.
      And do you really use Qt5?

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      S 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        How do you use them? Please show your CMakeLists.txt.
        And do you really use Qt5?

        S Offline
        S Offline
        Sauntor
        wrote on last edited by Sauntor
        #3

        @Christian-Ehrlicher
        CMakeLists.txt https://paste.opensuse.org/pastes/3b20e7f51bbd
        main.cpp https://paste.opensuse.org/pastes/f3f943334115
        The demo project has this two files only. I open this project with qtcreator and configure it with Qt5 Kits

        And if you add message("lupdate = ${Qt5_LUPDATE_EXECUTABLE}") to CMakeLists.txt, it will show something like Qt5:lupdate, that's may be the real cause

        Christian EhrlicherC 1 Reply Last reply
        0
        • S Sauntor

          @Christian-Ehrlicher
          CMakeLists.txt https://paste.opensuse.org/pastes/3b20e7f51bbd
          main.cpp https://paste.opensuse.org/pastes/f3f943334115
          The demo project has this two files only. I open this project with qtcreator and configure it with Qt5 Kits

          And if you add message("lupdate = ${Qt5_LUPDATE_EXECUTABLE}") to CMakeLists.txt, it will show something like Qt5:lupdate, that's may be the real cause

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Sauntor said in qt5_create_translation does not update .ts:

          , it will show something like Qt5:lupdate, that's may be the real cause

          No, that's correct.

          qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})

          You don't do anything with the qm files so nothing will happen. You have to add them to a target.

          But I would not use deprecated functions but qt_add_translations()

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          S 1 Reply Last reply
          1
          • Christian EhrlicherC Christian Ehrlicher

            @Sauntor said in qt5_create_translation does not update .ts:

            , it will show something like Qt5:lupdate, that's may be the real cause

            No, that's correct.

            qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})

            You don't do anything with the qm files so nothing will happen. You have to add them to a target.

            But I would not use deprecated functions but qt_add_translations()

            S Offline
            S Offline
            Sauntor
            wrote on last edited by Sauntor
            #5

            @Christian-Ehrlicher Qt5's cmake modules does not provide the qt_add_translations() command, it's added in Qt6.

            qt5_create_translation() does not generate a cmake target, so, how to add it to my executable target?

            PS:
            If you run lupdate CMakeLists.txt, it will output something like lupdate warning: no TS files specified. Only diagnostics will be produced. . Is it the problem? Or we can say that qt5_create_translation() depends on the qmake project file(.pro)?

            Christian EhrlicherC 1 Reply Last reply
            0
            • S Sauntor

              @Christian-Ehrlicher Qt5's cmake modules does not provide the qt_add_translations() command, it's added in Qt6.

              qt5_create_translation() does not generate a cmake target, so, how to add it to my executable target?

              PS:
              If you run lupdate CMakeLists.txt, it will output something like lupdate warning: no TS files specified. Only diagnostics will be produced. . Is it the problem? Or we can say that qt5_create_translation() depends on the qmake project file(.pro)?

              Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by Christian Ehrlicher
              #6

              @Sauntor said in qt5_create_translation does not update .ts:

              how to add it to my executable target?

              The same way you added the ts files in your add_executable call.

              Don't know why you don't use the new macros since you use Qt6 in your provided example though.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              S 2 Replies Last reply
              0
              • Christian EhrlicherC Christian Ehrlicher

                @Sauntor said in qt5_create_translation does not update .ts:

                how to add it to my executable target?

                The same way you added the ts files in your add_executable call.

                Don't know why you don't use the new macros since you use Qt6 in your provided example though.

                S Offline
                S Offline
                Sauntor
                wrote on last edited by
                #7

                @Christian-Ehrlicher it already in:

                add_executable(tsdemo
                  main.cpp
                  ${TS_FILES}
                  images.qrc
                )
                
                1 Reply Last reply
                0
                • Christian EhrlicherC Christian Ehrlicher

                  @Sauntor said in qt5_create_translation does not update .ts:

                  how to add it to my executable target?

                  The same way you added the ts files in your add_executable call.

                  Don't know why you don't use the new macros since you use Qt6 in your provided example though.

                  S Offline
                  S Offline
                  Sauntor
                  wrote on last edited by
                  #8

                  @Christian-Ehrlicher said in qt5_create_translation does not update .ts:

                  Don't know why you don't use the new macros

                  I'm try compile my project with qt5 only, so the new macros are not avaliable.

                  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