LUpdate not adding entry to .ts file
-
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
-
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
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.
-
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.
@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%n
s 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 useprintf("%...", ...)
-type functions, and my old favourite C# had built-in support in the language for{n}
substitutions so could do the same. -
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.
@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-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-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 :(
@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, wherelupdate
is failing on the cast of then
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()
toint
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.