Multi-language capability
The following data types are used in the Control programming language for supporting its multilingual capability:
-
langString
-
dyn_langString
-
dyn_dyn_langString
The following operators are supported for these data types:
= == != []
The index operator [ ] (starting with 1) can only be used for read access, i.e. the langstrings cannot be changed. The result of such an operation is of type string for langstring. Use the function setLangString() to change the individual entries in a langString. If a langStringvariable is assigned to a stringvariable then the entry in the current language is used from the langString.
Please note that the absolute index for the languages in WinCC OA (please refer to the <wincc_oa_path>\nls\lang.nt file or the function getGlobalLangId()) is not the same as the relative index of the project languages (refer to the project config file or the getLangIdx() function).
Independent of the coding type comparisons of character strings (for example >,< ) are always done Byte by Byte. Due to this reason you might get unexpected results when you for example compare two strings, one using ISO standard coding and the other using UTF-8 coding.
Example
Assume that three languages are supported, s[1]...s[3]. The active language has the index 1 here. The result of the first Debug instruction -- DebugN(-a,-b) in the example then reads ["German" "Hungarian" "English"] ["" "" ""].
main()
{
langString a, b;
dyn_string s;
string text;
s[1] = "German";
s[2] = "Hungarian";
s[3] = "English";
a = s;
DebugN(a, b);
text = a[2];
DebugN(text); // ["English"]
text = "Active is: " + a;
DebugN(text);
// -> ["Active is: Hungarian"]
a = b;
if ( a == b )
{
DebugN("b:", b);
}
if ( a != b )
{
DebugN("a:", a);
}
}
OaLanguage Enum
The OaLanguage Enum is a globally defined enum that has a value for every language available in WinCC OA. This enum is defined in the "std.ctl"library and assigns a unique value to each language.
This Enum is used as an argument or return value in various multilingual functions.
Language String
In addition to the OaLanguage enum, many of the multilingualism functionsalso use a language string as an argument. This is defined in the "nls/lang.dir"language directory. The utf8 languages can also be addressed by using their shorter form (e.g.: "de_AT").