Using Qt translated texts causes adding them to app ts
-
wrote on 9 Dec 2015, 23:00 last edited by
Hi all!
When I'm using translations from qtbase file this way:
QApplication::translate("QShortcut", "Help")
or
QShortcut::tr(""Help")
All those texts go into myApp.ts files after invoke lupdate.Is there any way to avoid that?
Or some method to remove such messages from ts file? -
wrote on 12 Dec 2015, 17:45 last edited by
I think, the best way to achieve above is to make changes in lupdate.
So I forked it, added small changes and there it is:
https://github.com/SeeLook/lupdateThen simply way to have *.ts file without some context of
tr()
ortranslate()
is to call:lupdate -skip-context QFileDialog,QMessageBox,QProgressDialog,QShortcut -recursive src -ts file.ts
Write me if You find this usable or any another way.
-
Hi all!
When I'm using translations from qtbase file this way:
QApplication::translate("QShortcut", "Help")
or
QShortcut::tr(""Help")
All those texts go into myApp.ts files after invoke lupdate.Is there any way to avoid that?
Or some method to remove such messages from ts file?wrote on 14 Dec 2015, 21:56 last edited byAnother solution that not require hacking Qt is to alias
QApplication::translate
method:inline QString myTr(const char* context, const char* key, const char* disambiguation = 0, int n = -1) { return QApplication::translate(context, key, disambiguation, n); }
and then get translated text with:
myTr("QShortcut", "Help");
Such texts are invisible for lupdate.
2/3