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:
Enable different text elements for translation based on application requirements.
Table of Contents maxLevel 2 minLevel 2 indent 10px exclude Steps style none
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
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).
Setting | Translates | Location |
---|---|---|
Alarm Messages | Alarm text | Alarms → Items → Message |
Display Strings | UI text | Display objects with Localize enabled |
System Messages | Platform messages | System dialogs and prompts |
Enable at Displays → Localization → Enable Localization
Field | Description | Example |
---|---|---|
Source Language | Original language | English |
Target Language | Translation target | Portuguese |
Load Strings | Import enabled strings | All checked items |
Translate | Use online service | Azure/Google/Libre |
csharp
// Method 1: Direct assignment
@Client.Localization = "EN_PT";
// Method 2: Using method
@Client.SetLocalization("EN_ES");
// Check current dictionary
string current = @Client.Localization;
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
Property | Description | Type |
---|---|---|
ID | Unique identifier | Auto |
OriginalText | Source string | String |
TranslatedText | Target translation | String |
Disabled | Skip translation | Boolean |
DateCreated | Creation timestamp | DateTime |
DateModified | Last edit time | DateTime |
Description | Translation notes | String |
When Display Strings enabled:
For selective translation:
csharp
// Translate specific string
string translated = @Client.Locale("Original Text");
// In display binding
<TextBlock Text="{Client.Locale('Hello World')}" />
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);
}
}
? Display Strings
? Alarm Messages
? System Messages
csharp
// In ClientStartup task
@Client.Localization = "EN_PT";
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";
csharp
// US: 1,234.56
@Client.CultureInfo = "en-US";
// European: 1.234,56
@Client.CultureInfo = "de-DE";
Text not translating:
Wrong formatting:
Missing strings:
Layout issues:
csharp
// Load dictionary from database
DataTable dict = @Dataset.Query.Translations.SelectCommand();
@Client.LoadDictionary(dict);
csharp
// Try primary, then fallback
string text = @Client.Locale("Key") ??
@Client.Locale("Key", "EN") ??
"Default Text";
You can create multiple dictionaries and switch between them at runtime by simply setting the dictionary name.
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.
You can localize the text in your application in as many languages as needed. To do this, create a dictionary for each language.
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"
.
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:
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'.
Page Tree | ||||
---|---|---|---|---|
|