String not added to .ts files by lupdate?
-
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
-
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
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 -
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.
-
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.
-
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
-
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);
?