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

Using QT_TR_NOOP with disambiguation string in a ListElement causes runtime error

    XMLWordPrintable

Details

    • 6474c654e (dev), 4ba99033b (6.9), 7d56cf0e9 (6.8), 5b5136ca4 (tqtc/lts-6.5)

    Description

      Using QT_TR_NOOP with a disambiguation string to mark a ListElement string causes a "ListElement: cannot use script for property value" run-time error.

       ListModel {
              ListElement {
                  name: QT_TR_NOOP("Apple", "Apple comment") // causes "ListElement: cannot use script for property value" run-time error
      	}
      }
      

      lupdate correctly generates the TS file containing the disambiguation string in the <comment> element tag as expected, and the error does not occur if the disambiguation string is omitted.

      The same behavior is observed when using QT_TRANSLATE_NOOP with a disambiguation string.

       ListModel {
              ListElement {
                  name: QT_TRANSLATE_NOOP("Context", "Apple", "Apple Comment") // causes "ListElement: cannot use script for property value" run-time error
      }
      }
      

       Attached example project reproduces the issue.

      Note: The https://doc.qt.io/qt-6/i18n-source-translation.html#qml-use-noop-functions documentation does not include an example of using QT_TR_NOOP with a disambiguation string. If the disambiguation string is to be supported when marking a ListElement string with QT_TR_NOOP, then the documentation may also need to be updated.  

      Attachments

        1. qtbug132684.zip
          7 kB
          Lysandra Sola
        For Gerrit Dashboard: QTBUG-132684
        # Subject Branch Project Status CR V

        Activity

          People

            fabiankosmale Fabian Kosmale
            lysandra.sola Lysandra Sola
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes