PLC

Managing text in a text list

Text lists are used for providing visualization texts in several languages. You can enter the texts in Unicode format, so that all languages and characters are available. Text lists can be exported and imported, so that the texts can be compiled outside the current project.

TwinCAT distinguishes between static text, which is managed in the “GlobalTextList” object, and dynamic text, which is managed in objects of type “Textlist”.

Static texts are texts within the visualization, which can only change their language at runtime. The text ID remains fixed.

Dynamic texts can be controlled via an IEC variable containing the text ID. This allows you to display varying text in a visualization element at runtime. For example, a text field can be configured such that it outputs an error text with an error number.

Both types of text list contain a table with text entries. An entry consists of an ID for identification, the source text and its translations. In a text list or a global text list, you can translate a source text into any number of languages. The translations are the basis for language selection and language switching in visualizations.

 
Directory for text list files
The directories, which provide text lists for the visualization, are specified in the Visualization category of the project properties.

See also:

Using the input wizard
TC3 User Interface documentation: Textlist
 

Adding a language and translating text

A project with a text list or a global text list is open.
1.
In the PLC project tree, double-click on an object of type Textlist or GlobalTextList.
The Textlist menu appears in the menu bar, and the text list opens in the editor.
2.
Select the command Add Language in the Textlist menu or the context menu.
3.
Enter a name for the language, e.g. “en-US”. Quit the dialog with OK.
A column with the heading en-US appears.
4.
Enter the translation of the source text in this column.
You can add any number of languages.
 
Whereas the Default column has to contain text, you don't have to enter translations in the language column. If no translation is found for a text entry, the default text is displayed automatically.

See also:

TC3 User Interface documentation: Command Add Language
 
 

Exporting a text list

A project with a text list or a global text list is open.
1.
In the PLC project tree, double-click on an object of type Textlist or GlobalTextList.
The Textlist menu appears in the menu bar, and the text list opens in the editor.
2.
Select the command Import/Export Text Lists in the Textlist menu or the context menu.
The Import/Export dialog opens.
3.
Under Choose export file click on  img2be833ef7deb1e6ec0a8640e0056e76c_1_--_--_png72, select the directory and enter a file names, e.g. “Text_lists_exported”.
4.
Enable the option Export.
5.
Quit the Import/Export dialog with OK.
TwinCAT exports the text list entries of all text lists within a project to a .csv file. The table contains a column with the text list name.
 
You can use the Export All command to export the text list entries as a .txt file. A file is created for each text list. The directory, in which the export files are stored automatically, can be defined in the project properties.

Example:

Content of the file Text_lists_exported

TextList       Id   Default        en-us
TextList_A     A    Information A  Information A_en
TextList_A     B    Information B  Information B_en: Ok
TextList_A     C    Information C  Information C_en
AlarmGroup     1    Warnung 1    
AlarmGroup     2    Warnung 2    
GlobalTextList      Information G  Information G_en
GlobalTextList      Information H  Information H_en
GlobalTextList      Umschalten     Switch
GlobalTextList      Zähler: %i     Counter: %i

See also:

TC3 User Interface documentation: Command Import/Export Text Lists
 
 

Making the exported file available for the input assistant

You have created a file, for example Text_lists_exported, via the command Import/Export Text Lists. It contains the texts of the text lists of the project.
1.
In the Tools menu, click on the command Options, category TwinCAT > PLC Environment > Visualization, tab File Options.
2.
In Text file for textual "IntelliSense" click on  img2be833ef7deb1e6ec0a8640e0056e76c_1_--_--_png72 and select a file, e.g. Text_lists_exported. Quit the dialog with OK.
If you enter a static text under the property Texts for an element in a visualization, TwinCAT offers the source texts contained in the file for selection as soon as you type the first letter.
 textlistautodeclare_en-us
 
 

Importing a file with text list entries

An importable file is a file with the format .csv. The first line is a header, e.g. “TextList Id Default en_US”. The other lines contain text list entries. You obtain such a file when you export the text lists of the project to a file. There you can edit the text list entries outside TwinCAT and then re-import the file. During the import, TwinCAT treats the text list entries for the GlobalTextList and for dynamic text lists differently.

GlobalTextList:

If the ID is unknown, TwinCAT does not create and new text list entries.
TwinCAT ignores modifications that affect the ID or the source text.
TwinCAT accepts changes to the translations.

Textlist:

For a new ID, TwinCAT complements the corresponding text list with a corresponding text list entry.
For an existing ID with different source text, the source text in the text list is overwritten with the source text contained in the file.
TwinCAT accepts changes to the translations.

Import file:

A project with a text list or a global text list is open.
1.
In the PLC project tree, double-click on an object of type Textlist or GlobalTextList.
The Textlist menu appears in the menu bar, and the text list opens in the editor.
2.
Select the command Import/Export Text Lists in the Textlist menu or the context menu.
The Import/Export dialog opens.
3.
Under Choose file to compare or to import, click on  img2be833ef7deb1e6ec0a8640e0056e76c_1_--_--_png72 and select a directory and a file name, e.g. “Text_lists_corrected.csv”.
4.
Enable the option Import.
5.
Quit the dialog with OK.
TwinCAT imports the text list entries from the file into the corresponding text lists.

Example:

Content of the file Text_lists_corrected.csv

TextList       Id   Default            en-us
TextList_A     A    Information A      Information A_en
TextList_A     B    Information B: Ok  Information B_en: Ok
TextList_A     C    Information C      Information C_en
TextList_A     D    Information D      Information D_en
AlarmGroup     1    Warnung 1          Warning 1
AlarmGroup     2    Warnung 2    
GlobalTextList      Information G      Information G_en: Ok
GlobalTextList      Information HH     Information H_en
GlobalTextList      Information I      Information I_en
GlobalTextList      Umschalten         Switch
GlobalTextList      Zähler: %i         Counter: %i

This content is transferred to the corresponding text lists in the project.

TextList       Id   Default            en-us
TextList_A     A    Information A      Information A_en
TextList_A     B    Information B: Ok  Information B_en:  Ok
TextList_A     C    Information C      Information C_en
TextList_A     D    Information D      Information D_en
AlarmGroup     1    Warnung 1          Warning 1
AlarmGroup     2    Warnung 2    
GlobalTextList      Information G      Information G_en: Ok
GlobalTextList      Information H      Information H_en
GlobalTextList      Umschalten         Switch
GlobalTextList      Zähler:  %i        Counter:  %i
 
 

Comparing text lists with file and export difference

A project with a text list or a global text list is open.
1.
In the PLC project tree, double-click on an object of type TextList or GlobalTextList.
The Textlist menu appears in the menu bar, and the text list opens in the editor.
2.
Select the command Import/Export Text Lists in the Textlist menu or the context menu.
The Import/Export dialog opens.
3.
Under Choose file to compare or to import, click on  img2be833ef7deb1e6ec0a8640e0056e76c_1_--_--_png72 and select a directory and a file name for the comparison file, e.g. “Text_lists_corrected.csv”.
4.
Under Choose export file, click on  img2be833ef7deb1e6ec0a8640e0056e76c_1_--_--_png72, select a directory and enter a name for the file that will contain the result of the comparison.
5.
Enable the option Export only text differences.
6.
Quit the dialog with OK.
TwinCAT reads the import file and compares the text list entries with the same ID. If there are differences, TwinCAT writes the text list entries of the text list into the export file. For the global text list, TwinCAT compares the translations with the source texts. If there are differences, TwinCAT writes the text list entries into the export file.

Example:

TextList       Id   Default        en-us
TextList_A     B    Information B  Information B_en: Ok
AlarmGroup     1    Warnung 1      Warning 1
GlobalTextList      Information G  Information G_en
GlobalTextList      Information H  Information H_en

See also:

TC3 User Interface documentation: Command Import/Export Text Lists
 
Additional information
Managing Static Text in Global Text Lists
Managing Dynamic Text in a Text List