Hi,
i have in .h file this:
#define ITEM "textToTranslate"
how can i translate it?
and second, i have in file some text, which is loaded into QDraw. how can i transtale this text. text for translating is still same.
Hi,
i have in .h file this:
#define ITEM "textToTranslate"
how can i translate it?
and second, i have in file some text, which is loaded into QDraw. how can i transtale this text. text for translating is still same.
You could try:
#define ITEM QT_TR_NOOP("textToTranslate")
and then tr(ITEM) but in general using such defines in C++ is not a very good approach.
Much cleaner solution is:
Qt Code:
const char * const ITEM = QT_TR_NOOP("textToTranslate"); sth->setText(tr(ITEM));To copy to clipboard, switch view to plain text mode
What is QDraw?and second, i have in file some text, which is loaded into QDraw.
You'd need to manually teach your message catalog about the string to be translated. It's better to avoid such solutions. What do you need it for?how can i transtale this text. text for translating is still same.
A possible solution could be to reimplement QTranslator::translate().
Last edited by wysota; 16th December 2013 at 14:38.
stevocz (17th December 2013)
thank you for reply.
i am try
#define ITEM QT_TR_NOOP("textToTranslate")
and then tr(ITEM)
but doesnt work. textToTranslate missing in ts file.
What is QDraw?
sorry i mean in painter drawText
i have one application which create xml file and text. this text is for show in second application
Last edited by stevocz; 16th December 2013 at 14:01.
second possibility doesnt work too. after lupdate, textToTranslate missing in ts file.
maybe i'm missing something here, but isn't it SUPPOSED to not be able to translate "textToTranslate" ? Without spaces its not really a word.
textToTranslat is only example. i have text with spaces and text with only one word.
something is wrong, but i don't know what, because i can't transtale this:
ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Ok"));
ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel"));
application after start crash
but other things work ok.
stevocz (17th December 2013)
i am stupidi call Ok button but i have Save button.
but #define or const char * const ITEM still not work
Last edited by stevocz; 17th December 2013 at 08:39.
Bookmarks