PDA

View Full Version : translation issues



kulsekarr
3rd February 2015, 13:03
hi ,

I have an applications which is in french. and I was able to translate the UI texts into english. but unable to translate the code within the file which is in form of strings using tr(). i searched and got an idea that i can add integer to TR function how it is? and convert to french or should i use qtTrId functions.


any one can suggest .

Thanks in advance

anda_skoa
3rd February 2015, 14:09
I am not sure what you mean.

If you have translatable text in C++ code, you pass it through the tr() function.
That serves as a translation call during runtime as well as marking the string for extraction for the lupdate tool.

Cheers,
_

kulsekarr
3rd February 2015, 14:36
thanks for your reply actually i have defined the error messages in tr(). and there are hundreds of messages that will repeat. so i thought of adding a header file with all the error messages defined to a varaible.

errorcode.h
ex #define ERROR_1 "CORRECT IT"

actualcode.cpp
and i am using the tr() as-----> msgBox.setText(tr(ERROR_1)); while im

whether it is possible to implement?

Thanks

anda_skoa
3rd February 2015, 15:17
Ah.

Yes, you can do something like that, but you need to mark the strings for translation using QT_TRANSLATION_NOOP
http://qt-project.org/doc/qt-4.8/linguist-programmers.html#using-qt-tr-noop-and-qt-translate-noop

Cheers,
_

kulsekarr
4th February 2015, 08:00
Thanks!! Got It!