|
|
As noted in ``Internationalization''' the X/Open messaging interface is the de facto standard throughout much of Europe, so you can generally count on wider support for it than for the SCO OpenServer-specific version. The principal difference between the interfaces lies in where your message files, or message catalogs, to use the X/Open terminology, are located on the target system. SCO OpenServer-specific message files must be installed in the standard place. X/Open message catalogs can be installed anywhere on the system, which means that programs must search their environments for the location of message catalogs at run time.
Users specify message catalog search paths with the NLSPATH environment variable. The value of NLSPATH is used by the function catopen to locate the message catalog named in its first argument. Users will almost always find it convenient to use the ``%L'' and ``%N'' substitution fields when setting NLSPATH:
$ NLSPATH="%L/%N" export NLSPATHIn this example, the value of the LC_MESSAGES locale category is substituted for ``%L''. The value of the first argument to catopen is substituted for ``%N''. So if the name of the catalog given to catopen is progmsgs, and if the environment variable LC_MESSAGES is set to french, then the value of NLSPATH would be /usr/lib/locale/french/LC_MESSAGES/progmsgs on a SCO OpenServer implementation. For more on NLSPATH, see the catopen(S) manual page.
The call to catopen would look like:
nl_catd catd; catd = catopen("progmsgs", 0);where catopen and the type nl_catd are defined in the header <nl_types.h>. catd is a message catalog descriptor that can be passed as an argument to subsequent calls of the catgets and catclose functions. We will look at catgets in the next section; catclose closes the message catalog identified by catd. The second argument to catopen is not used by implementations currently and should be set to 0.