Localization

Realsoft 3D supports localization. Instead of hardcoding all strings into your source code, define a set of string ids and a corresponding strings name-value pairs, as follows:

#include <oops/r3locale>

/* string ids */
enum {
    MYS_TOOL,
    MYS_TOOL_TIP
};

static R3LOCALE *l, locale[] = {
    {"Tool", "Tool"},
    {"ToolTip", "Create something"},
};

Then in your class registration function, open the locale database by calling:

    l = R3AppOpenLocale(app, R3MODULENAME, R3CLASSNAME, locale, R3NumArrayElements(locale));

Remember also to close the locale:

    case R3RCM_FREECLASS:
        if (cl == obj)
            R3AppCloseLocale(app, l, R3NumArrayElements(locale));
        break;

And then you can fetc strings using R3STR() macro. For example, to create a button, with a label and a tool tip:

    /* create a button with a label and a tool tip */
    button = R3New(R3CLID_BUTTON,
                   R3GA_Text, R3STR(l, MYS_TOOL),
                   R3GA_ToolTip, R3STR(l, MYS_TOOL_TIP),
	           ....

and these strings can be localized in r3locale/[language]/[libraryname].ini files, as follows:

[filename]
Tool=...
ToolTip=....