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. LUpdate not adding entry to .ts file
Forum Updated to NodeBB v4.3 + New Features

LUpdate not adding entry to .ts file

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
6 Posts 3 Posters 331 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 Perdrix
    #1

    This fails:

    strText = QCoreApplication::translate("LiveEngine", "Image %1 registered: %n star(s) detected - FWHM = %2 - Score = %3\n",
    	"IDS_LOG_REGISTERRESULTS", 
            static_cast<int>(lfi.m_vStars.size()))
    	.arg(QString::fromWCharArray(strName)
            .arg(lfi.m_fFWHM, 0, 'f', 2).arg(lfi.m_fOverallQuality, 0, 'f', 2));
    

    This works:

    strText = QCoreApplication::translate("LiveEngine", "Image %1 registered: %2 star(s) detected - FWHM = %3 - Score = %4\n",
    	"IDS_LOG_REGISTERRESULTS")
    	.arg(QString::fromWCharArray(strName)
    	.arg(lfi.m_vStars.size())
    	.arg(lfi.m_fFWHM, 0, 'f', 2).arg(lfi.m_fOverallQuality, 0, 'f', 2));
    

    Puzzled

    Paul ColbyP 1 Reply Last reply
    0
    • PerdrixP Perdrix

      This fails:

      strText = QCoreApplication::translate("LiveEngine", "Image %1 registered: %n star(s) detected - FWHM = %2 - Score = %3\n",
      	"IDS_LOG_REGISTERRESULTS", 
              static_cast<int>(lfi.m_vStars.size()))
      	.arg(QString::fromWCharArray(strName)
              .arg(lfi.m_fFWHM, 0, 'f', 2).arg(lfi.m_fOverallQuality, 0, 'f', 2));
      

      This works:

      strText = QCoreApplication::translate("LiveEngine", "Image %1 registered: %2 star(s) detected - FWHM = %3 - Score = %4\n",
      	"IDS_LOG_REGISTERRESULTS")
      	.arg(QString::fromWCharArray(strName)
      	.arg(lfi.m_vStars.size())
      	.arg(lfi.m_fFWHM, 0, 'f', 2).arg(lfi.m_fOverallQuality, 0, 'f', 2));
      

      Puzzled

      Paul ColbyP Offline
      Paul ColbyP Offline
      Paul Colby
      wrote on last edited by
      #2

      Hi @Perdrix

      .arg(QString::fromWCharArray(strName)
      .arg(lfi.m_fFWHM, 0, 'f', 2).arg(lfi.m_fOverallQuality, 0, 'f', 2));

      I think that very last ) should be on the previous line.

      You have:

      strText = QCoreApplication::translate(
          "LiveEngine",
          "Image %1 registered: %n star(s) detected - FWHM = %2 - Score = %3\n",
          "IDS_LOG_REGISTERRESULTS", 
          static_cast<int>(lfi.m_vStars.size())
      )
      .arg(
           QString::fromWCharArray(strName)
              .arg(lfi.m_fFWHM, 0, 'f', 2)
              .arg(lfi.m_fOverallQuality, 0, 'f', 2)
      );
      

      I suspect you meant:

      strText = QCoreApplication::translate(
          "LiveEngine",
          "Image %1 registered: %n star(s) detected - FWHM = %2 - Score = %3\n",
          "IDS_LOG_REGISTERRESULTS", 
          static_cast<int>(lfi.m_vStars.size())
      )
      .arg(QString::fromWCharArray(strName)) ///< Extra `)` here.
      .arg(lfi.m_fFWHM, 0, 'f', 2)
      .arg(lfi.m_fOverallQuality, 0, 'f', 2); ///< One less `)` here.
      

      Cheers.

      JonBJ PerdrixP 2 Replies Last reply
      2
      • Paul ColbyP Paul Colby

        Hi @Perdrix

        .arg(QString::fromWCharArray(strName)
        .arg(lfi.m_fFWHM, 0, 'f', 2).arg(lfi.m_fOverallQuality, 0, 'f', 2));

        I think that very last ) should be on the previous line.

        You have:

        strText = QCoreApplication::translate(
            "LiveEngine",
            "Image %1 registered: %n star(s) detected - FWHM = %2 - Score = %3\n",
            "IDS_LOG_REGISTERRESULTS", 
            static_cast<int>(lfi.m_vStars.size())
        )
        .arg(
             QString::fromWCharArray(strName)
                .arg(lfi.m_fFWHM, 0, 'f', 2)
                .arg(lfi.m_fOverallQuality, 0, 'f', 2)
        );
        

        I suspect you meant:

        strText = QCoreApplication::translate(
            "LiveEngine",
            "Image %1 registered: %n star(s) detected - FWHM = %2 - Score = %3\n",
            "IDS_LOG_REGISTERRESULTS", 
            static_cast<int>(lfi.m_vStars.size())
        )
        .arg(QString::fromWCharArray(strName)) ///< Extra `)` here.
        .arg(lfi.m_fFWHM, 0, 'f', 2)
        .arg(lfi.m_fOverallQuality, 0, 'f', 2); ///< One less `)` here.
        

        Cheers.

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @Paul-Colby
        That's the trouble with any offering like Qt's with %num substitutions not supported/checked by the language (C++) :(

        With Qt QString::arg() you get a run-time warning if you supplied too many arguments for the %ns and nothing at all if you supplied too few. gcc at least gives you compile-time warnings for both too many and too few if you use printf("%...", ...)-type functions, and my old favourite C# had built-in support in the language for {n} substitutions so could do the same.

        1 Reply Last reply
        0
        • Paul ColbyP Paul Colby

          Hi @Perdrix

          .arg(QString::fromWCharArray(strName)
          .arg(lfi.m_fFWHM, 0, 'f', 2).arg(lfi.m_fOverallQuality, 0, 'f', 2));

          I think that very last ) should be on the previous line.

          You have:

          strText = QCoreApplication::translate(
              "LiveEngine",
              "Image %1 registered: %n star(s) detected - FWHM = %2 - Score = %3\n",
              "IDS_LOG_REGISTERRESULTS", 
              static_cast<int>(lfi.m_vStars.size())
          )
          .arg(
               QString::fromWCharArray(strName)
                  .arg(lfi.m_fFWHM, 0, 'f', 2)
                  .arg(lfi.m_fOverallQuality, 0, 'f', 2)
          );
          

          I suspect you meant:

          strText = QCoreApplication::translate(
              "LiveEngine",
              "Image %1 registered: %n star(s) detected - FWHM = %2 - Score = %3\n",
              "IDS_LOG_REGISTERRESULTS", 
              static_cast<int>(lfi.m_vStars.size())
          )
          .arg(QString::fromWCharArray(strName)) ///< Extra `)` here.
          .arg(lfi.m_fFWHM, 0, 'f', 2)
          .arg(lfi.m_fOverallQuality, 0, 'f', 2); ///< One less `)` here.
          

          Cheers.

          PerdrixP Offline
          PerdrixP Offline
          Perdrix
          wrote on last edited by Perdrix
          #4

          @Paul-Colby Well darn it! How did I miss that!

          BUT after I changed it to

          			strText = QCoreApplication::translate(
          				"LiveEngine",
          				"Image %1 registered: %n star(s) detected - FWHM = %2 - Score = %3\n",
          				"IDS_LOG_REGISTERRESULTS",
          				static_cast<int>(lfi.m_vStars.size())
          			)
          				.arg(QString::fromWCharArray(strName))
          				.arg(lfi.m_fFWHM, 0, 'f', 2)
          				.arg(lfi.m_fOverallQuality, 0, 'f', 2); 
          

          and running lupdate the .ts file still has no entry for that translation :(

          PerdrixP Paul ColbyP 2 Replies Last reply
          0
          • PerdrixP Perdrix

            @Paul-Colby Well darn it! How did I miss that!

            BUT after I changed it to

            			strText = QCoreApplication::translate(
            				"LiveEngine",
            				"Image %1 registered: %n star(s) detected - FWHM = %2 - Score = %3\n",
            				"IDS_LOG_REGISTERRESULTS",
            				static_cast<int>(lfi.m_vStars.size())
            			)
            				.arg(QString::fromWCharArray(strName))
            				.arg(lfi.m_fFWHM, 0, 'f', 2)
            				.arg(lfi.m_fOverallQuality, 0, 'f', 2); 
            

            and running lupdate the .ts file still has no entry for that translation :(

            PerdrixP Offline
            PerdrixP Offline
            Perdrix
            wrote on last edited by
            #5

            Can anyone cast some light on this problem - its really quite an issue for me.

            1 Reply Last reply
            0
            • PerdrixP Perdrix

              @Paul-Colby Well darn it! How did I miss that!

              BUT after I changed it to

              			strText = QCoreApplication::translate(
              				"LiveEngine",
              				"Image %1 registered: %n star(s) detected - FWHM = %2 - Score = %3\n",
              				"IDS_LOG_REGISTERRESULTS",
              				static_cast<int>(lfi.m_vStars.size())
              			)
              				.arg(QString::fromWCharArray(strName))
              				.arg(lfi.m_fFWHM, 0, 'f', 2)
              				.arg(lfi.m_fOverallQuality, 0, 'f', 2); 
              

              and running lupdate the .ts file still has no entry for that translation :(

              Paul ColbyP Offline
              Paul ColbyP Offline
              Paul Colby
              wrote on last edited by
              #6

              @Perdrix said in LUpdate not adding entry to .ts file:

              and running lupdate the .ts file still has no entry for that translation :(

              Interesting. This looks like a pretty clear lupdate bug to me, where lupdate is failing on the cast of the n argument. For example, this doesn't work for me:

                  auto strText = QCoreApplication::translate(
                                "LiveEngine",
                                "Image %1 registered: %n star(s) detected - FWHM = %2 - Score = %3\n",
                                "IDS_LOG_REGISTERRESULTS",
                                static_cast<int>(123) ///< This breaks lupdate?
                                )
                                .arg(QString::fromWCharArray(nullptr))
                                .arg(0.01, 0, 'f', 2)
                                .arg(0.02, 0, 'f', 2);
              

              And this does't work either:

                  auto strText = QCoreApplication::translate(
                                "LiveEngine",
                                "Image %1 registered: %n star(s) detected - FWHM = %2 - Score = %3\n",
                                "IDS_LOG_REGISTERRESULTS",
                                (int)123 ///< This breaks lupdate also?
                                )
                                .arg(QString::fromWCharArray(nullptr))
                                .arg(0.01, 0, 'f', 2)
                                .arg(0.02, 0, 'f', 2);
              

              But this works fine (for lupdate ... I wouldn't execute the code itself ;)

                  auto strText = QCoreApplication::translate(
                                "LiveEngine",
                                "Image %1 registered: %n star(s) detected - FWHM = %2 - Score = %3\n",
                                "IDS_LOG_REGISTERRESULTS",
                                123
                                )
                                .arg(QString::fromWCharArray(nullptr))
                                .arg(0.01, 0, 'f', 2)
                                .arg(0.02, 0, 'f', 2);
              

              And this works also:

                  const int size = 123;
                  auto strText = QCoreApplication::translate(
                                "LiveEngine",
                                "Image %1 registered: %n star(s) detected - FWHM = %2 - Score = %3\n",
                                "IDS_LOG_REGISTERRESULTS",
                                size
                                )
                                .arg(QString::fromWCharArray(nullptr))
                                .arg(0.01, 0, 'f', 2)
                                .arg(0.02, 0, 'f', 2);
              

              So I would suggest you convert your lfi.m_vStars.size() to int as a separate statement, and then report this as a bug over at https://bugreports.qt.io/ (or I can report it, if you don't get around to it)

              Cheers.

              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