pp108 : localization_get()

localization_get()

This is a default method available for all the XForms. It enables you to translate strings to the language in which the XForm is currently being displayed.

Syntax

Script

localization_get(textidentifier)

Parameters

Parameter

Description

textidentifier

Required. The textidentifier for the message.

Return Value

Returns a TranslatableText object, which retrieves the translated string at the runtime.

Remarks

Process Platform XForms supports the translation feature that enables the internationalization of XForms. Using this feature, you can translate and view the labels on an XForm in any desired language. You can specify the various languages to be used and translate the labels in those languages. These definitions or translations are stored in a translation file with a .mlm (Multi Language Mapper) extension.

When the localization_get() method is executed, it searches for the dictionary of the XForm, identifies the string using the specified textidentifier, and retrieves the translation of the string. If a matching string is found, it returns the string. If a matching string is not found, it returns the string that was sent as an input.

Process Platform provides a translation service for each XForm, using which you can set the equivalent translation of each label. Use the Messages tab to add the required translation strings for messages such as alerts, prompts, and notifications that may be displayed in the XForm at the runtime.

NOTE: You can achieve internationalization of an XForm by specifying the language code in its URL when opening it. Consider the below sample URL that defines the language code 'nl-NL' :

<url>/test/test1/languagepage.caf?language=nl-NL</url>

Examples

The following code demonstrates how the localization_get method is called in an XForm:

alert(localization_get("This is a translated string"));

The following code demonstrates the translation of a message, according to the current language settings of an XForm:

var bResult = window.prompt(localization_get("Are you sure you want to quit the page?"));

The following code demonstrates the translation of the title of an XForm:

function Form_InitDone(eventObject) { //title of the application is translated here application.container.setTitle(localization_get("Title")); }

If the string contains insertions like {0} ,{1}, you can use the localization_makeCompositeText() method.

See Also

localization_makeCompositeText()