Creates a localizable message (see Localization Support) from a property resource.
Optionally, the property may specify placeholders for formatted arguments. The support and syntax for formatting is described in the JavaDoc for MessageFormat.
If you require to output XML or HTML, and do not require complex token formatting, or the ability to change message text without changing rules, consider using XmlMessage instead.
<?xml version="1.0" encoding="UTF-8"?> <RuleSet name="Example_ResourceMessage" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "http://www.curamsoftware.com/CreoleRulesSchema.xsd"> <Class name="Person"> <Attribute name="gender"> <type> <javaclass name="String"/> </type> <derivation> <specified/> </derivation> </Attribute> <Attribute name="isMarried"> <type> <javaclass name="Boolean"/> </type> <derivation> <specified/> </derivation> </Attribute> <Attribute name="firstName"> <type> <javaclass name="String"/> </type> <derivation> <specified/> </derivation> </Attribute> <Attribute name="surname"> <type> <javaclass name="String"/> </type> <derivation> <specified/> </derivation> </Attribute> <Attribute name="income"> <type> <javaclass name="Number"/> </type> <derivation> <specified/> </derivation> </Attribute> <!-- Returns a greeting which can be output in the user's locale --> <Attribute name="simpleGreetingMessage"> <type> <javaclass name="curam.creole.value.Message"/> </type> <derivation> <ResourceMessage key="simpleGreeting" resourceBundle="curam.creole.example.Messages"/> </derivation> </Attribute> <!-- Returns a greeting which contains the person's title and surname. The greeting and title are localized, the surname is not (it is identical in all locales). --> <Attribute name="parameterizedGreetingMessage"> <type> <javaclass name="curam.creole.value.Message"/> </type> <derivation> <!-- pass in arguments to the message placeholders --> <ResourceMessage key="parameterizedGreeting" resourceBundle="curam.creole.example.Messages"> <!-- Title --> <choose> <type> <javaclass name="curam.creole.value.Message"/> </type> <when> <condition> <equals> <reference attribute="gender"/> <String value="Male"/> </equals> </condition> <value> <ResourceMessage key="title.male" resourceBundle="curam.creole.example.Messages"/> </value> </when> <when> <condition> <reference attribute="isMarried"/> </condition> <value> <ResourceMessage key="title.female.married" resourceBundle="curam.creole.example.Messages"/> </value> </when> <otherwise> <value> <ResourceMessage key="title.female.single" resourceBundle="curam.creole.example.Messages"/> </value> </otherwise> </choose> <!-- Surname --> <reference attribute="surname"/> </ResourceMessage> </derivation> </Attribute> <!-- Formats a number to 2 decimal places, with decimal point and thousands separator in the user's locale --> <Attribute name="incomeStatementMessage"> <type> <javaclass name="curam.creole.value.Message"/> </type> <derivation> <ResourceMessage key="incomeStatement" resourceBundle="curam.creole.example.Messages"> <reference attribute="income"/> </ResourceMessage> </derivation> </Attribute> </Class> </RuleSet>
# file curam/creole/example/Messages_en.properties simpleGreeting=Hello parameterizedGreeting=Hello, {0} {1} title.male=Mr. title.female.single=Miss title.female.married=Mrs. incomeStatement=Income: USD{0,number,#0.00}
# file curam/creole/example/Messages_fr.properties simpleGreeting=Bonjour parameterizedGreeting=Bonjour, {0} {1} title.male=M. title.female.single=Mlle. title.female.married=Mme. incomeStatement=Revenue: EUR{0,number,#0.00}