Qt Designer and id based translation
Hi,
I use id based translation in my application. That means, that I use qtTrId() instead of tr() function. It works well, as I have most translatable strings in source code.
Problem is with forms generated by Qt Designer. Is it somehow possible to make lupdate generate contextless translates event for ui forms?
Thanks for help :)
Re: Qt Designer and id based translation
It is possible to tell uic to use qtTrId as the translation function to which it then passes the text as the Id, but it seems to discard the comment (which in this case would be the source string) :(
Cheers,
_
Re: Qt Designer and id based translation
Thanks, I dont need source, so discarded comments are fine. Second thing is that lupdate still takes strings from ui file and not from generated header.
What I want to achieve is .ts file for all translatable strings like this:
Code:
<context>
<message id="tr_number__hint">
<source></source>
<translation type="unfinished"></translation>
</message>
<message id="tr_gsm__hint">
<source></source>
<translation>Translation</translation>
</message>
</context>
indtead of:
Code:
<context>
<name>core::InitialDialog</name>
<message>
<source>tr_number__hint</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>tr_gsm__hint</source>
<translation type="unfinished"></translation>
</message>
</context>
Re: Qt Designer and id based translation
Hmm.
How about this:
- you move everything that you have in your .pro file other than FORMS to a .pri file
- you include that .pri file in your .pro
- you create a second .pro that includes the .pri and instead of FORMS adds the generated ui_*.h to SOURCES and uses that for lupdate's run
Cheers,
_
Re: Qt Designer and id based translation
Thank you, it works, but I still have a problem. When using uic with -tr qtTrid, it generates function like
Code:
qtTrId("tr_string", 0)
That second parameter is wrong. I've solved that by downloading uic source and modifying it. Problem is, that I dont know how to make qmake use my uic.exe instead of the original one, which I dont want to replace. I've tried QMAKE_UIC but it does nothing.
Re: Qt Designer and id based translation
Quote:
Originally Posted by
Gery
Problem is, that I dont know how to make qmake use my uic.exe instead of the original one, which I dont want to replace. I've tried QMAKE_UIC but it does nothing.
Interesting, I would have also expected that QMAKE_UIC would be the means to that.
Maybe something like
Code:
load(uic)
uic.commands = .....
or creating a new uic command/target, like the new_moc example here http://qt-project.org/doc/qt-4.8/qma...ml#customizing
Cheers,
_