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

You cannot pass Qt.formatDateTime() string to qsTr() translation function as an argument

    XMLWordPrintable

Details

    • 935087ea155e3c7437a991204818ca9a81c3fa17

    Description

      Run code below, dynamic qsTr string doesn't accept formatted date time string as an argument.

      import QtQuick 1.0
      
      Rectangle {
          width: 300; height: 200
          Column {
              anchors.centerIn: parent
              Text {
                  text: {
                      var date = new Date();
                      return qsTr("This works, date %0").arg(Qt.formatDateTime(date, "hh::mm") + " ");
                  }
              }
              Text {
                  text: {
                      var date = new Date();
                      // returns empty string
                      return qsTr("This doesn't, date %0").arg(Qt.formatDateTime(date, "hh::mm"));
                  }
              }
          }
      }
      

      Attachments

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

        Activity

          People

            charles Charles Yin (closed Nokia identity) (Inactive)
            jpetrell Joona Petrell
            Votes:
            6 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes