msgfmt(1) General Commands Manual msgfmt(1)NAME
msgfmt - create a message object from a message file
SYNOPSIS
msgfmt [ -v ] filename.po ...
DESCRIPTION
msgfmt creates a message object filename .mo file from the portable message file filename.po.
The .po file contains strings extracted from source code. .po files can be edited, and the messages in them can changed to accomodate any
language supported by the system.
The xgettext command (see xgettext(1)) can be used to create the default.po file.
The msgfmt command does not modify the portable object files.
Portable Object Files
Each .po file contains one or more lines. Each line contains either a comment or a statement. Comments start the line with a hash mark
(#) and end with the newline character and are ignored.
Each directive starts on a new line and is separated from <value> by white space (such as one or more space or tab characters). <value>
consists of one or more quoted strings separated by white space or <CR>. The following are valid directives:
domain domainname
msgid message_identifier
msgstr message_string
The domain directive identifies all following directives until another domain directive is encountered as applying to the domain domain-
name. The domainname is a string up to MAXDOMAIN bytes long, and can contain any characters allowed in legal filenames. Until the first
domain directive is encountered in the file, all target strings belong to the default domain. The default domain is called default.
The msgid directive specifies the message identifier for the following msgstr directive. The message_identifier string identifies a target
string at retrieval time. Every statement containing a msgid directive must be followed by a statement containing a msgstr directive.
The msgstr directive specifies the target string associated with the message_identifier string declared in the immediately preceding msgid
directive.
OPTIONS -v Verbose. List duplicate message identifiers. Message strings are not redefined.
EXAMPLES
The following command creates a named .mo file for each domain named in the portable message objects filename1.po and filename2.po.
msgfmt filename1.po filename2.po
Running msgfmt(1) on the following sample .po file creates two .mo files, named first.mo and second.mo.
domain "first.mo"
msgid "aao"
msgstr "first sample message"
domain "second.mo"
msgid "bbo"
msgstr "second sample message"
SEE ALSO xgettext(1), gettext(3).
25 July 1990 msgfmt(1)
Check Out this Related Man Page
xgettext(1) General Commands Manual xgettext(1)NAME
xgettext - conditionally extract strings from C programs
SYNOPSIS
xgettext -d [ cmnopvhP ] [ -odirectory-prefix ] [ -xexclude-list ] [ filename ... ]
xgettext [ -amopvhP ] [ -xexclude-list ] [ filename ... ]
DESCRIPTION
xgettext is used to automate the creation of portable message files. A portable message file contains copies of "C" strings that are found
in "C" source code in filename. When the -d option is specified, xgettext places the extracted strings in the file name.po. name is
either the domain specified in a dgettext call, or messages.po for strings extracted from gettext and textdomain calls. If the -d flag is
not specified, xgettext places all the strings in messages.po. The portable message file can be used as input to the msgfmt(1) utility,
which will produce a binary form of the message file than can be used at application run-time.
OPTIONS -a Extract ALL strings, not just those found in gettext, dgettext, and textdomain calls.
-cflag Comments beginning with flag filename on the first line of the comment are added to file filename as # delimited comments.
-d Produce duplicates. Does not sort output when writing the portable message file and will not overwrite existing output files.
Places output from each domain specified in a dgettext call into a separate file named for the domain, ie. name.po
-cflag Comments beginning with flag filename on the first line of the comment are added to file filename as # delimited comments.
-mstring Causes xgettext to fill in the msgstr line of the portable message files it produces. xgettext uses the corresponding msgid
string extracted from the "C" file, appending string. Useful for debugging purposes.
-n Add # delimited line number comments to output file indicating the line number in the source file where each extracted string is
encountered.
-ofilename
rename the default output file from messages.po to filename.
-ppathname
Specify the directory where the output files will be placed. This option overrides the current working directory.
-xfilename
Specify a file that contains a list of strings that are not be extracted from the input files. Each string to be excluded must
appear on a line by itself in the file filename.
-P include strings in pre-processor statements.
-v Verbose mode.
-h Print a help message on standard output.
FILES
messages.po is always created, but may be empty.
SEE ALSO msgfmt(1), xstr(1), gettext, dgettext, textdomain(3).
14 Sep 1990 xgettext(1)