msgfmt creates message object files from portable object files (filename.po), without changing the portable object files.
The .po file contains messages displayed to users by system commands or by application programs. .po files can be edited, and the messages in them can be rewritten in any language supported by the system.
The xgettext.1 command can be used to create .po files from script or programs.
msgfmt interprets data as characters according to the current setting of the LC_CTYPE locale category.
Formats for all .po files are the same. Each .po file contains one or more lines, with each line containing either a comment or a statement. Comments start the line with a hash mark (#) and end with the newline character. All comments are ignored. The format of a statement is:
Each directive starts at the beginning of the 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. Use any of the following types of directives:
The behavior of the domain directive is affected by the options used. See OPTIONS for the behavior when the -o option is specified. If the -o option is not specified, the behavior of the domain directive is as follows:
The msgid directive specifies the value of a message identifier associated with the directive that follows it. The message_identifier string identifies a target string to be used at retrieval time. Each 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.
Message strings can contain the escape sequences \n for newline, \t for tab, \v for vertical tab, \b for backspace, \r for carriage return, \f for formfeed, \\ for backslash, \" for double quote, \ddd for octal bit pattern, and \xDD for hexadecimal bit pattern.
example% cat module1.po # default domain "messages.mo" msgid "msg 1" msgstr "msg 1 translation" # domain "help_domain" msgid "help 2" msgstr "help 2 translation" # domain "error_domain" msgid "error 3" msgstr "error 3 translation" example% cat module2.po # default domain "messages.mo" msgid "mesg 4" msgstr "mesg 4 translation" # domain "error_domain" msgid "error 5" msgstr "error 5 translation" # domain "window_domain" msgid "window 6" msgstr "window 6 translation"
The following command will produce the output files, messages.mo, help_domain.mo, and error_domain.mo.
example% msgfmt module1.po
The following command will produce the output files, messages.mo, help_domain.mo, error_domain.mo, and window_domain.mo.
example% msgfmt module1.po module2.po
The following example will produce the output file hello.mo.
example% msgfmt -o hello.mo module1.po module2.po
Install message object files in /usr/lib/locale/locale/LC_MESSAGES/domain.mo where locale is the message locale as set by setlocale.3c and domain is text domain as set by textdomain(). The /usr/lib/locale portion can optionally be changed by calling bindtextdomain(). See gettext.3c
+---------------+-----------------+ |ATTRIBUTE TYPE | ATTRIBUTE VALUE | +---------------+-----------------+ |Availability | SUNWloc | |CSI | Enabled | +---------------+-----------------+
Neither msgfmt nor any gettext() routine imposes a limit on the total length of a message. However, each line in the *.po file is limited to MAX_INPUT (512) bytes.
Installing message catalogs under the C locale is pointless, since they are ignored for the sake of efficiency.
Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).
Last modified 07/October/97