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 |
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 |
|
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 #38591 is a reply to message #38493] |
Wed, 26 December 2012 09:18 |
|
koldo
Messages: 3357 Registered: August 2008
|
Senior Veteran |
|
|
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
|
|
|
Goto Forum:
Current Time: Tue Apr 23 18:28:53 CEST 2024
Total time taken to generate the page: 0.03006 seconds
|