Multi Language Support
Support for multiple languages in Editor and Operator has been added so that engineers can develop the Project in one language and configure it so that operators can use the same Project in another language. The support extends to the ability to dynamically switch between the configured languages at run time.
It is expected that each project would not require more than two languages to be configured, but more can be supported.
The languages and text are saved with the Project. When the Client is started, it always starts with the default language.
Text Manager
To open the Text Manager, go to the ribbon, open the Home tab, and in category Managers, click on Texts. Or you can also double-click on the Texts element in Project Explorer. The Text Manager screen appears as:
The toolbar buttons are (from left to right):
- Add a new Text
- Remove selected Text
- Remove All
- Import from a text file (Unicode, Tab delimited)
- Export all to a text file (Unicode, Tab delimited)
- Edit languages
- Search for a Key (filter)
A Text resource consists of a unique key that will be used as a reference and a default value that represents the default language for your project.
You can extend your available languages by adding a language to the ‘Edit languages’ window:
The language name does not have to be a valid language name but must be unique, e.g., Language1, Language2 is acceptable.
Once a Language has been added, a new column is created for the entry of the text in that language:
It is the responsibility of the designing user to ensure that a suitable translated string is entered for each text key entry and each language.
Using a Text Resource
You can use a Text resource in almost every Text property of any object in your project. To use a Text resource, you have to use the operator {{xxx}}
. For example: {{TextYes}}
. At runtime, the text will be resolved into “Yes” if the client is using the default language, or it will be resolved into the string for the current language.
The fields that support the text resources are:
- Label Control: Text of the label
- Button Control: Active and Inactive Text
- Button Control: Active and Inactive Text binding map
- Text Display Control: Mapping and Value binding map
- Numeric Display Control: Prefix and Suffix
- Window: Title of the window
- 3D Label: Text of the label
- Alarms: Alarm Message
- Action: Title and Text of the ‘Display Message Action’
Example with a label control:
Note that you can use multiple Text resource values in a property, for example:
You cannot embed metacharacters such as \t
or \n
in the text resource strings.
Dynamically Change the Current Language
To change the current language dynamically in the client, you have to use the new Action called ‘Change Current Language’. The best way to achieve this is to create a button and use this action on it. Typically, if you have three languages (one default and two other languages), you will need three buttons:
Importing/Exporting
The ‘Export’ button allows you to save all the entries in a ‘Unicode, TAB Delimited’ text file. This allows you to migrate languages and default entries into other projects.
When you use the ‘Import’ button, you are prompted that all the existing text will be deleted and the new text imported. You should ensure that any entries you wish to preserve are exported and migrated before the import.
If the file imported is not in Unicode format, the text in other languages will appear as strings of ‘?’.
When loading a saved language file into Excel, an Import Wizard appears, and you should accept the defaults of ‘Delimited’, ‘Tab’, and ‘General’.
When saving a saved language file from Excel, you must use the ‘Save as type’ of ‘UnicodeText’ to ensure the language characters are preserved.
An error will be reported if the languages in the current project differ from the languages in the import file (including spelling and order).