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

Generated TS Files contain multiple filename attributes for same translation string

    XMLWordPrintable

Details

    Description

      TS files normally have the location filename attribute set to the relative path of the project source file.
      For example,

      <?xml version="1.0" encoding="utf-8"?>
      <!DOCTYPE TS>
      <TS version="2.1" language="fr" sourcelanguge="en">
      <context>
          <name>Main</name>
          <message>
              <location filename="../Main.qml" line="7"/>
              <source>Hello World</source>
              <translation type="unfinished"></translation>
          </message>
      </context>
      </TS>
      

       
      The qt_add_translations() command is generating TS files contain a location filename attribute set to the relative path of the project source file and an another entry set to the relative path of the source file in the build directory. For example,

      <?xml version="1.0" encoding="utf-8"?>
      <!DOCTYPE TS>
      <TS version="2.1">
      <context>
          <name>Main</name>
          <message>
              <location filename="../Main.qml" line="7"/>
              <location filename="../build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug/qml_translations/Main.qml" line="7"/>
              <source>Hello World</source>
              <translation type="unfinished"></translation>
          </message>
      </context>
      </TS>
      

      Behavior also observed when generating a plurals-only .ts file via the qt_add_translations(PLURAL_TS_FILE file.ts) commands. 

      To reproduce issue, build attached project with update_translations.

      Attachments

        1. qml_en.ts
          0.6 kB
        2. qml_fr.ts
          0.9 kB
        3. qtbug127791.zip
          2 kB

        Issue Links

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

          Activity

            People

              jbornema Joerg Bornemann
              lysandra.sola Lysandra Sola
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes