Examples

This section discusses the options on how to create a message catalog from a source file.

Often begins with a definition, answering the question, "What is this?"

  • This example shows how to create a message catalog from a source file containing message identification numbers. The following is the text of the hello.msg message source file:
    $ file: hello.msg
    $set 1    prompts
    1 Please, enter your name.
    2 Hello, %s \n
    $ end of file: hello.msg
    To create the hello.cat message catalog from the hello.msg source file, type:
    gencat hello.cat hello.msg
  • This example shows how to create a message catalog from a source file with symbolic references. The following is the text of the hello.msg message source file that contains symbolic references to the message set and the messages:
    $ file: hello.msg
    $quote "
    $set PROMPTS
    PLEASE  "Please, enter your name."
    HELLO   "Hello, %s \n"
    $ end of file: hello.msg
    To process the hello.msg and msgerrs message source files, type:
    runcat hello hello.msg
    runcat msgerrs msgerrs.msg /usr/lib/nls/msg/$LANG/msgerrs.cat
    The runcat command invokes the mkcatdefs and gencat commands. The first call to the runcat command takes the hello.msg source file and uses the second parameter, hello, to produce the hello.cat message catalog and the hello_msg.h definition file.

    The hello_msg.h definition file contains symbolic names for the message catalog and symbolic IDs for the messages and sets. The symbolic name for the hello.cat message catalog is MF_HELLO. This name is produced automatically by the mkcatdefs command.

    The second call to the runcat command takes the msgerrs.msg source file and uses the first parameter, msgerrs, to produce the msgerrs_msg.h definition file.

    Because the third parameter, /usr/lib/nls/msg/$LANG/msgerrs.cat, is present, the runcat command uses this parameter for the catalog file name. This parameter is an absolute path name that specifies exactly where the runcat command must put the file. The symbolic name for the msgerrs.cat catalog is MF_MSGERRS.