Not changing the active language and trying to only format numbers in a different locale than the current one is the wrong approach.
(e.g. you do not deal with input, sorting, date/time formatting, ...)
WinCC_OA has the concept of an active (current) language. Trying to circumvent this functionality is the wrong way and nothing we support.
How to switch a language via switchLang without side effect of calling Initialize Scripts
- mkoller
- Posts:741
- Joined: Fri Sep 17, 2010 9:03 am
Re: How to switch a language via switchLang without side effect of calling Initialize Scripts
- flindecke
- Posts:69
- Joined: Wed Jun 24, 2015 1:54 pm
Re: How to switch a language via switchLang without side effect of calling Initialize Scripts
Hallo Frenk Mulder,
i did not wante to create my own sprintf either - i know all of the maintenance activities needed to handle them properly. As Martin Koller mentioned below, WinCC OA has the concept "of an active current language".
Thus, the only solution would be to add "LangChange redraw only" property to every panel and to every new panel.
Replacing a "." with a " " might help, but need additional language specific code and i want a solution for every(!) language using the correct number formatting, without knowing all the formats - the operating system already has these information via the locale C/C++ API which seems to be used by WinCC OA.
Thanks for your help.
Frank Lindecke
i did not wante to create my own sprintf either - i know all of the maintenance activities needed to handle them properly. As Martin Koller mentioned below, WinCC OA has the concept "of an active current language".
Thus, the only solution would be to add "LangChange redraw only" property to every panel and to every new panel.
Replacing a "." with a " " might help, but need additional language specific code and i want a solution for every(!) language using the correct number formatting, without knowing all the formats - the operating system already has these information via the locale C/C++ API which seems to be used by WinCC OA.
Thanks for your help.
Frank Lindecke
- fmulder
- Posts:330
- Joined: Wed Feb 03, 2010 9:46 am
Re: How to switch a language via switchLang without side effect of calling Initialize Scripts
The problem is that the formatting of the numbers is a Windows OS thing. if you want Windows to format differently, then you'll have to logout Windows and to re-login with a person with a different language.
In our systems we often have the concept where:
- an operator wants to leave, but the application must remain 'manned'
- a different operator sits down behind the running Ui and enters his credentials (so we do not logout WinCC OA and we do not logout Windows)
- we just login a new user and could then tell the UI that we want different formatting
This means that we ourselves take control of the language and the formatting.
Share the fun
Frenk Mulder
In our systems we often have the concept where:
- an operator wants to leave, but the application must remain 'manned'
- a different operator sits down behind the running Ui and enters his credentials (so we do not logout WinCC OA and we do not logout Windows)
- we just login a new user and could then tell the UI that we want different formatting
This means that we ourselves take control of the language and the formatting.
Share the fun
Frenk Mulder
- flindecke
- Posts:69
- Joined: Wed Jun 24, 2015 1:54 pm
Re: How to switch a language via switchLang without side effect of calling Initialize Scripts
Hello Frenk Mulder,
this seems to be exact the case we want to implement. A user has a user language. Whenever the user logs in (via a self created log in dialog), the language of the application changes. The other case is, when maintenance goes to the machine, but do not want to change the user (because of the access rights etc.). In such a case the language should be changed also.
Numbers should be formatted by the language defaults. The end user should not define the formatting of the numbers himself.
My hope is, that when every panel provides the "LangChange redraw only" flag set to TRUE and we are using switchLang or changeLang everything works as expected.
Thanks for your thoughts about this topic. I will post an update when this issue will be fixed.
this seems to be exact the case we want to implement. A user has a user language. Whenever the user logs in (via a self created log in dialog), the language of the application changes. The other case is, when maintenance goes to the machine, but do not want to change the user (because of the access rights etc.). In such a case the language should be changed also.
Numbers should be formatted by the language defaults. The end user should not define the formatting of the numbers himself.
My hope is, that when every panel provides the "LangChange redraw only" flag set to TRUE and we are using switchLang or changeLang everything works as expected.
Thanks for your thoughts about this topic. I will post an update when this issue will be fixed.
- flindecke
- Posts:69
- Joined: Wed Jun 24, 2015 1:54 pm
Re: How to switch a language via switchLang without side effect of calling Initialize Scripts
Hello,
after updating all panel files with the corresponding flag (by a little tool i wrote), everything works as expected.
Language can be changed without calling initialize script of panels once more. Numbers can be formatted using sprintfPL (but thousand separators are not displayed... nevertheless they are currently not needed). Date and time is properly formatted as well.
I also wrote a GEDI extension, which automatically fix the property after file is saved to disk. Works like a charm.
Proposal for WinCC OA 3.16(???):
- Add the possibility to set this property to a default value for a project (like setting the default panel format to XML) in the config file
- Make it possible to change the property via CONTROL. So it would be possible to load the panel, modify it and later save it to disk and everything using just CONTROL
Thanks to all the folks helping on this issue.
With best regards,
Frank Lindecke
after updating all panel files with the corresponding flag (by a little tool i wrote), everything works as expected.
Language can be changed without calling initialize script of panels once more. Numbers can be formatted using sprintfPL (but thousand separators are not displayed... nevertheless they are currently not needed). Date and time is properly formatted as well.
I also wrote a GEDI extension, which automatically fix the property after file is saved to disk. Works like a charm.
Proposal for WinCC OA 3.16(???):
- Add the possibility to set this property to a default value for a project (like setting the default panel format to XML) in the config file
- Make it possible to change the property via CONTROL. So it would be possible to load the panel, modify it and later save it to disk and everything using just CONTROL
Thanks to all the folks helping on this issue.
With best regards,
Frank Lindecke