XML File for dynamic Texts
For a description how to use dynamic texts in the visualization see 'Settings', category Language. The underlying 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). These prefix-ID combinations can be entered in the configuration of a visualization element.
In the header section of the file a default language and a default font assigned to a language can be defined.
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 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.
See a file example below.
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! The Target-Visualization offers an interface for scanning the entries of dynamic textlists. Thus those can be used directly in the program. |
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. f 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). |
<default-font> | Default font for <language>: The given font (e.g. "Arial" will automatically be used |
<language><language></language> | |
</default-font> |
|
<default-font> | further default fonts for other languages |
<language>... | |
... | |
<default-font> | |
... | |
</header> |
|
The list of assignments Prefix-ID-text starts with <text list> and ends 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); "ID" corresponds to the entry in category 'Variables', Textdisplay |
<language> <!CDATA[<TEXT>]] </language> | Use any string as a '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 one 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:
a. Enter in category ‚Text’ in the text field: "%<Maschine>"
b. Enter in category ‚Variables’ at Textdisplay“: „PLC_PRG.ivar”
(3) Configure another visualization element for displaying the error message for the currently occurred error:
a. Enter in category ‚Text’ in the text field: "%<Error>"
b. Enter in category ‚Variables’ at Textdisplay“: "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 version="1.0" encoding="ISO-8859-1"?>
<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>
(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".
(The change of language also could be managed by using the INTERN command 'LANGUAGE' by another visualization element.)