Versions Compared

Key

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

Overview

The Units Conversion interface helps convert different metrics, units, and measurement systems. This functionality already includes conversion tables for both Metric to Imperial and Imperial to Metric, but you can extend and modify them according to your requirements.

This feature allows two or more Client Displays connected to the same server to see the values and units on their own computers according to the metric currently selected for that operator station.This page presents information about Localization and Units. Localization allows the creation of translated texts so you can run your application in multiple languages. Units allows the the dynamic change of metric system when running the client displays. 

On this page:

Table of Contents
maxLevel3

Understanding Units Conversion

stylenone


Image Added

To configure a tag for unit conversion:

  1. Set the tag’s Units property. You can do this through the Unified Namespace / Tags table. You can also change it via CodeBehind or Scripts, by assigning a value to Tag.<TagName>.Units.
  2. To apply unit conversions to your solution, assign the name of the desired conversion table to the Client.Units property.
  3. All tags with units affected by the conversion table will have their values changed. To display the tag’s unit after conversion, use Tag.<TagName>.DisplayUnits.

Units Conversion Table Columns 

Property

Description

ID

Identifies each unit conversion entry uniquely.

VersionID

Tracks the version of the unit conversion entry.

BaseUnit

Represents the original unit of measurement before conversion.

NewUnit

Represents the unit of measurement after conversion.

Div

Indicates the division factor used in the conversion process.

Add

Indicates the addition factor used in the conversion process.

BaseName

Names the base unit.

NewName

Names the new unit after conversion.

DateCreated

Records the creation date and time of the unit conversion entry.

DateModified

Records the last modification date and time of the unit conversion entry.

MeasurementType

Specifies the type of measurement for the units involved, such as length or weight.

Configuring Units Conversion

Creating Layouts

Click..

Customizing Panels

Working with Units Conversion

Using Layouts

Properties Reference

Units Conversion properties

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:

  • Go to Displays→ Localization.

  • Click New.

  • The Create New Localization Dictionary window will display.

  • Enter a name for the dictionary.

  • Click OK.

  • 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.Dictionary to configure the dictionary or dictionary options for the user. When the dictionary changes, the language changes throughout the application.

The alarm messages can also be included in the localization if the related check-box is set.

On Project Settings → General, 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 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 project settings to have the application's target culture. 

Info

Find Detailed Docs Here: Themes

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:

Image Removed

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

Image Removed

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

Translate the column title of the DataGridWindow component

To translate the column title of the DataGridWindow component, it's noticed that this field does not have the locatable option and does not recognize Client.Locale() as a function.

Image Removed

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
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:

Image Removed



In this section:

Page Tree
root@parent
spacesV10