Ensure lupdate collects all the strings in tr() when using #ifdef for multiple OS
-
Hello
I have an application which is deployed across Android, Windows and IOS.
I have used #ifdef to separate the sourcecodes which are unique based on the OS.
Now, when I run lupdate, on Windows, it does not recognise the strings marked with tr() in the sourcecode for Android or IOS.
Is there a way to tell lupdate to consider all the strings irrespective of the #ifdef directive?Thanks for your consideration.
KK
-
Hi,
What version of Qt are you using ?
What #ifdef are you using ? -
@SGaist
I am using Qt 5.10
I will explain the problem with some source code.#ifdef Q_OS_IOS QMessageBox msg; msg.setText(tr("This is the IOS Operating System.")); msg.setStandardButtons(QMessageBox::Yes|QMessageBox::No); msg.setDefaultButton(QMessageBox::No); msg.setParent(this); msg.setWindowFlags(Qt::WindowStaysOnTopHint | Qt::Dialog); msg.setIcon(QMessageBox::Critical); int ret = msg.exec(); if(ret==QMessageBox::No) return; #else QMessageBox msg; msg.setText(tr("This is not IOS Operating System.")); msg.setStandardButtons(QMessageBox::Yes|QMessageBox::No); msg.setDefaultButton(QMessageBox::No); msg.setParent(this); msg.setWindowFlags(Qt::WindowStaysOnTopHint | Qt::Dialog); msg.setIcon(QMessageBox::Critical); int ret = msg.exec(); if(ret==QMessageBox::No) return; #endif
Now, when I am executing lupdate command from Windows, the message text "This is the IOS Operating System." does not get included in the messages for translations.
How to ensure that even this message text will get included for translations.
Thanks. -
Hi @TheCrowKaka
Can you share the cmd for
lupdate
?
Because the above code seems to be working fine on WindowsAlso can you try with Qt Creator directly ?
Use kit ofWindows ( I tried with MinGW 64-bit )
andTools -> External -> Linguist -> Update Translations (lupdate)
i just tried,
lupdate -verbose QtForum_Qt_103758.pro -ts test1.ts