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. The ts files of qtlinguist are not created in cmake
Forum Updated to NodeBB v4.3 + New Features

The ts files of qtlinguist are not created in cmake

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 1.6k 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.
  • Z Offline
    Z Offline
    zandarina
    wrote on last edited by zandarina
    #1

    Hello, I want to create the ts files to translate using qtlinguist and i use a cmake file to set up my project and i would like to add the code in the cmake to obtain the ts files. I do not get any error but the ts are
    not created. I cannot even see the comments to see if if iterates through the loop.

    The code i use in the cmake is as follows:

        set(TS_FILES
             translateApptr_lang_sp.ts 
          translateApptr_lang_en.ts
         )
    
    foreach(_ts_file ${TS_FILES})
      add_custom_command(
    		   OUTPUT ${_ts_file}
    		   COMMAND ${Qt5_LUPDATE_EXECUTABLE} -recursive 
                          ${CMAKE_CURRENT_SOURCE_DIR} -ts ${_ts_file}
    		   COMMENT "Updating ${_ts_file}"
    		MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}
    		DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}
    		VERBATIM
    	)
    
         endforeach()
    
          qt5_create_translation(qmFiles ${TS_FILES})
          ......
    

    I have tried all the possible variations removing the depends and the main dependency but there is
    no way to get those files.

    Thank you very much for your help. There are no errors. but the ts files are not created.

    Cheers

    1 Reply Last reply
    0
    • Z zandarina

      Hello, I already saw this example but they do the lupdate serparately of the cmake. They already
      have the ts files. What I would like is to create them in the same cmake of my project so that i do not have
      to run a qmake and a cmake.

      Thanks

      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #4

      @zandarina said in The ts files of qtlinguist are not created in cmake:

      What I would like is to create them in the same cmake of my project

      That's what qt5_create_translation does.

      In your case qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} translateApptr_lang_sp.ts translateApptr_lang_en.ts)

      Now you just have to add ${QM_FILES} to the sources of your project (e.g. target_sources(MyApp PRIVATE ${QM_FILES}))

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      2
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by
        #2

        Have a look at this example: https://gist.github.com/giraldeau/546ba5512a74dfe9d8ea0862d66db412

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply
        1
        • Z Offline
          Z Offline
          zandarina
          wrote on last edited by
          #3

          Hello, I already saw this example but they do the lupdate serparately of the cmake. They already
          have the ts files. What I would like is to create them in the same cmake of my project so that i do not have
          to run a qmake and a cmake.

          Thanks

          VRoninV 1 Reply Last reply
          0
          • Z zandarina

            Hello, I already saw this example but they do the lupdate serparately of the cmake. They already
            have the ts files. What I would like is to create them in the same cmake of my project so that i do not have
            to run a qmake and a cmake.

            Thanks

            VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by
            #4

            @zandarina said in The ts files of qtlinguist are not created in cmake:

            What I would like is to create them in the same cmake of my project

            That's what qt5_create_translation does.

            In your case qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} translateApptr_lang_sp.ts translateApptr_lang_en.ts)

            Now you just have to add ${QM_FILES} to the sources of your project (e.g. target_sources(MyApp PRIVATE ${QM_FILES}))

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            1 Reply Last reply
            2
            • Z Offline
              Z Offline
              zandarina
              wrote on last edited by
              #5

              Thank you it works !!

              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