pp108 : localization_translateXML

localization_translateXML

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

Syntax

Script

localization_translateXML(<XMLDocument>)

Parameters

Parameter

Description

XMLDocument

XML which has the text node to be translated.

Return Value

Returns an XML object with translated text node.

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 (translations) are stored in a translation file with a .mlm extension (Multi Language Mapper).

When the localization_translatexml() method is executed in the given XMLDocument, it searches for the xml node which has the translatable=true attribute set and gets the corresponding text node. It searches in the message bundle of the XForm for the specified text node value, and retrieves the translation of the string. If a matching string is found, it returns the XML with the translated strings in it. If no matching string is found, it returns the XML that was sent as input.

Process Platform also 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 that may display in the XForm at runtime.

Note:
You can achieve internationalization of an XForm (CAF page) by specifying the language code in its URL when opening it. Consider the following 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_translatexml method is called in an XForm with a sample xml.

<xml id="selectAppDefinition">
	<Application>
		<description translatable="true">Select Version</description>
		<caption translatable="true">Select Version</caption>
		<url>/cordys/com/cordys/cap/runtime/selectversion.caf</url>
		<id>selectAppDefinition</id>
		<frame features="dialogHeight:95%;dialogWidth:70%;"/>
	</Application>
</xml>
localization_translatexml(selectAppDefinition.XMLDocument.documentElement);

See Also

localization_makeCompositeText()