Message catalogs for each supported language are stored in the locale directory (Section 7.2), under their respective locale names. For example:
RWSF_HOME/ conf/ locale/ en_US/ messages_core_en_US.xml messages_agent_en_US.xml fr_FR/ messages_core_fr_FR.xml messages_agent_fr_FR.xml ...
Note that there are multiple files per locale -- one for each HydraExpress component.
Each message catalog consists of a simple XML document containing a collection of localized strings. For example:
<messages xmlns="http://www.roguewave.com/rwsf/messages"> <catalog locality="en_US" component="RWSF_CORE"> <entry name="INVALID_BASE64"> <message>Invalid base64 encoded character</message> </entry> <entry name="UNEXPECTED_ERROR"> <message>Unexpected Exception</message> </entry> </catalog> </messages>
When a message catalog is loaded, each message identifier is converted into a constant variable named <component>_<messageIdentifier>. For example, the catalog sample above creates constant variables RWSF_CORE_INVALID_BASE64 and RWSF_CORE_UNEXPECTED ERROR. You can use these variables when constructing localized strings (Section 7.4) to get compile time checks against typographical errors.
The identifier strings must only contain characters consistent with C++ identifiers [A-Za-z0-9_]. These strings should not be localized, and instead are used as keys for locating the localized message strings.
The message format also supports inserting dynamic content into messages. A %-delimited string is used to identify where named substitutions can occur. For example:
<messages xmlns="http://www.roguewave.com/rwsf/messages"> <catalog locality="en_US" component="RWSF_CORE"> <entry name="ILLEGAL_INDEX"> <message>Index (%1%) out of range [0->%2%]</message> </entry> </catalog> </messages>
When constructing a rwsf::LocalizedMessage to represent this message (Section 7.4), you can specify the values that should be associated with %1% and %2%. Note that since this mechanism uses numbered substitutions, you are free to re-order the substitution elements in localized strings. For instance:
<message>In range [0->%2%], %1% is invalid</message>
© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.