msgfmt
User Commands msgfmt(1)NAME
msgfmt - create a message object from a message fileSYNOPSIS
msgfmt [ -v ] [ -o output-file ] filename.po ...DESCRIPTION
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. Portable Object Files Formats for all .po files are the same. Each .po file con- tains 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: directive value 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 fol- lowing types of directives: domain domainname msgid message_identifier msgstr message_string 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: + All msgids from the beginning of each .po file to the first domain directive are put into a default message object file, messages.mo. SunOS 5.8 Last change: 20 Dec 1996 1 User Commands msgfmt(1) + When msgfmt encounters a domain domainname directive in the .po file, all following msgids until the next domain directive are put into the message object file domainname.mo. + Duplicate msgids are defined in the scope of each domain. That is, a msgid is considered a duplicate only if the identical msgid exists in the same domain. + All duplicate msgids are ignored. The msgid directive specifies the value of a message iden- tifier 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 immedi- ately preceding msgid directive. Message strings can contain the escape sequences \n for new- line, \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.OPTIONS
-v Verbose. List duplicate message identifiers. Message strings are not redefined. -o output-file Specify output file name as output-file. All domain directives and duplicate msgids in the .po file are ignored. EXAMPLES Example 1: Examples of creating message objects from message files. In this example module1.po and module2.po are portable mes- sage objects files. 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" SunOS 5.8 Last change: 20 Dec 1996 2 User Commands msgfmt(1) # 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 por- tion can optionally be changed by calling bindtextdomain(). See gettext(3C). ENVIRONMENT VARIABLES See environ(5) for descriptions of the following environmen- tal variables that affect the execution of msgfmt: LC_CTYPE, LC_MESSAGES, NLSPATH.ATTRIBUTES
See attributes(5) for descriptions of the following attri- butes: SunOS 5.8 Last change: 20 Dec 1996 3 User Commands msgfmt(1) ____________________________________________________________ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |_____________________________|_____________________________| | Availability | SUNWloc | |_____________________________|_____________________________| | CSI | Enabled | |_____________________________|_____________________________|SEE ALSO
xgettext(1), gettext(3C), setlocale(3C), attributes(5), environ(5)NOTES
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. SunOS 5.8 Last change: 20 Dec 1996 4