Multilanguage support for script variables

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
Post Reply
BobLivingston
Posts: 19
Joined: Tue Jan 17, 2012 8:57 am

Multilanguage support for script variables

Post by BobLivingston »

Is it possible to have Multiple Languages function also include certain variables accessible via scripting?

For instance, it would be nice if when the script puts up a message box the text were in the selected language rather than the default language used in the script.
Bob Livingston
Sr Controls Engineer
FlexEnergy Energy Systems
30 New Hampshire Ave
Portsmouth, NH 03801
USA

User avatar
Ron L.
Posts: 214
Joined: Fri Jul 15, 2011 3:21 pm

Re: Multilanguage support for script variables

Post by Ron L. »

One way to do this would be to set a tag to a value every-time you changed a Language, then use this internal integer tag to determine what the current language is in your script. There isn't a System Tag or anything in Globals that tells what the current language is, but using actions it should be very straightforward to change a value of an internal tag whenever the language is changed.
Best Regards,

Beijer Electronics, Inc.
Ron Lloyd | Applications Engineer

antoineA
Posts: 20
Joined: Fri Dec 02, 2011 8:22 am

Re: Multilanguage support for script variables

Post by antoineA »

Hi,

So i suppose there is no script instruction which allows define current language?

Best regards,

antoineA.

User avatar
Ron L.
Posts: 214
Joined: Fri Jul 15, 2011 3:21 pm

Re: Multilanguage support for script variables

Post by Ron L. »

You can change languages based off of a tags value. You would add this logic under the Functions "Tags" -> "Tags" tab -> "Action" column.
ix_tag_to_language.jpg
ix_tag_to_language.jpg (32.11 KiB) Viewed 13113 times
If you would like to change this language tags value in script, the code would look something like:

Code: Select all

Globals.Tags.Tag1.Value = 2;
Best Regards,

Beijer Electronics, Inc.
Ron Lloyd | Applications Engineer

BobLivingston
Posts: 19
Joined: Tue Jan 17, 2012 8:57 am

Re: Multilanguage support for script variables

Post by BobLivingston »

Can't you just change the language using the MutiLanguage function:
Globals.MultipleLanguages.SetLanguage("Default");
Bob Livingston
Sr Controls Engineer
FlexEnergy Energy Systems
30 New Hampshire Ave
Portsmouth, NH 03801
USA

User avatar
Ron L.
Posts: 214
Joined: Fri Jul 15, 2011 3:21 pm

Re: Multilanguage support for script variables

Post by Ron L. »

That didn't show up in my auto-complete in script, but that code does compile.
Best Regards,

Beijer Electronics, Inc.
Ron Lloyd | Applications Engineer

Post Reply