Versions Compared

Key

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

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
maxLevel3
stylenone

Tip
titleSolution Example

Localization Example



Image Added

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).

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. 

Info

To localize the user interface text, be sure to select the Localizable option (Dynamics Configuration window, TextOutput options) for each display component that you need to localize.

To create a localization dictionary:

Create a Dictionary

  • Go to Displays → Localization.
  • Click New.
  • The Create New Localization Dictionary window will display.
  • Enter a name for the dictionary.
  • Click OK.
  • Click After selecting the Enable Localization (Global Solution Setting), click Load Strings to populate the table with all the controls that have strings that are set to Localizable. In the TranslatedText column, enter the text in the dictionary language .Create controls in a display or write a script to use the object called Client.Dictionaryto configure the dictionary or dictionary options for the user. When the dictionary changes, the language changes throughout the application.(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 / The alarm messages can also be included in the localization if the related check-box is set.On 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

This particular example is a special case of language switching because it involves language change linked with reference tags.

  • Reference Tags function in the same way as the Tag being referenced, regardless of receiving different objects, with different descriptions and different enumeration sets. To ensure that the conversion will occur correctly in the FullDescription and ValueAsString properties, you must ensure that the Reference Tag is pointing to the desired object. You can use the syntax below in DisplayOpening in CodeBehind: @Tag.<ReferenceTagName>.Link = @Tag.<TagName>.GetName();

  • In texts marked as Locatable in Symbols that are appearing in Dictionaries / Location, you should make sure that the texts are being passed for translation.

To add to the Dictionary the properties of all tags that can be associated with the reference tag that is being used in the display, follow the practical example.

Image Removed

If the reference tag is not automatically loaded in the Dictionary when clicking on the Locatable option and is not being translated from one language to another on the screen, follow the steps below:

  • Add the method Client.Locale(Tag.xxx) on the Expression field of your TextBlock, to translate it to the current Client.Localization:

  • On the En_US dictionary, create one row for each TextBox you want to translate, containing the original text (in Spanish) and the Translated Text (in English).

This procedure should work for every reference tag you have in your solution.

Translate the column title of the DataGridWindow component

To translate the column title of the DataGrid component, it's noticed that this field does not have the locatable option and does not recognize Client.Locale() as a function..To translate column titles in a DataGrid, a script must be created.

The method below iterates for each column in the data grid and applies the @Client.Locale function to them. After the loop, the DataGrid is updated.

Code Block
languagec#
public void gridcolumntitle(){
        TDataGridWindow grid=this.CurrentDisplay.GetDataGrid("grid") as TDataGridWindow;
        foreach (GridColumn col in grid.Columns)
      {
       col.Title=@Client.Locale(col.Title);
       }
       grid.DoRefresh();
    }

To avoid overloading the client and maintain efficiency, the gridcolumntitle() method should only be called if the @Client.Localization has changed:

Code Block
languagec#
public void DisplayIsOpen()
{
	if(!@Client.Localization.Equals(aux))
	{
		gridcolumntitle();
		aux=@Client.Localization;
	}
}

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:

  1. 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 Added

    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.


  2. 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'.

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

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
  1. .


In this section:

Page Tree
root@parent
spacesV10