How to change the application language.
-
wrote on 2 Dec 2016, 10:13 last edited by
Hai,
I have an menu which select Language, by clicking select Language a dialog window will open where I am able to select and change the language of my application. Now my doubt is how to set this selected Language as default language to the application. For example if I select French as my Language the from the menu , whenever I start the application it should be in French. How to set default language so that I need to not select my language every time? -
wrote on 2 Dec 2016, 10:26 last edited by m.sue 12 Feb 2016, 10:33
Hi,
you can save your selection using the class QSettings. Write the settings after you chose it. Read it back at the start of your application and initialize the languge accordingly.
E.g. like this:QSettings settings("OrganisationName","ApplicationName"); settings.beginGroup("General"); //write "French" settings.setValue("Language","French"); //read "French" back QString szLanguage=settings.value("Language",QString()).toString(); settings.endGroup();
-Michael
-
wrote on 2 Dec 2016, 11:13 last edited by
Thanks :)
1/3