Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. String not added to .ts files by lupdate?
Forum Updated to NodeBB v4.3 + New Features

String not added to .ts files by lupdate?

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 688 Views 2 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by
    #1
    const QString strInfo(QCoreApplication::translate("StackingTasks", "Master Offset created from %n picture(s) (%1)", "IDS_MEDIANOFFSETINFO", static_cast<int>(m_pOffsetTask->m_vBitmaps.size())).arg(strMethod));
    

    I can't see why not. Can someone put me out of my misery?

    David

    J.HilkJ 1 Reply Last reply
    0
    • PerdrixP Perdrix
      const QString strInfo(QCoreApplication::translate("StackingTasks", "Master Offset created from %n picture(s) (%1)", "IDS_MEDIANOFFSETINFO", static_cast<int>(m_pOffsetTask->m_vBitmaps.size())).arg(strMethod));
      

      I can't see why not. Can someone put me out of my misery?

      David

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @Perdrix

      QCoreApplication::translate

      seems like your string is outside of a QObject based class.

      See here for more information:
      https://doc.qt.io/qt-6/i18n-source-translation.html#translating-non-qt-classes


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      0
      • PerdrixP Offline
        PerdrixP Offline
        Perdrix
        wrote on last edited by Perdrix
        #3

        The link to which you refer specifically says:

        "Alternatively, the QCoreApplication::translate() function can be called with a specific context, and this will be recognized by lupdate and Qt Linguist."

        All the other translatable strings are working OK (though this one is the only one in the file that uses %n).

        D.

        J.HilkJ 1 Reply Last reply
        0
        • PerdrixP Perdrix

          The link to which you refer specifically says:

          "Alternatively, the QCoreApplication::translate() function can be called with a specific context, and this will be recognized by lupdate and Qt Linguist."

          All the other translatable strings are working OK (though this one is the only one in the file that uses %n).

          D.

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @Perdrix interesting, you're of course right!

          🤔 have you tried a different constructor for your strInfo string, ? maybe the lupdate - tool has trouble interpreting that setup


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          1 Reply Last reply
          0
          • PerdrixP Offline
            PerdrixP Offline
            Perdrix
            wrote on last edited by
            #5

            Out of curiousity I changed the header file for the class to read:

            class CStackingInfo
            {
            	Q_DECLARE_TR_FUNCTIONS(StackingTasks)
            

            and changed

            const QString strInfo{ QCoreApplication::translate("StackingTasks",
                            "Master Offset created from %n picture(s) (%1)",
            		"IDS_MEDIANOFFSETINFO",
            		static_cast<int>(m_pOffsetTask->m_vBitmaps.size()))
            		.arg(strMethod) };
            

            to read:

            const QString strInfo{ tr("Master Offset created from %n picture(s) (%1)",
            		"IDS_MEDIANOFFSETINFO",
            		static_cast<int>(m_pOffsetTask->m_vBitmaps.size()))
            		.arg(strMethod) };
            

            and that added the text to the .ts files just fine!!!

            Something clearly not quite right with lupdate's parsing code.

            David

            1 Reply Last reply
            1
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              Can you try your original setup with:

              const QString strInfo = QCoreApplication::translate("StackingTasks",
                              "Master Offset created from %n picture(s) (%1)",
              		"IDS_MEDIANOFFSETINFO",
              		static_cast<int>(m_pOffsetTask->m_vBitmaps.size()))
              		.arg(strMethod);
              

              ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • PerdrixP Offline
                PerdrixP Offline
                Perdrix
                wrote on last edited by Perdrix
                #7

                I think I tried that along the way - see my previous post where I show it broken across lines. But can't swear to using a version with = instead of initialiaser format.

                D.

                1 Reply Last reply
                0

                • Login

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