PDA

View Full Version : language translations with Qt5.2



SSqt5.2
4th August 2014, 07:39
Hi9 All,
I am new to Qt and C++;
Creating a basic program for language translation with Qt 5.2 creator. I am referring the Hellotr() program from Qt docs for this.
To get the lupdate and lrelease i am using the tolls provided with Qt Creator IDE. "tools/external/Linguist/Update Translations" and "Release translations".
I have doent hte suggested changes in .pro, .ts file. but at result no Latin words are shown, instead English words from the source file are only shown.
(If i change translations in ts file other english word, those do not appear).

Can anyone help me on this?

Thanks in advance.



the text in .ts file is here.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>MainWindow</name>
<message>
<location filename="mainwindow.ui" line="13"/>
<source>MainWindow</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QPushButton</name>
<message>
<location filename="main.cpp" line="14"/>
<source>Hello world!</source>
<translation>Great deal!!!</translation>
</message>
</context>
</TS>

ChrisW67
4th August 2014, 09:23
The location of the executable is probably not the source code directory so the "HelloWorld_la.qm" file will not be found by QTranslator::load() with a relative path and no specified directory

SSqt5.2
4th August 2014, 10:15
Hi Chris,
Thanks for reply.
Yes that was the problem. and now i am able to see the translations.

Thanks,