XML-File for Dynamic Texts

For a description how to use dynamic texts in the visualization see

Dynamic \ Language Switching

Configuration of Dynamic Language Switching

The basic file must be available in XML format (<file name>.xml). In this file texts are assigned to identifiers(which are a combination of a prefix and a ID). In case of normal texts and tootip texts these combinations can be entered in the configuration of a visualization element, in order to get displayed the respective text in online mode. In case of an alarm table the prefix and ID are given by the “path” of the alarm group in the alarm configuration (prefix) and the line number of the text definition in the alarm group configuration table (ID).

Example picture showing prefix and ID in an alarm configuration:

../_images/a134293c4377dc3c0a3313905c72d969

In the header section of the file a default language and a default font assigned to a language can be defined. See an example of an description file at the end of this page.

The descriptions in the xml-file are enclosed by tag <dynamic-text> and <\dynamic_text> which have to be entered at the beginning resp. end of the file.

The language files for dynamic texts (as of IEC 61131-3 editor V2.3.4.0) can be created in Unicode (UTF-16) or ANSI (ISO-8859-1). This is to be defined via the encoding syntax at the beginning of the xml-file, e.g. ” <?xml version=‘1.0’ encoding=’UTF-16’?>”. For the preconditions for the usage of unicode-able fonts, see Language Switching.

Note

To facilitate the creation of the language file the standard installation provides some Excel macros.

Note

Primary formats of the xml-file, which do not use the <dynamic_text>\<\dynamic_text> tags or the header section, will be supported further on.

Structure \ of the file:

The header section starts with <header> and is closed with <\header>. If you want to define a default language, use entry <default-language>. A default font which is assigned to a certain language, can be defined via entry <default-font>. These entries are optional. If they are missing, the dynamic text in the visualization will be displayed according to the local configuration settings of the visualization.

<header>  
<default-language><language></default-language>

Default language; that means that if there is no text entry available for the currently set language, that text will be used which is found within the same text entry for the default language. If also for the default language no text is found,  ”<PREFIX> <ID>” will be displayed.

If multiple  XML-files are used, thus providing multiple headers, only that header section will be regarded, which is read at last. So it is reasonable to use only one header section !  The language token must correspond which one of that used in the text entries (see below).

Note: In online mode the default language can be set explicitly via a visualization element configured with command INTERN LANGUAGE DEFAULT in category Input, Execute program.

<default-font>

Default font for <language>: The given font (e.g. “Arial” will automatically be used for all elements, which display dynamic texts in <language>. The language token must correspond which one of that used in the text entries (see below).

For the preconditions for the usage of unicode-able fonts please see Language Switching.

<language><language></language>
<font-name><font></font-name>
</default-font>
<default-font> Further default fonts for other languages
<language>……
….
</default-font>
</header>  

The list of the assignments of the Prefix-ID combinations to texts must start with <text list> and end with </text list>. The particular text entries each start with <text prefix> and end with <\text>.

A text entry which is assigned to a Prefix-ID-combination must contain the following lines:

<text prefix>= “<PREFIX> id=”<ID>”

“PREFIX” corresponds to the <PREFIX> used in the visualization element configuration (category Text or Tooltip);  in case of an message text used in an alarm table the path of thealarm group: mainchapters/Alarm_groups

“ID” corresponds to the entry in category ‘Variables’, Textdisplay or Tooltip-display; in case of an of an message text used in an alarm table the number of the line which defines that text in the Alarm groups must be specified.

<language> <!CDATA[<TEXT>]]</language> Use any string as an ‘language’ identifier (e.g. “english”). This identifier then will be displayed in the ‘Settings’ dialog, category Language of the visualization element in the selection list at ‘Language’; instead of  “TEXT” insert any text which then will be displayed instead of the above defined  ID-prefix-combination in the visualization element.
</text>  

For each prefix-ID-combination at least for 1 language a text entry must be available. E.g. see in the file example shown below: <deutsch> indicates the start of the german version of a text, </deutsch> terminates the text.

Dynamic texts on the one hand can serve to display Texts in different languages, but of course on the other hand they also can be used to change the content of a text (same language) display dynamically.

Example:

You want to have two visualization elements, one for visualizing the current machine identification, the other for visualizing an error message according to a currently given error number:

  1. Define in PLC_PRG the following variables: ivar of type INT, defining the current machine identification; errnum of type INT defining the current error number.

  2. Configure a visualization element for displaying the current machine identification:

    - In category ‘Text’’ in the text field enter: “%<Maschine>”

    - In category ‘Variables’ at Textdisplay” enter: “PLC_PRG.ivar”

  3. Configure another visualization element for displaying the error message for the currently occurred error:

    - In category ‘Text’ in the text field enter: “%<Error>”

    - In category ‘Variables’ at ‘Textdisplay’ enter: “PLC_PRG.errnum”

  4. Create a XML file, e.g. with name dynamictextsample.xml, according to the syntax described above, which should look as follows for the current example: XML-File for Dynamic Texts

  5. In the visualization open dialog ‘Settings’, category Language: Activate option ‘Dynamic Texts’; Add file dynamictextsample.xml, now available on your computer, to the file list.

  6. Go online with the project.

  7. In the visualization settings set language to “deutsch”. Set PLC_PRG.ivar to “1” and PLC_PRG.errnum to “4711”. Now in the visualization elements the following texts should be displayed: “Vorschub” resp. “Fehler an Position 4711”. The texts will be displayed in Arial 13.

  8. Set PLC_PRG.ivar to “2” and PLC_PRG.errnum to “2000”. The texts will change to “Beschleunigung” and “Das ist ein Fehlertext über mehrere Zeilen”.

  9. In the visualization settings change the language to “english”. Now the following texts will be displayed:

    “Acceleration” and “This is a error text over more than one line”.

Sample XML file for dynamic texts

<dynamic-text>

<header>

<default-language>deutsch</default-language>

<default-font>

<language>deutsch</language>

<font-name>Arial</font-name>

<font-color>0,0,0</font-color>

<font-height>-13</font-height>

<font-weight>700</font-weight>

<font-italic>false</font-italic>

<font-underline>false</font-underline>

<font-strike-out>false</font-strike-out>

<font-char-set>0</font-char-set>

</default-font>

<default-font>

<language>english</language>

<font-name>Arial</font-name>

<font-color>0,0,0</font-color>

<font-height>-13</font-height>

<font-weight>700</font-weight>

<font-italic>false</font-italic>

<font-underline>false</font-underline>

<font-strike-out>false</font-strike-out>

<font-char-set>0</font-char-set>

</default-font>

</header>

<text-list>

<text prefix=”ERROR” id=”4711”>

<deutsch>Fehler an Position 4711</deutsch>

<english>Error at position 4711</english>

</text>

<text prefix=”ERROR” id=”815”>

<deutsch>Fehler an Position 815</deutsch>

<english>Error at position 815</english>

</text>

<text prefix=”ERROR” id=”2000”>

<deutsch>

<![CDATA[

Das ist ein Fehlertext über

mehrere Zeilen

]]>

</deutsch>

<english>

<![CDATA[

This is a error text over more than

one line

]]>

</english>

</text>

<text prefix=”MASCHINE” id=”1”>

<deutsch>

<![CDATA[ Vorschub]]>

</deutsch>

<english>

<![CDATA[ Feed rate]]>

</english>

</text>

<text prefix=”MASCHINE” id=”2”>

<deutsch>

<![CDATA[ Beschleunigung

]]>

</deutsch>

<english>

<![CDATA[ Acceleration

]]>

</english>

</text>

</text-list>

</dynamic-text>