How to change the application language.



  • 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?



  • 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



  • Thanks :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.