RUIPropertiesLibrary stereotype
You set up a Rich UI properties library (stereotype RUIPropertiesLibrary) if you wish to retrieve displayable text from external files rather than hard-coding the text in your Rich UI application. The overall mechanism is described in Use of properties files for displayable text. You can also use an implicit function in a Rich UI properties library to substitute values in any string.
Library myLibrary type RUIPropertiesLibrary {propertiesFile="myFile")
entryForInputRequired STRING;
entryForOthers STRING;
someText STRING;
end Any value assigned directly in a declaration (for example, someText
String = "Click!";) has no effect. Every runtime value comes
from an external file, with one exception: if the file does not include
a particular entry (for example, if the file does not include an entry
for someText), the value at run time is the string
equivalent of the variable name (for example, "someText").
propertiesFile property
- Path information such as "properties/myFile"
- Hyphens
- Translation-specific information such "en_US"
- The file extension, which is necessarily properties
The default value for propertiesFile is the name of the library; in this case, "myLibrary".
Function getMessage
someText=Promote {0} in the {1} departmentemployeeName, departmentName String;
employeeName = "Jeff";
departmentName = "Sales";
myLabel TextLabel {text =
myLibrary.getMessage(myLibrary.someText, [employeeName, departmentName]);myMessage STRING = "Promote {0} in the {1} department";
myLabel TextLabel {text =
myLibrary.getMessage(myMessage, [employeeName, departmentName]); getMessage(baseMessage STRING in, inserts STRING[] in) returns (fullMessage STRING);- baseMessage
- A string or a field in an RUI properties library.
- inserts
- An array of strings, with the first element providing an insert for the placeholder {0}, the second providing an insert for the placeholder {1}, and so on.
- fullMessage
- The base message with as many placeholders resolved as possible
employeeName STRING = "Jeff";
myMessage STRING = "Promote {0} in the {1} department";
myLabel TextLabel {text =
myLibrary.getMessage(myMessage, [employeeName]); You cannot use the function getMessage when overriding a validation or formatting message. You cannot pass inserts to such a message.