mkmsgs(1) mkmsgs(1)
NAME
mkmsgs - create message files for use by gettxt (make messages)
SYNOPSIS
mkmsgs [-i locale] [-o] inputfile msgfile
DESCRIPTION
mkmsgs creates a file of text strings that can be accessed by the text
retrieval tools gettxt(1), srchtxt(1) and exstr(1) and the C function
gettxt(3C). The input to mkmsgs consists of an editable file of text
strings in a language based on a particular geographic locale [see
setlocale(3C)]; the output file contains the same text strings, but in
a format that can be retrieved by both gettxt and gettxt(3C). mkmsgs
sequentially transforms and copies the strings from the input file to
the output file.
OPTIONS
No option specified:
msgfile is installed in the current directory.
-i locale
The -i option is intended for the system administrator only.
locale represents the native language in which the strings in
inputfile are written. The value given to locale must subse-
quently be assigned to the environment variable LCMESSAGES or
LANG so that the file can be accessed by gettxt(3C) (see EXAM-
PLES). A message file named msgfile which gettxt(1) and
gettxt(3C) can read will then be created in the directory
/usr/lib/locale/locale/LCMESSAGES, where your specified locale
defines the basename of the directory /usr/lib/locale/locale.
Only the system administrator or a member of the group bin can
create or overwrite files in this directory. If the directory
which you name as locale does not exist under /usr/lib/locale, it
will be created.
Non-privileged users are not permitted to create directories
under /usr/lib/locale or files under
/usr/lib/locale/locale/LCMESSAGES.
-o msgfile will be overwritten if it already exists.
inputfile
File containing the original text strings that mkmsgs is to con-
vert. Each string must be entered in a separate line. Non-graphic
characters must be represented as alphabetic escape sequences,
such as \t for a tab or \n for a newline (as with the printf(3S)
function in C). Octal representations in the form \nnn are also
permitted. The null string can be represented as an empty line.
Page 1 Reliant UNIX 5.44 Printed 11/98
mkmsgs(1) mkmsgs(1)
Strings can be changed by editing the file inputfile with any
editor. Existing strings may be overwritten, but new strings must
be added to the end of the file. If you modify inputfile, you
must create a new msgfile file and install it at the correct
position in the file tree, i.e. under
/usr/lib/locale/locale/LCMESSAGES. This allows the gettxt com-
mand or the text retrieval function gettxt(3C) to access the mes-
sage file when LCMESSAGES (or LANG if LCMESSAGES is undefined)
is set to the value of locale. If this procedure is not followed,
the gettxt(3C) function will retrieve the wrong string, and
software compatibility between different versions will be broken.
LOCALE
The LCMESSAGES environment variable governs the language in which
message texts are displayed. If LCMESSAGES is undefined or is defined
as the null string, it defaults to the value of LANG. If LANG is like-
wise undefined or null, the system acts as if it were not internation-
alized.
The LCALL environment variable governs the entire locale. LCALL
takes precedence over all the other environment variables which affect
internationalization.
EXAMPLES
Example 1
The following strings appear in the input file C.str:
File %s:\tcannot be opened\n
%s: Bad directory\n
.
.
.
Write error\n
.
.
The following invocation of mkmsgs uses the input strings from C.str
to create text strings in the appropriate format in the message file
UX in the current directory:
$ mkmsgs C.str UX
This next invocation uses the input strings from FR.str to create text
strings in the appropriate format in the file UX in the directory
/usr/lib/locale/french/LCMESSAGES:
$ mkmsgs -i french FR.str UX
If you set the environment variable LCMESSAGES=french, the text
strings in /usr/lib/locale/french/LCMESSAGES/UX can be accessed with
the gettxt command or the C function gettxt(3C).
Page 2 Reliant UNIX 5.44 Printed 11/98
mkmsgs(1) mkmsgs(1)
Example 2
The following files are present:
Contents of inputfile1:
Hallo !\n\007
Gute\t... Nacht !\n
Guten Morgen !\n
Contents of inputfile2:
Salut !\n
Bonne nuit !\n
The message files are created and installed as follows:
The directories /usr/lib/locale/german/LCMESSAGES and
/usr/lib/locale/french/LCMESSAGES do not exist. The system adminis-
trator therefore gives the following command to create the directory
/usr/lib/locale/german with a file named hallo in it.
$ mkmsgs -i german inputfile1 hallo
The command:
$ mkmsgs inputfile2 hallo
creates a file named hallo in the current directory. In order to use
this file later in the french locale, the system administrator must
perform the following actions:
$ mkdir /usr/lib/locale/french
$ mkdir /usr/lib/locale/french/LCMESSAGES
$ cp hallo /usr/lib/locale/french/LCMESSAGES/hallo
These files are accessed as follows:
If LCMESSAGES is empty and the value of LANG is german:
$ gettxt hallo:1 "Hello!\n"
Hallo !
The terminal bell also rings at the same time.
$ gettxt hallo:2 "Good Night!\n"
Gute ... Nacht !
$ gettxt hallo:3 "Good Morning!\n"
Guten Morgen !
$ LCMESSAGES=french
$ export LCMESSAGES
$ gettxt hallo:1 "Hello!\n"
Page 3 Reliant UNIX 5.44 Printed 11/98
mkmsgs(1) mkmsgs(1)
Salut !
$ gettxt hallo:2 "Good Night!\n"
Bonne nuit !\n
$ gettxt hallo:3 "Good Morning!\n"
Message not found!!
The call featuring hallo:3 causes Message not found!! to be displayed,
since the file /usr/lib/locale/french/LCMESSAGES/hallo only contains
2 messages.
$ LCMESSAGES=invalid
$ gettxt hallo:1 "Hello!\n"
Hello
$ gettxt hallo:2 "Good Night!\n"
Good Night!
The calls featuring hallo:1 or hallo:2 print the specified text, as
there is no file named /usr/lib/locale/invalid/LCMESSAGES/hallo. If
no text were specified, the string "Message not found" would be
displayed [see gettxt(1)].
FILES
/usr/lib/locale/*/LCMESSAGES/*
Message files created by mkmsgs. There is at least one directory
under /usr/lib/locale for each supported language.
SEE ALSO
exstr(1), gettxt(1), srchtxt(1), gettxt(3C), setlocale(3C).
International environment (NLS locale).
Page 4 Reliant UNIX 5.44 Printed 11/98