Hi all!
I just start reading how to use the translator file and the QTranslator and I need some help to see if what I am doing is any close.
the ts file
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="de" sourcelanguage="en">
<context>
<name>QObject</name>
<message>
<source>Username</source>
<translation>Benutzername</translation>
</message>
<message>
<source>Password</source>
<translation>Passwort</translation>
</message>
</context>
</TS>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="de" sourcelanguage="en">
<context>
<name>QObject</name>
<message>
<source>Username</source>
<translation>Benutzername</translation>
</message>
<message>
<source>Password</source>
<translation>Passwort</translation>
</message>
</context>
</TS>
To copy to clipboard, switch view to plain text mode
Contructor of my class
QString german
= "C:/esp/lang/deutsch.ts"; QTranslator_Language.
load(german
);
ui.label->setText("Username");
ui.label_2->setText("Password");
QString german = "C:/esp/lang/deutsch.ts"; QTranslator_Language.load(german);
QCoreApplication::installTranslator(&_Language);
ui.label->setText("Username");
ui.label_2->setText("Password");
To copy to clipboard, switch view to plain text mode
I was expecting that the Username would be translated to "Benutzername" and Password to "Passwort".
I also tried _Language.translate function but didn't work.
Bookmarks