Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Libraries and TheIDE: i18n, Unicode and Internationalization » How to update the GUI with language changes?
How to update the GUI with language changes? [message #38469] Wed, 19 December 2012 15:15 Go to next message
lectus is currently offline  lectus
Messages: 329
Registered: September 2006
Location: Brazil
Senior Member
Hi!
If I call SetLanguage() before the Window is created I get the correct language.

But if I want the user to select a different language after the Window is already created, how to update the Window to reflect the changes?

Thanks
Re: How to update the GUI with language changes? [message #38474 is a reply to message #38469] Wed, 19 December 2012 18:41 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1758
Registered: August 2008
Location: Czech Republic
Senior Contributor

lectus wrote on Wed, 19 December 2012 15:15

But if I want the user to select a different language after the Window is already created, how to update the Window to reflect the changes?
Hi lectus,

You have to reinitialize the GUI somehow, there is more possible way. In simple apps I sometimes just serialize complete state, close the window and create new one by loading the serialized values again with new language settings. It happens so fast user will only see it blink a little. Works just fine, but requires to write the serialization code.

Another option is to do initialization of all widgets that contain internationalized strings into separate function, that is CtrlLayout, all the SetLabel calls, column names, tab names etc. This separate function is then called from constructor and also after language change. This way is IMHO quite natural and doesn't require much more work.

Best regards,
Honza
Re: How to update the GUI with language changes? [message #38486 is a reply to message #38474] Thu, 20 December 2012 08:56 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3044
Registered: August 2008
Ultimate Member
Hello Lectus

I agree with Honza.

In my case all GUI classes have an Init() function that includes the CtrlLayout() .lay call and fills all fields.


Best regards
IƱaki
Re: How to update the GUI with language changes? [message #38493 is a reply to message #38469] Thu, 20 December 2012 12:15 Go to previous messageGo to next message
lectus is currently offline  lectus
Messages: 329
Registered: September 2006
Location: Brazil
Senior Member
Thanks. It makes sense now.

I also noticed I can store the language in .ini file and load it at the start up. So, next time the user launches the application the language is already set.
Re: How to update the GUI with language changes? [message #38591 is a reply to message #38493] Wed, 26 December 2012 09:18 Go to previous message
koldo is currently offline  koldo
Messages: 3044
Registered: August 2008
Ultimate Member
lectus wrote on Thu, 20 December 2012 12:15

Thanks. It makes sense now.

I also noticed I can store the language in .ini file and load it at the start up. So, next time the user launches the application the language is already set.
That“s it

The only problem is that if user wants to change program language, it will have to ask user to restart.

This is not easy to overcome as label messages maybe are not static and depend on program data.


Best regards
IƱaki
Previous Topic: Brazilian Portuguese (PT-BR) translation
Next Topic: compiler's output message of vc10free Chinese edition
Goto Forum:
  


Current Time: Wed Dec 11 23:56:19 CET 2019

Total time taken to generate the page: 0.01015 seconds