Localization in Ignition

Localization allows you to translate text to multiple languages. The user can choose which language their Client displays. Text contained in components, that have their properties correctly mapped with localization, will change to reflect the language the user has selected. The Language Selector component is a dropdown list that displays the language options for these translations.

A central term database and support is built into all component text properties, as well as other text-based properties, such as alarm messages. Aside from defining translations for terms, there is usually no other work needed to take advantage of the translation system.

Translation Database and Term Lookup

All translations are stored centrally in the Gateway and are distributed to each Client and Designer. All projects share the same translations, and those translations can be used in other locations, such as Gateway scripts, and alarm messages. Terms are referenced in the translation database using direct string comparison. The term Keys belong to the "base language", which by default is English. The English key will return if no match is found for the requested language. It is possible to define an alternate "translation" for the base language. The base term may be a user-readable string, such as "Start", or a special code, such as "START_COMMAND", which would have an "alternate translation" defined for "Start."

The full translation database can be viewed and edited in the Translation Manager panel located in the Designer. The translation manager allows you to import and export a translation database. It also has the ability to define new languages.

Global and Component Scopes

The translation database and term lookup rely on two different scopes for term lookup: global scope and component scope.

Global Scope

A single language selector on a window has the potential to trigger translations on all windows. This way a single language selector component can exist on a navigation window and provide language translations for all components on all windows.

Component Scope

The component scoped translation terms can display special translations that may be more relevant to the given context of the translation. For example, if the English language has one word that shares meaning between context while the alternate language has two words that differentiate between the two context then the component level translation may be appropriate. If the component level translation is not configured on the component then the translation term is automatically taken from the global scope. Component level translation will reflect on all components that occur on a single window. Component level translations does not encompass terms beyond the window on which they are configured.

Expression and Scripting Functions

You can look up translations using the following functions:

  • Expression Function
    translate()

  • Scripting Functions
    system.util.translate()
    system.util.modifyTranslation() scripting functions.

Translations are matched by looking for the base language value in the translation database.

System Considerations During Translation

Inherent o perating system and Java configurations may affect Ignition's ability to provide a complete translation in certain circumstances.

For example, suppose a user has selected the Spanish option from their Language Selector component. An English to Spanish translation term exist for the word "Information" as well as "Start." The message box script takes two parameters: one for the content while the other parameter is optional. If the second parameter is not included in the function then the resulting title of the message box will include the English word "Information." The following code is executed on a button clicked event handler.

message = system.util.translate("Start")
system.gui.messageBox(message)

What results is a message box with a translated content while the title remains in English. In addition, the accept button is translated as well even though the English word for "OK" does not exist in the Translation manager. This is due to the system level translations that exist for inherent language support.

A similar occurrence exist with the file open dialog window. The following code is executed on a button clicked event handler.

system.file.openFile()

The result is a translation for the title as well as the open and cancel buttons while the references to the "File Name" and the "Files of Type" remain in the operating system's language and thus are beyond the scope of Ignition's ability to translate.

Similar occurrences will appear in print and error dialog boxes.

Previewing Translations

You can preview the translations in the Designer with the preview mode in several ways. Using the Language Selector Component or scripting will temporarily change the current language, but the language will revert back to the base language (which is normally English) when preview mode is disabled. To change the preferred language for preview mode, use the Preview Language menu item under the Project menu in the Designer. This selection will persist even after preview mode is disabled and will persist when the Designer is restarted. Currently, you can not define translations while displaying in a different language.

In this section ...