Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Displays Localization (Reference) enables multi-language support for HMI applications, allowing runtime language switching with automatic translation of display strings, alarm messages, and system text. 

Localization provides:

  • Multiple language dictionaries
  • Runtime language switching
  • Automatic string import
  • Online translation services
  • Culture-specific formatting
  • Component-level control

Enable different text elements for translation based on application requirements

Overview

Localization in applications enables operators using remote displays to interact with the interface in their selected language. This feature allows for defining translations in the configuration settings and applying the chosen language in the client through the @Client.Localization property or the @Client.SetLocalization method. Localization enhances the accessibility and usability of applications for a global audience, ensuring that cultural and language differences do not hinder the user experience

.

On this page:

Table of Contents
maxLevel2
minLevel

3

2

style

indent

none

10px

tip

exclude

title

Steps

Solution Example

style

Localization Example

none


Image Modified


Configuration Settings

Global Localization

User InterfaceEnable Localization(Global Solution Setting)

Enabling this option allows these fields to be translated. For example, strings in Display will only be translated if 'Display Strings' is enabled, even if the string exists in the table.

Enable Localization (Global Solution Setting)

Alarm messages

String in Alarms > Items > Message column

Display strings

All strings in objects with Localize enabled in Draw

System messages

System messages related.

Import Strings Wizard

Import Strings Wizard

Source Language

The original language of the content to be translated. (It will be used for automatic translation)

Target Language

The language into which the content will be translated. (It will be used for automatic translation)

Load String

Depending on what is checked in 'Enable Localization', all related fields will be automatically imported.

Translate

All imported fields will be translated using an online service (Azure, Google, or Libre).

Dictionaries

You can create multiple dictionaries and switch between them at runtime by simply setting the dictionary name.

Displays Localization Configuration Table

Displays Localization Configuration Table

Property

Description

ID

Identifies each localization entry uniquely.

VersionID

Tracks the version of the localization entry.

OriginalText

Displays the original text before translation.

Disabled

Indicates if the localization entry is disabled.

TranslatedText

Shows the text after translation.

DateCreated

Records the creation date and time of the localization entry.

DateModified

Records the last modification date and time of the localization entry.

Description

Provides a description of the localization entry.

Configuring Display Localization

You can localize the text in your application in as many languages as needed. To do this, create a dictionary for each language. 

Create a Dictionary

  • Go to Displays → Localization.
  • Click New.
  • After selecting the Enable Localization (Global Solution Setting), click Load Strings to populate the table. In the TranslatedText column, enter the text in the dictionary language (or use the online service translation mentioned above in Translate).
  • The language can be set in rutime with the code below:
    @Client.Localization = "<DictionaryName>";
    @Client.SetLocalization("<DictionaryName>");

CultureInfo

In Solution / Settings, you can define the default Culture Information that the application is using. The runtime property Client.CultureInfo allows you to change it during runtime. Some display controls such as Calendars, may get the Culture Info directly from the Operating System. In this situation, the correct procedure is for both the Operating System settings and the solution settings to have the application's target culture. For example, to change the Culture Info to Portuguese (Brazil): @Client.CultureInfo = "pt-BR".

Options

SettingTranslatesLocation
Alarm MessagesAlarm textAlarms → Items → Message
Display StringsUI textDisplay objects with Localize enabled
System MessagesPlatform messagesSystem dialogs and prompts

Enable at Displays → Localization → Enable Localization


Creating Dictionaries

Setup Process

  1. Navigate to Displays → Localization
  2. Click New to create dictionary
  3. Name dictionary (e.g., "EN_PT", "EN_ES")
  4. Enable required localization options
  5. Click Load Strings to populate
  6. Enter translations or use auto-translate

Import Wizard Settings

FieldDescriptionExample
Source LanguageOriginal languageEnglish
Target LanguageTranslation targetPortuguese
Load StringsImport enabled stringsAll checked items
TranslateUse online serviceAzure/Google/Libre

Runtime Language Switching

Set Active Dictionary

csharp

// Method 1: Direct assignment
@Client.Localization = "EN_PT";

// Method 2: Using method
@Client.SetLocalization("EN_ES");

// Check current dictionary
string current = @Client.Localization;

Culture Information

csharp

// Set culture for formatting
@Client.CultureInfo = "pt-BR";  // Portuguese (Brazil)
@Client.CultureInfo = "en-US";  // English (US)
@Client.CultureInfo = "de-DE";  // German (Germany)

Configure default at Solution → Settings → Culture Info


Localization Table Properties

PropertyDescriptionType
IDUnique identifierAuto
OriginalTextSource stringString
TranslatedTextTarget translationString
DisabledSkip translationBoolean
DateCreatedCreation timestampDateTime
DateModifiedLast edit timeDateTime
DescriptionTranslation notesString

Component Localization

Automatic Translation

When Display Strings enabled:

  • All display text auto-translates
  • No code required
  • Uses active dictionary

Manual Translation

For selective translation:

csharp

// Translate specific string
string translated = @Client.Locale("Original Text");

// In display binding
<TextBlock Text="{Client.Locale('Hello World')}" />

Custom Components

Components requiring special handling:

ComboBox Items:

csharp

public void LocalizeComboBox(ComboBox combo)
{
    foreach(var item in combo.Items)
    {
        item.Text = @Client.Locale(item.Text);
    }
}

DataTable Headers:

csharp

public void LocalizeTable(DataTable table)
{
    foreach(DataColumn col in table.Columns)
    {
        col.Caption = @Client.Locale(col.Caption);
    }
}

Best Practices

  1. Plan Languages Early - Define requirements upfront
  2. Use Consistent Keys - Standardize original text
  3. Keep Text Separate - Avoid hardcoded strings
  4. Test All Languages - Verify layout with longest text
  5. Consider Culture - Format dates/numbers appropriately
  6. Document Context - Add descriptions for translators
  7. Update Regularly - Maintain dictionary synchronization

Language Switching Example

Implementation Steps

  1. Enable Localization
   ? Display Strings
   ? Alarm Messages
   ? System Messages
  1. Create Dictionary
    • Name: "EN_PT"
    • Load strings from displays
    • Translate "Button" → "Botão"
  2. Runtime Switch

csharp

   // In ClientStartup task
   @Client.Localization = "EN_PT";
  1. Result
    • Original: "Button"
    • Display: "Botão"

Culture-Specific Formatting

Date/Time

csharp

// US Format: 3/15/2024
@Client.CultureInfo = "en-US";

// European: 15/03/2024
@Client.CultureInfo = "fr-FR";

// ISO Format: 2024-03-15
@Client.CultureInfo = "invariant";

Numbers

csharp

// US: 1,234.56
@Client.CultureInfo = "en-US";

// European: 1.234,56
@Client.CultureInfo = "de-DE";

Translation Services

Supported Providers

  • Azure Translator - Microsoft service
  • Google Translate - Google API
  • LibreTranslate - Open source

Configuration

  1. Set API credentials
  2. Select source/target languages
  3. Click Translate button
  4. Review and adjust results

Troubleshooting

Text not translating:

  • Verify dictionary active
  • Check localization enabled
  • Confirm string in dictionary
  • Review component settings

Wrong formatting:

  • Check CultureInfo setting
  • Verify OS regional settings
  • Test with different cultures

Missing strings:

  • Click Load Strings again
  • Check all sources enabled
  • Review new/modified displays
  • Update dictionary

Layout issues:

  • Test with longest translations
  • Allow controls to auto-size
  • Consider text direction (RTL)
  • Verify font support

Performance Considerations

Dictionary Loading

  • Load at startup
  • Cache in memory
  • Minimize switches
  • Preload all needed

String Lookup

  • Use consistent keys
  • Avoid runtime concatenation
  • Cache frequently used
  • Batch translations

Advanced Features

Dynamic Dictionary Loading

csharp

// Load dictionary from database
DataTable dict = @Dataset.Query.Translations.SelectCommand();
@Client.LoadDictionary(dict);

Fallback Languages

csharp

// Try primary, then fallback
string text = @Client.Locale("Key") ?? 
              @Client.Locale("Key", "EN") ?? 
              "Default Text";




In this section...

Page Tree
root@parent
spaces93DRAF

Language Switching Example

For an example on how to switch the language of a solution, check out Localization Solution. In summary, there are some things to look for when preparing your solution's localization:

Most of the components on display can be translated by changing the property @Client.Localization or using the method @Client.SetLocalization, as described above. If you want to translate just some strings but not all, you can use @Client.Locale method. For example, to localize a TextLabel component:
Image Removed

Note

When you enable Display Strings, you don't need to use the @Client.Locale method, all strings in the display will be automatically translated.

  • A dictionary named 'En_pt' was created with "Display strings" enabled. It translates the word 'Button' to 'Botão'. In the Task ClientStartup the following code is executed:

    Code Block
    @Client.Localization = "En_pt";

    In Draw, we have a button with the original Label Text 'Button'. However, since we used the dictionary and set a new language, it now displays 'Botão'.

  • Custom methods must be set up in order to localize components like ComboBoxes and DataTables. The Localization Solution page describes this process in detail.
  • In this section:

    Page Tree
    rootV10:@parent
    spacesV10