Home » U++ Library support » U++ Libraries and TheIDE: i18n, Unicode and Internationalization » Ctrl responds to Language-Setting event?
Re: Ctrl responds to Language-Setting event? [message #35830 is a reply to message #35828] |
Tue, 27 March 2012 07:22 |
|
Hi Lance
Lance wrote on Tue, 27 March 2012 01:35 |
If I change language, the main menu reflects it immediately. Not other Ctrl-derivatives. Only Ctrls created afterwards will reflect the change in language setting. Is it a way to make Ctrls responds to change in language setting? For example, it is possible to defer language-translation to Paint() so that a call to Refresh() will do?
|
I was fighting the very same thing few weeks ago and the solution that seemed most elegant to me is this: For each GUI class I created a method Setup() which handled all the language dependent stuff - the layout initialization (CtrlLayout call) and all the code that used t_("") macro to assign translated strings to my Ctrls. If you call such function in constructor and also each time after the language changes, the labels will be translated correctly. The biggest problem I had was with GridCtrl, where I had to recreate all the contents because it contained some translated strings as well .
Lance wrote on Tue, 27 March 2012 01:35 | Another problem I encountered with changing language setting is with EditDate. Due to date scan format changing, it will not Accept() the date string it previously displayed.
|
I think simple workaround for this could be reading out the value to Date variable and assigning it back again after the change. Not tested, but should work
In past I have also used slightly different approach, where I serialized the entire state of the application and then completely restarted the GUI. But that was way to crude, inefficient and involved a pointer ... and on top of that it can't be done simply for every application.
Best regards,
Honza
|
|
|
Goto Forum:
Current Time: Fri May 10 21:17:03 CEST 2024
Total time taken to generate the page: 0.02280 seconds
|