Switching the Current Language

Language Selector

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.

Selecting a Language in the Client

Once you have the Language Selector component setup, it's super easy to select and switch between languages in the Client. There is no binding involved in selecting a language because they are compared directly against the Translation Manager database. All matching terms are automatically translated.

There are three ways simple ways to select a preferred language once the translation terms are created:

  1. Add a Language Selector on your window in the Designer. After you Save and Publish your project, open the Client, and the Language Selector will be visible so you can switch between languages on the fly.

    images/download/attachments/7078590/Client_Window_3.png

  2. Once you create a second language, the Client Login Screen will automatically display a Language Selector where you can select your preferred language. There is Project Property setting that allows you to Show or Hide the Language Selector at login. By default, it is set to Automatic so you will see the Language Selector at login when two or more languages are created unless you choose to hide it.

    images/download/attachments/7078590/Client_Login_Screen_2.png

  3. If a user that has a preferred language selected in their user profile settings, Ignition will login to the Client with their preferred language automatically. No Language Selector component is necessary. This is especially cool if your company is using Active Directory which automatically logs you in and opens the Client in your preferred language.

  4. You can also set the set the client language with the system.util.setLocale() function.
    This function takes an ISO 639-1 two-letter code for the language to use (for example, "en", "fr", "de", "es", and so on).

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. This is especially useful for message boxes and other warnings or errors that you show in your scripts.

System Considerations During Translation

Inherent operating 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.