TextManager
class TextManager
The text manager connects the native text resources with the respective translations. The languages to be translated are defined here. For each NativeTextList a TextTable is created in which the individual texts are translated.
Abstract
The text manager connects the native text resources with the respective translations. The languages to be translated are defined here. For each NativeTextList a TextTable is created in which the individual texts are translated.
class TextManager extends NamedResource
languageDefinition
With languageDefinitions, the languages to which the TextLists should be translated to can be defined. In textTables there will be a translation option for every language added here on every list element. If you want to export your PLC alarm text lists to Siemens TIA, your language abbreviations must be defined as follows: (language abbreviation)-(country abbreviation, capitalised); Examples: en-US, de-DE, fr-FR and so forth.
TextTable
For each TextManager, one TextTable can be created for a NativeTextList. In it, the corresponding translation is specified for each language.
In addition, it is specified which is the default language for this TextTable. This has an effect on the generated output. If no translation is specified in the standard language, the text is taken from the NativeTextResource.
Inheritance
TextManagers can inherit languageDefinitions from another TextManager through "extends". Adding new languageDefinitions to a TextManager which extends another is not possible. This can be useful when you have a base project with a TextManager and you either want to make sure all languageDefinitions are the same throughout your whole workspace and/or you simply dont want to define them all again.
Text export
A folder must be created in the project to export the texts. The specified BuildConfig must be connected to this folder:
If a generate is triggered, a CSV file is created for each TextTable.
Export content
The CSV file contains the following columns:
Column 1 (TextTable)
The first column contains the GUID of the TextTable in the header. The following lines contain the GUID of the corresponding NativeTextResource.
native
This column contains the text of the NativeTextResource.
key
This column contains the unique key for each NativeTextResource, which can be defined in the NativeTextList.
path
The path gives an indication of where in the application the text resource is used.
languages (en, de, ...)
There is one column for each language.
Content raw
TextTable-a2f57a96-8a86-11ec-8c6b-b1ae25c88b42,native,key,path,en,de
b34afed2-8a86-11ec-8c6b-b1ae25c88b42,"This is text 1","1","ConfigDec::Cnf.din_CylinderTimeout->CYL_IFS->CYL","This is text 1","Das ist Text 1"
bd02f0da-8a86-11ec-8c6b-b1ae25c88b42,"This is text 2","2","","This is text 2","Das ist Text 2"
Text import
By using the import mechanism the CSV files can be imported back.
Both individual files and entire folder contents can be imported.
- It is important that the GUIDs are not removed or changed. They serve as anchors for the re-import.
- The import can also be used to create new NativeTextResources. For this purpose, a new line without GUID can simply be added.
- All contents (except the column with the GUIDs) must be enclosed in double quotes.