To accommodate a user's language, a program must display titles, menu choices, and status messages in that language. Usually such text is stored in a message catalog or resource file, separate from program code, so it may be easily edited or replaced. Tools.h++ does not display titles or menus directly, but does return status messages when errors occur. By default, Tools.h++ makes no attempt to localize these messages. Instead, it provides an optional facility that allows error messages to be retrieved from your own catalog.
The facility can be used in one of four modes:
Mode | Define |
No messaging | RW_NOMSG |
Use catgets() | RW_CATGETS |
Use gettext() | RW_GETTEXT |
Use dgettext() | RW_DGETTEXT |
These localization techniques and their documentation are specific to your platform. Once you discover what your system provides, you specify that mode for Tools.h++ by setting the appropriate switch in <rw/compiler.h> before compiling the library. If you have object code, this choice has already been made for you.
Function catgets() uses both a message set number and a message number within that set to look up a localized version of a message. The number for the message set to use is defined in the macro RW_MESSAGE_SET_NUMBER found in <rw/compiler.h>. Function gettext() uses the message itself. The messages and their respective message numbers are given in Appendix C.
You will find information on using catgets(), gettext(), and dgettext()in the documentation that comes with your compiler.