catopen and catclose (X/Open)

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 UnixWare-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. UnixWare-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 NLSPATH
In 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 UnixWare implementation. For more on NLSPATH, see the catopen(3C) 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.
Next topic: gencat and catgets (X/Open)
Previous topic: exstr and srchtxt (UnixWare-specific)

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004