|
|
mkcatdefs also writes the message source data, with numbers instead of symbolic identifiers, to the standard output. This output is suitable for use as input to gencat(CP).
With option -a, mkcatdefs appends @archive to the name of the message catalog defined in sym_name_msg.h (the MF_PROG macro). This indicates that the message catalog is to be found under an archive directory, archive, where a number of related message catalog files are stored.
The -h option suppresses the generation of a _msg.h file.
The -s option causes mkcatdefs to generate a _msg.sh file, suitable for inclusion in Bourne or Korn shell scripts that use dspmsg(C) to print locale-dependent messages.
Programs that use message catalogs print messages by using a message ID number as an index into a message catalog. (Messages are stored, one per line, in the catalog file.) By substituting a translated message catalog, the program can be made to print messages in a different language without being recompiled.
It is easier for a human programmer to work with symbolic message names than raw message ID numbers. Consequently, a message file source_file is used to link symbolic message names to message catalog numbers. mkcatdefs reads the source_file; it creates a _msg.h or _msg.sh that is sourced into the program using the message catalog. When the program encounters a symbolic name defined in source_file, it dereferences the symbolic name to an appropriate message number, then dereferences the message number to a message in the message catalog.
The minimal localization system only accepts numbers as references to messages in the message catalog (hence the provision of mkcatdefs). The SCO OpenServer system additionally permits you to use alphanumeric identifiers. Alphanumeric identifiers may be assigned to sets and messages in the same manner as numerical identifiers.
$ @(#) prog.msg 25.1 93/12/07 $quote " $set MS_PROG PROG_MSG_ST_USAGE "usage: settime [-f file | mmddhhmm[yy]] file ...\n" PROG_MSG_TO_USAGE "usage: prog [-acm] \ [-r ref_file | -t [[CC]YY]MMDDhhmm[.SS]] file ...\n" PROG_MSG_TO_USAGE2 " prog [-acm] [MMDDhhmm[yy]] file ...\n" PROG_ERR_NOREF "Cannot stat reference file %s" PROG_MSG_ILL_DATE "Invalid date specifier %s" PROG_MSG_NOCR "cannot create %s" PROG_MSG_NOST "cannot stat %s" PROG_MSG_NCT "cannot change times on %s"To process this file, issue the command:
This produces the following output file prog_msg.h:
#ifndef _H_PROG_MSG #define _H_PROG_MSG #include <limits.h> #include <nl_types.h> #define MF_PROG "prog.cat@archive" #ifndef MC_FLAGS #define MC_FLAGS NL_CAT_LOCALE #endif #ifndef MSGSTR extern char *catgets_safe(nl_catd, int, int, char *); #ifdef lint #define MSGSTR(num,str) (str) #define MSGSTR_SET(set,num,str) (str) #else #define MSGSTR(num,str) catgets_safe(catd, MS_PROG, (num), (str)) #define MSGSTR_SET(set,num,str) catgets_safe(catd, (set), (num), (str)) #endif #endif /* The following was generated from */ /* prog.msg */The message source data, with message numbers, written to the standard output by the preceding command is:
#define MS_PROG 1 #define PROG_MSG_ST_USAGE 1 #define PROG_MSG_TO_USAGE 2 #define PROG_MSG_TO_USAGE2 3 #define PROG_ERR_NOREF 4 #define PROG_MSG_ILL_DATE 5 #define PROG_MSG_NOCR 6 #define PROG_MSG_NOST 7 #define PROG_MSG_NCT 8 #endif /* _H_PROG_MSG */
1 "usage: settime [-f file | mmddhhmm[yy]] file ...\n" 2 "usage: prog [-acm] \ [-r ref_file | -t [[CC]YY]MMDDhhmm[.SS]] file ...\n" 3 " prog [-acm] [MMDDhhmm[yy]] file ...\n" 4 "Cannot stat reference file %s" 5 "Invalid date specifier %s" 6 "cannot create %s" 7 "cannot stat %s" 8 "cannot change times on %s"