How to make values stored in QString variables translate to other languages.
-
wrote on 5 Dec 2015, 05:11 last edited by
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 -
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 QStringwrote on 5 Dec 2015, 05:21 last edited by Ratzz 12 May 2015, 05:26@Pradeep-Kumar
Hi ,
May be QTranslator ,source translation and internationalization help you. -
wrote on 19 Aug 2016, 11:49 last edited by
-
wrote on 29 Sept 2016, 08:34 last edited by Pradeep Kumar
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.
-
wrote on 29 Sept 2016, 09:10 last edited by
Thanks for the link and info.