-

Localization of the HMI Application

PLCnext Engineer supports the translation of HMI texts into other languages. This allows you to create multilingual HMI applications. Using the predefined application local tag LanguageCode, the language of user-defined text strings (e.g., object labels, text list entries etc.) can be switched at runtime.

This topic provides the following information:

Selecting the default language and target languages

Precondition for using the localization feature is that a default language and at least one alternative (target) language are set in the 'Options' dialog:
  1. Select 'Extras > Options'.
  2. Click the 'International' folder and select the 'Default Language Settings' category.
  3. Choose a 'Default' language.
  4. Define the alternative languages (target languages to be switched to): In the 'Available' group, select the respective entry and click 'Add Alternative'. The language is added to the 'Alternative' group (shows the list of available national languages in the project). Repeat this step for the desired languages.

    (You cannot add own languages to the 'Available' group.)

  5. Confirm the 'Options' dialog with 'OK'.
  6. Restart PLCnext Engineer to apply the changes.

Translating HMI texts using the 'Resources' editor

The translations of the HMI texts are entered using the 'Resources' editor. The 'Resources' editor is available for HMI objects containing a static text or a dynamic text.

The 'Resources' editors for static and dynamic texts have the same behavior and appearance. The default language and each alternative language (identified by its language code) is represented by a single column. Which alternative languages are available depends on the selection you have made in the 'Options' dialog (see the description above).

To enter a translation string, enter the text in the corresponding language column and confirm with <Enter>.

Exporting and importing translations

To export the text list translations entered in the 'Resources' editor to a csv file, click the icon on the toolbar of the 'Resources' editor, specify a location and file name in the file open dialog, and click 'Save'.

Note
The delimiter (for example, comma or semicolon) used for the csv file is taken from the list separator setting defined in the Windows regional settings.

You can now edit the csv file in Excel or in any other text editor and then re-import the file (the following figure shows an exported csv file opened in Excel).

When editing the csv file, observe the following:

To import text list translations from a csv file back into your project, click the button on the toolbar of the 'Resources' editor and select the edited csv file in the 'Open' dialog.

Switching the language for HMI texts at runtime

The language used for the HMI texts in the HMI application can be switched by using the predefined application local tag LanguageCode (STRING data type). An application local tag is specific to one client (station) but shared among all HMI pages in your project. This tag is listed in the 'Tags' editor of the 'Application' PLANT node. By writing the desired target language (language code) to the LanguageCode tag (e.g., using a 'Write Value' action of an HMI object), the displayed language of the HMI application can be switched at runtime.

Note
As the HMI display language is switched by the HMI client, several clients could use different languages.

LanguageCode tag

Example

The following example configuration describes how to configure the language switching at runtime between English and German using two button objects. The procedure assumes that you have created an HMI page containing a text object labeled with, for example, 'An error occurred' and entered the corresponding German translation in the 'Resources' editor of the 'Application' PLANT node.

  1. Insert two button objects and label the buttons with 'English' and 'German' (the label for the text object is entered in the object's properties window on the general tab under the 'Text' category).
  2. Add an 'Action > Action on Pressed > Write value' dynamic to each button. For each button, set the 'Write value' parameters as follows:
    • 'Source Type' = 'Constant'
    • 'Source constant' = 'LanguageCode'. Replace LanguageCode by the language code as defined in the 'Extras > Options' dialog under the 'International | Default Language Settings' category (the language code is also shown in the 'Resources' editor of the 'Application' PLANT node). The selected value ('en' for English, 'de' for German) is written to the LanguageCode tag selected in the 'Destination variable' field when pressing the corresponding button at runtime.
    • 'Destination variable' = 'LanguageCode'

    If a button is pressed in the HMI visualization, the HMI text as entered in the language-code column in the 'Resources' table is read and displayed for the HMI object. In our example, the German text 'Es ist ein Fehler aufgetreten' is displayed for the text object when the user presses the 'German' button at runtime.