Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-126040

QT_EXCLUDE_SOURCES_FROM_TRANSLATION not working as expected

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 6.7.1
    • Tools: Linguist
    • None
    • Linux/X11, Windows

    Description

      I have a cmake project which uses several 3rd-party libraries (e.g. the Boost-library) to build. Furthermore it uses translations via the qt_add_translation command. But since QT 6.7.1 the extraction of the strings with the lupdate-tool takes an awful lot of time. What was usually a matter of seconds, now takes several hours !
      I found and used the new property QT_EXCLUDE_SOURCES_FROM_TRANSLATION, which was introduced in Qt 6.7 but to no avail.

      I used the following command sequence in cmake:
      (with ${Boost_INCLUDE_DIR} = "/usr/include")

      set_property(TARGET rde PROPERTY QT_EXCLUDE_SOURCES_FROM_TRANSLATION ${Boost_INCLUDE_DIR})
      qt_add_translations(rde
          TS_FILES assets/i18n/en.ts assets/i18n/de.ts assets/i18n/fr.ts
          SOURCE_TARGETS rde
          LUPDATE_OPTIONS -locations none
      )

      These cmake commands result in the following lupdate_project.json file:
      (The file is stripped by several paths and filenames for reasons of clarity!)

      {
        "projectFile": "<MyPath>/CMakeLists.txt",
        "includePaths": [  ],
        "sources": [  ],
        "translations": [ "<MyPath>/assets/i18n/en.ts", "<MyPath>/assets/i18n/de.ts", "<MyPath>/assets/i18n/fr.ts" ],
        "subProjects": [
          {
            "projectFile": "<MyPath>/CMakeLists.txt",
            "includePaths": [ "<MyPath>/build/Desktop_Qt_6_7_1-Debug/rde_autogen/include", "<MyPath>/RDS/Rds/", ... <snip> ... "/usr/include", ... <snip> ... "/usr/include", ... <snip> ],
            "sources": [ "<MyPath>/build/Desktop_Qt_6_7_1-Debug/rde_autogen/mocs_compilation.cpp", "<MyPath>/src/main.cpp", "<MyPath>/src/mainwindow.h", "<MyPath>/src/mainwindow.cpp", ... <snip> ...  ],
            "excluded": [ "/usr/include" ]
                }
        ]
      }

      As you can see, the "/usr/include" path (= ${Boost_INCLUDE_DIR}) lands in the "excluded"-line correctly, but also (several times !) in the "includePaths"-line, where it forces lupdate to take a loooong time to finish (here > 6 hours !).

      After removing all occurences of "/usr/include" manually from the "includePaths"-line of the  lupdate_project.json file before re-running lupdate (from the command -line), lupdate returns successfully almost instantly !

      • Why the property QT_EXCLUDE_SOURCES_FROM_TRANSLATION doesn't work to remove all occurences of "/usr/include" from the includePaths-line of the lupdate_project.json file ?
      • Why does lupdate take sooo much time to process the (here: Boost-) library ?

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kkohne Kai Köhne
              thomask Thomas Köhler
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes