Previous Topic

Book Contents

Book Index

Next Topic

Localizing Messages

To translate a string to the currently selected language, call

Application.localizeMessage(BaseName, KeyId, Args)

The method performs translation of strings to the currently selected language.

BaseName – a relative path to the resource directory, e.g. resources\messages\. The path should be specified under the “text”. The “text_language.properties” is completed automatically according to the currently selected language.

KeyId – the internal name of the message as in the resources files, for example, “closeS3”. If the key you pass is not found in the resources file, it is returned unchanged.
Note: KeyId should always be used to identify the message string (as opposed to using a string directly) - see 'Message formatting problems' below for explanation.

Args – an optional array of arguments. The order numbers of the items in the array corresponds to the integer identifiers of variables in the resources.  For example, the message template in the properties can say “Unable to open catalog {0}”. To customize it, pass an array having a name of the given catalog (Person) as its first item (0). Then the message will be displayed in GUI, for example, as follows: “Unable to open catalog Person”.

Example - Localizing messages in Valuemation

We assume that you have run Valuemation and logged in correctly before starting this code. oVM variable now holds Application object. See Login Syntax for the section of the opening code.

’localizes the „accountNo“ title

MsgBox oVM.localizeMessage("bonames\BONames","Businesspart.accountNo",VbNullString)

Message formatting problems

Using KeyId ensures not only message localization but also an internal string adjustment which prevents formatting problems occurring when a message with parameters contains apostrophes.

Background information: Message formatting takes place when message parameters are passed to the localizeMessage method. The apostrophe is a significant character representing a section within the message pattern that will not be formatted. To correctly interpret the apostrophe as a text symbol, two apostrophes must be used.

Valuemation deals with this issue by adding an extra apostrophe to all single apostrophes found in message strings which contain parameters (and thus will be subject to the Java formatting method). However only message strings used via KeyId are corrected this way.

See Also

Setting Up Valuemation Environment

Writing Messages to the Log

Getting Valuemation Version

Information About the Running Platform

Memory Services

Main Parameters

User_Admin Mode

Selecting Language