Unit for Multilanguage

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
5 posts • Page 1 of 1
paramesh1985
Posts:81
Joined: Thu Sep 25, 2014 6:03 am

Unit for Multilanguage

Post by paramesh1985 »

Hi,

We are having one requirement to configure unit for multi language.

Is there any provision.

regards,

r.paramesh

RudiKreiner
Posts:198
Joined: Mon May 16, 2011 2:10 pm

Re: Unit for Multilanguage

Post by RudiKreiner »

Since the unit config is defined as a langString, this is a standard feature of WinCC OA:
See the following functions in the WinCC OA Help for more information:

langString dpGetUnit (string dp);
bool dpSetUnit(string dp, langString dpUnit);

paramesh1985
Posts:81
Joined: Thu Sep 25, 2014 6:03 am

Re: Unit for Multilanguage

Post by paramesh1985 »

Hi,
I tried the below script but its not working.

Its throwing the error "Index out of range".

Is there any possibility to set the units for multi language in the para like "description".

Regards,

R.paramesh

RudiKreiner
Posts:198
Joined: Mon May 16, 2011 2:10 pm

Re: Unit for Multilanguage

Post by RudiKreiner »

I can't see the script that you are using, but judging from your error message I am suspecting that you may be using the wrong indices.
Note that in WinCC, indices start with 0 for strings and langStrings, while they start at 1 for all dyn types.

Here is some sample code that you could try:

langString units;
for ( i = 0; i < getNoOfLangs (); i++ )
{
setLangString ( units, i, getUnitInLanguage("°C", i );
}

dpSetUnit ( DataPointNameString, units );


where you will need to make your own function getUnitInLanguage() to translate the unit string and fill the string variable DataPointNameString with the name of your datapoint.

Good luck

RudiKreiner
Posts:198
Joined: Mon May 16, 2011 2:10 pm

Re: Unit for Multilanguage

Post by RudiKreiner »

Setting the unit in the para panel unfortunately sets it to the same value for all languages. At least that is the behaviour that I see in my WinCC 3.14 project.

You could also try setting the unit using an ascii import like this example which sets the description format and unit for the datapoint named ExtGnl.ChiSupTmp.Act.
Note that this only works for projects with utf fonts which allows using multiple languages in one file. This forum obviously does not use utf fonts that is why my special characters in chinese, spanish and german look a bit strange.
Otherwise you need separate files for each language that has a different font.

AliasId CommentName
ExtGnl.ChiSupTmp.Act lt:4 LANG:10001 "Extrusion: General: Chilled Water Supply Temperature: Actual Value@%5.1f@°C" LANG:10004 "æ?¤å?º: æ¦?å?µ: æ¿?åç»? 温度: å®?é??å?¼@%5.1f@°C" LANG:10010 "Extrusión: General: Agua Enfriado Suministro Temperatura: Valor Actual@%5.1f@°C" LANG:10011 "Extrusion: : Kühlwasser Versorgung Temperatur: Istwert@%5.1f@°C"

5 posts • Page 1 of 1