09-03-2013 03:12 AM
I am using the localization utility for a multilanguage application I am developing and faced a strange problem.
I can correctly display localized panels but if I happen to call DefaultPanel on the localized panel, all text messages return to original (untranslated); the same happens if I call DefaultCtrl on a text message. Control labels are not affected by this problem.
The problem happens both if I use LoadLocalizedPanel and if I call LoadPanel + LocalizePanel.
This behaviour is particularly annoying as I sometimes call DefaultPanel to revert all controls in a panel to their default value. Having observed this fact, I can only use as a workaround a loop on all panel controls to default all but text messages (haven't tested on rings on till now).
Tested on CVI2009SP1 and 2012SP1, on a Win7 machine. This happens both in the IDE and in the compiled executable.
Solved! Go to Solution.
09-03-2013 07:53 AM
Hi Roberto,
Unfortunately, this is a consequence of the localization library being a component that sits on top of the UI library, rather than part of the UI library. The UI library doesn't know anything about the localized strings and so when you call DefaultCtrl, the control's value reverts to what it was in the .uir file. And the translated strings were set by simple SetCtrlVal-type calls in the localization library -- undistinguishable, as far as the UI library is concerned, with your own SetCtrlVal calls in your own program.
This could also happen to controls other than text messages: strings and text boxes, for example. The only reason it doesn't happen with all control types is because in most cases, the translated strings are not part of the control's "value". Instead, they are simply attributes (the label text, for example). And DefaultCtrl / DefaultPanel affects only values, not attributes.
If you don't want to iterate through every control looking for controls that you can or can't call DefaultCtrl on, you should also be able to get around this limitation by calling DefaultPanel followed by LocalizePanel. Would that not work for you?
09-03-2013 08:36 AM
Well, I suppose it can work for me, or at least having you clarified which is the mechanism that lies under the localization tool I can develop an appropriate strategy to address this topic.
It turn out infact that control default value can be different from what happens localizing a panel: while generating the translations in the localization utility I can add some text in the value field of string controls, for example, and have it displayed when calling LocalizePanel. However, in this particular case this can be different from what I obtain with DefaultCtrl.
Now that I have understood how the localization utility works, I can tailor the application to my needs. Thanks for your help.