Managing Text in a Text List¶
Text lists serve to provide texts in several languages within a visualization. You can enter the texts in Unicode format, so that all languages and characters are available to you. You can export and import text lists and thus translate the texts outside of the current project.
CODESYS distinguishes between static text, which is managed in the GlobalTextList, and dynamic text, which is managed in objects of the type Textlist. Static texts are texts within the visualization which can change only their language at runtime. The text ID thereby remains constant. You can assign dynamic texts to an IEC variable and thus display varying text in a visualization element. For example, you can configure a text field in such a way that it displays an error text for an error number. The text ID is then dynamic.
Both object types contain a table with text list entries. A text list entry consists of an ID for the identification, the source text and its translations. In a text list or a global text list you can translate a source text into as many languages as you like. The translations are the basis for the language selection and the language changeover in visualizations.
Adding a language and translating text
Requirement: A project with a text list or with a global text list is open.
Double-click in the device tree or in the POUs view on an object of the type Textlist or GlobalTextList.
- ⇒
The menu Textlist appears in the menu bar and the text list opens in the editor.
Select
Enter a name for the language, for example
en-US
. Exit the dialog box with OK.- ⇒
A column with the heading
en-US
appears.
Enter the translation of the source text in the column.
Exporting a text list
Double-click on the object GlobalTextList or on an object of the type Textlist.
- ⇒
The object opens.
Select
- ⇒
The dialog box Import/Export opens.
In Select Export File, click on
and select there the directory and file name, for example
Text_lists_exported
Activate the option Export.
Exit the dialog box Import/Export with OK.
- ⇒
CODESYS exports the text list entries of all text lists of the project into the file. The table contains a column with the text list name.
Example
Contents of the file Text_lists_exported
TextList\ Id\ Default\ en_US
Text_list_A\ A\ Information A\ Infrrmaiton A_en
Text_list_A\ B\ Information B: OK\ Information B_en: OK
Text_list_A\ C\ Information C\ Information C_en
Text_list_A\ D\ Informaiton D\ Information D_en
Text_list_A\ E\ Information E\ Infromation E_en
Text_list_A\ F\ Information F\ Information F_en
AlarmGroup\ 2\ Warnung 2
AlarmGroup\ 1\ Warnung 1
GlobalTextList\ \ Infomation B\ Information B_en
GlobalTextList\ \ Information A\ Information A_en
GlobalTextList\ \ Umschalten\ Switch
GlobalTextList\ \ Zähler: %i\ Counter : %i
Providing an exported file for the input assistant
Select the command Visualization, tab File Options.
, categoryClick on
in Text list files for textual “Intellisense” and select a file, for example
Text_lists_exported
. Exit the dialog box with OK.- ⇒
If you input a static text in an element under the property Texts in a visualization, CODESYS offers the source texts of the file as an input assistant for selection on entering the first letters.
- : Texts, Text
See also
Importing a file with text list entries
An importable file is a file with the format .csv
. The first line is a header, such as TextListId Default en_US
. The further lines contain text list entries. In this way you obtain a file when you export the text lists of the project into a file. There, outside of CODESYS, you can edit the text list entries and subsequently import the file. When importing, however, CODESYS handles the text list entries for the GlobalTextList
and for dynamic text lists differently.
GlobalTextList
- In case of an unknown ID CODESYS does not create new text list entries.
- CODESYS ignores changes that concern the ID or the source text.
- CODESYS adopts changes of the translations
Text list
- In case of a new ID CODESYS supplements the associated text list by a text list entry
- In the case of an existing ID that does not correspond to the source text, the source text of the text list is overwritten with the source text of the file.
- CODESYS adopts changes of the translations.
Double-click on the object GlobalTextList or on an object of the type Textlist.
- ⇒
The object opens.
Select
- ⇒
The dialog box Import/Export opens.
In Choose file to compare or to import, click on
and select there the directory and file name, for example
Text_lists_corrected.csv
.Activate the option Import.
Exit the dialog box with OK.
- ⇒
CODESYS imports the text list entries of the file into the associated text lists.
Example
Contents of the file Text_lists_corrected.csv
TextList\ Id\ Default\ en_US
Text_list_A\ A\ Information A\ Information A2_en
Text_list_A\ B\ Information B: OK\ Information B_en: OK
Text_list_A\ C\ Information C\ Information C_en
Text_list_A\ D\ Information D\ Information D_en
Text_list_A\ E\ Information E\ Information E_en
Text_list_A\ F\ Information F\ Information F_en
Text_list_A\ G\ Information G\ Information G_en
AlarmGroup\ 2\ Warnung 2
AlarmGroup\ 1\ Warnung 1
GlobalTextList\ \ Information B\ Information B_en
GlobalTextList\ \ Information A\ Information A_en
GlobalTextList\ \ Umschalten\ Switch
GlobalTextList\ \ Zähler: %i\ Counter : %i
These contents are adopted in this way into the text lists of the same name in the project.
See also
Comparing text lists with file and export difference
Double-click on the object GlobalTextList or on an object of the type Text List.
- ⇒
The object opens.
Select
from the context menu.- ⇒
The dialog box Import/Export opens.
In Choose file to compare or to import, click on
and select there the directory and the file name of the comparison file, for example
Text_lists_corrected.csv
.In Choose export file, click on
and select there the directory and file name of the file that will contain the result of the comparison.
Activate the option Export only text differences.
Exit the dialog box with OK.
- ⇒
CODESYS reads the import file and compares the text list entries that have the same ID. If they do not correspond, CODESYS writes the text list entries of the text list into the export file.
In the case of the global text list, CODESYS compares the translations with same source texts. If they do not correspond, CODESYS writes the text list entries into the export file.
See also