Retrieving other text
You can store any kind of text in a message file, not just message text. For example, you might store text to place in labels or on push buttons, or you might store the replacement parameters for messages.
To retrieve the text, code an expression like:
aString := self getMRIString: aMsgId
group: aGroupSymbol.
where aMsgId is the symbolic constant from your pool dictionary, and aGroupSymbol is the name of your group that you specified in the NLS Workspace - Indexed Messages window.
A string containing the text is returned if the number is found; otherwise, you get a walkback.
To retrieve text that has replacement parameters, code an expression like:
aString := self getMRIString: aMsgId
group: aGroupSymbol.
aTotalString := aString replace: replaceParms.
where aMsgId and aGroupSymbol are the same as in the previous example and replaceParms is a collection of replacement parameters. A string containing the text is returned if the number is found; otherwise, nil is returned.
Now that you have accessed your text, you can set the appropriate attribute for your visual part. For example, to change a label, set its object attribute to the translated text.
Retrieving an indexed message for user interface elements can take a long time. So, you will likely want to retrieve indexed messages only when the user has to wait anyway. Using pool dictionaries is often faster than using indexed messages.
Adding message boxes using the NLS Workspace - Pool Dictionaries window covers how to put messages into pool dictionaries.
Last modified date: 05/14/2020