Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. issues with lupdate
Qt 6.11 is out! See what's new in the release blog

issues with lupdate

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
2 Posts 2 Posters 843 Views 1 Watching
  • 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.
  • D Offline
    D Offline
    django.Reinhard
    wrote on last edited by django.Reinhard
    #1

    Hi,

    I'm in the process of reorganizing my project. I want to make each shared-lib an independent project. This means that translations and resources should belong to the shared-lib and not to the main program anymore.

    While reorganizing the translatable texts I encountered some difficulties:

    • lupdate is not executed from the selected kit, but from system path (using QtCreator).
      How can I change this?

    • lupdate does not respect "-no-recursive" as shown by this output (which should be comprehensible without sourcecode). Current directory was "src", so "mainwindow.cpp" should be the only found translatable text:

    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE TS>
    <TS version="2.1">
    <context>
        <name>DirModel</name>
        <message>
            <location filename="../src/libCommon/DirModel.cpp" line="35"/>
            <source>Root</source>
            <translation type="unfinished"></translation>
        </message>
        <message>
            <location filename="../src/libCommon/DirModel.cpp" line="36"/>
            <source>BaseDir</source>
            <translation type="unfinished"></translation>
        </message>
    </context>
    <context>
        <name>FileModel</name>
        <message>
            <location filename="../src/libCommon/FileModel.cpp" line="75"/>
            <source>Name</source>
            <translation type="unfinished"></translation>
        </message>
        <message>
            <location filename="../src/libCommon/FileModel.cpp" line="76"/>
            <source>Size</source>
            <translation type="unfinished"></translation>
        </message>
        <message>
            <location filename="../src/libCommon/FileModel.cpp" line="77"/>
            <source>last modified</source>
            <translation type="unfinished"></translation>
        </message>
    </context>
    <context>
        <name>MainWindow</name>
        <message>
            <location filename="../src/mainwindow.cpp" line="64"/>
            <location filename="../src/mainwindow.cpp" line="64"/>
            <source>Main</source>
            <translation type="unfinished"></translation>
        </message>
    </context>
    <context>
        <name>PageStack</name>
        <message>
            <location filename="../src/libService/PageStack.cpp" line="36"/>
            <source>PageStack</source>
            <translation type="unfinished"></translation>
        </message>
    </context>
    </TS>
    

    Before you ask: I called lupdate by absolute path from used kit. Used commandline was:

    lupdate -no-recursive -no-obsolete * -ts ../i18n/main_de_DE.ts
    
    Z 1 Reply Last reply
    0
    • D django.Reinhard

      Hi,

      I'm in the process of reorganizing my project. I want to make each shared-lib an independent project. This means that translations and resources should belong to the shared-lib and not to the main program anymore.

      While reorganizing the translatable texts I encountered some difficulties:

      • lupdate is not executed from the selected kit, but from system path (using QtCreator).
        How can I change this?

      • lupdate does not respect "-no-recursive" as shown by this output (which should be comprehensible without sourcecode). Current directory was "src", so "mainwindow.cpp" should be the only found translatable text:

      <?xml version="1.0" encoding="utf-8"?>
      <!DOCTYPE TS>
      <TS version="2.1">
      <context>
          <name>DirModel</name>
          <message>
              <location filename="../src/libCommon/DirModel.cpp" line="35"/>
              <source>Root</source>
              <translation type="unfinished"></translation>
          </message>
          <message>
              <location filename="../src/libCommon/DirModel.cpp" line="36"/>
              <source>BaseDir</source>
              <translation type="unfinished"></translation>
          </message>
      </context>
      <context>
          <name>FileModel</name>
          <message>
              <location filename="../src/libCommon/FileModel.cpp" line="75"/>
              <source>Name</source>
              <translation type="unfinished"></translation>
          </message>
          <message>
              <location filename="../src/libCommon/FileModel.cpp" line="76"/>
              <source>Size</source>
              <translation type="unfinished"></translation>
          </message>
          <message>
              <location filename="../src/libCommon/FileModel.cpp" line="77"/>
              <source>last modified</source>
              <translation type="unfinished"></translation>
          </message>
      </context>
      <context>
          <name>MainWindow</name>
          <message>
              <location filename="../src/mainwindow.cpp" line="64"/>
              <location filename="../src/mainwindow.cpp" line="64"/>
              <source>Main</source>
              <translation type="unfinished"></translation>
          </message>
      </context>
      <context>
          <name>PageStack</name>
          <message>
              <location filename="../src/libService/PageStack.cpp" line="36"/>
              <source>PageStack</source>
              <translation type="unfinished"></translation>
          </message>
      </context>
      </TS>
      

      Before you ask: I called lupdate by absolute path from used kit. Used commandline was:

      lupdate -no-recursive -no-obsolete * -ts ../i18n/main_de_DE.ts
      
      Z Offline
      Z Offline
      ziller
      wrote on last edited by ziller
      #2

      If you used Tools > External > lupdate from the Qt Creator menu, it looks like it needs an open document, and then uses the lupdate from the kit of this document's project. There doesn't seem to be a fallback that uses the "active" project. https://code.qt.io/cgit/qt-creator/qt-creator.git/tree/src/share/qtcreator/externaltools/lupdate.xml

      Since you called "lupdate *" in the directory "src", you actually called
      "lupdate mainwindow.cpp mainwindow.h libService libCommon", because the "*" is expanded to all items (directories + files) in the "src" directory by the SHELL. So, lupdate correctly only worked on the files and directories you gave them, without recursing itself. "lupdate ." (just a dot) does what you want.

      1 Reply Last reply
      1

      • Login

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