Solved How to make values stored in QString variables translate to other languages.
-
hi can anyone say, how to make values stored in QString variables translate to otehr languages ,
i have tried with Qlabel and Qpushbutton using tr(), to translate to other languages.
while reading documentation i came across QT_TR_NOOP(), QT_TRANSLATE_NOOP(). when i made use of QT_TR_NOOP the variables was generated in ts file, i was able to view in Qt Linguist. but the values are not translating so shanyone tell me how to make QString -
@Pradeep-Kumar
Hi ,
May be QTranslator ,source translation and internationalization help you. -
-
Posting the code , which will be helpfull.
using QT_TR_NOOP the QString value will be shown in Qt Linguist for translating to respective language, but for actual value to be translated and to be reflected in widgets we need to use tr for QString value.Here is a sample code.
m_label = new QLabel;
QString appendData;
appendData = QT_TR_NOOP(tr("First Label"));
m_label->setText(appendData);We can also use QT_TR_NOOP and QT_TR_NOOP_UTF8.
-
Hi,
See here for an example of how to use these macros.
-
Thanks for the link and info.