How to use tr () for ui widgets
-
Thanks everyone, I can now able to get all my widgets of ui in the translation file.
But still even after loading the translation files. language doesn't changed.....
I am simply doing this in main.cpp after creating Ts and qm files@QTranslator translator;
translator.load("setup_de ");
app.installTranslator(&translator);
@I know there is something wrong ;)...hope you can help.....I am finding Qlinguist very complicated...:(
Thanks...... -
okay I am here little bit confused...Here I want my ui to change its language from english to say german.
Now, I have created a .ts file and saved each text written in my ui (Forms) with a german translation. Then I created a .qm file.
And in code (main.cpp) simply wrote :
@QTranslator translator;
translator.load("setup_de");
app.installTranslator(&translator);
@All this and done.....what was the use of retranslateUi()
Even though I am not able to make this happen, the other requirements of my code is I need to change same Ui in 5 lnguages each one happening on a click on a lineedit....Anyway this is the later part...I am facing problem in just changing into a single language...:(
What's missing?
-
lets do the basic steps first. At the moment, just dont worry about the retranslateUi.
Assume, your Ui texts are English.
-
in pro file : TRANSLATIONS = setup_de.ts
-
Install translator
@
QTranslator translator;
translator.load("/path/to/setup_de");
app.installTranslator(&translator);
@
3.lupdate *.pro
4.Open *.ts in Linguist. And give translation for each source texts.
5.lrelease *.pro
Now, you run your executable :)
EDIT : Note that path to setup_de is the path to setup_de.qm
-
-
Exactly followed these steps....:(
Tried giving absolute path to .qm file also still nothing....
My code is having many ui forms...I have translated only single screen's ui into german....expecting that after run, that screen only will show in german....
This cant be any reason for my problem?? -
:(
Followed the steps for a new project in which there is just one form and one main.cpp and nothing else ....(just to try changing ui in other language)
It was working fine....But not happening in the code where there are so many Ui forms....what could be the reason? -
Its doesn't matter if you have a single ui, or multiple ui. Eventually, all these UI files are turning one class each. So lets see it as classes.
In other words, it doesn't matter how many classes are there or not.When you change your language, all you got to do is 1.load the qm, 2.call retranslateUi.
May be your qm/ts are not correct ?
-
[quote author="pragati" date="1348295432"]I got this post twice by mistake...I know about the "edit" :)
Want to delete this post.....[/quote]I deleted it for you. If you want, you can use the "report" link next to each post to request moderator attention for your post. If you say that you want it deleted because it is double, a mod will take care of it.