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.
On this page:
Table of Contents maxLevel 2 minLevel 2 indent 10px exclude Steps style none
Localization User Interface
Enable 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).
Configuration Settings
Global Localization Options
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
Creating Dictionaries
Setup Process
- Navigate to Displays → Localization
- Click New to create dictionary
- Name dictionary (e.g., "EN_PT", "EN_ES")
- Enable required localization options
- Click Load Strings to populate
- Enter translations or use auto-translate
Import Wizard Settings
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 |
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
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 |
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
- Plan Languages Early - Define requirements upfront
- Use Consistent Keys - Standardize original text
- Keep Text Separate - Avoid hardcoded strings
- Test All Languages - Verify layout with longest text
- Consider Culture - Format dates/numbers appropriately
- Document Context - Add descriptions for translators
- Update Regularly - Maintain dictionary synchronization
Language Switching Example
Implementation Steps
- Enable Localization
? Display Strings
? Alarm Messages
? System Messages
- Create Dictionary
- Name: "EN_PT"
- Load strings from displays
- Translate "Button" → "Botão"
- Runtime Switch
csharp
// In ClientStartup task
@Client.Localization = "EN_PT";
- 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
- Set API credentials
- Select source/target languages
- Click Translate button
- 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";
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"
.
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:
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'.
In this section...
Page Tree | ||||
---|---|---|---|---|
|