wxWidgets/docs/html/gettext/msgfmt.htm

223 lines
8.3 KiB
HTML
Raw Normal View History

<!-- manual page source format generated by PolyglotMan v3.0.3a12, -->
<!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z -->
<HTML>
<HEAD>
<TITLE>msgfmt(1) manual page</TITLE>
</HEAD>
<BODY>
<A HREF="#toc">Table of Contents</A><P>
<H2><A NAME="sect0" HREF="#toc0">NAME </A></H2>
msgfmt - create a message object from a message file
<H2><A NAME="sect1" HREF="#toc1">SYNOPSIS
</A></H2>
<B>msgfmt</B> [ <B>-v</B> ] [ <B>-o</B><I> output-file</I> ] ...
<H2><A NAME="sect2" HREF="#toc2">DESCRIPTION </A></H2>
<P>
<B>msgfmt</B> creates message
object files from portable object files (<I>filename<B>.po </B></I>), without changing
the portable object files. <P>
The <B>.po </B> file contains messages displayed to
users by system commands or by application programs. <B>.po</B> files can be edited,
and the messages in them can be rewritten in any language supported by
the system. <P>
The <B><A HREF="http://hoth.stsci.edu/man/man1/xgettext.html">xgettext</B>(1)</A>
command can be used to create <B>.po</B> files from
script or programs. <P>
<B>msgfmt</B> interprets data as characters according to the
current setting of the <FONT SIZE=-1><B>LC_CTYPE </B></FONT>
locale category.
<H3><A NAME="sect3" HREF="#toc3">Portable Object Files
</A></H3>
<P>
Formats for all <B>.po</B> files are the same. Each <B>.po</B> 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:
<DL>
<DT><I>directive</I>
value </DT>
<DD></DD>
</DL>
<P>
Each directive starts at the beginning of the line and is separated
from <I>value</I> by white space (such as one or more space or tab characters).
<I>value</I> consists of one or more quoted strings separated by white space.
Use any of the following types of directives: <P>
<blockquote><B>domain</B> <I>domainname</I> <BR>
<B>msgid</B>
<I>message_identifier</I> <BR>
<B>msgstr</B> <I>message_string</I> </blockquote>
<P>
The behavior of the <B>domain</B>
directive is affected by the options used. See <FONT SIZE=-1>OPTIONS</FONT>
for the behavior
when the <B>-o</B> option is specified. If the <B>-o</B> option is not specified, the
behavior of the <B>domain</B> directive is as follows: <blockquote>
<UL>
&#183;<LI>All <I>msgids</I> from the beginning
of each <B>.po</B> file to the first domain directive are put into a default
message object file, <B>messages.mo</B>. </LI>&#183;<LI>When <B>msgfmt</B> encounters a <B>domain</B><I> domainname</I>
directive in the <B>.po</B> file, all following <I>msgids</I> until the next <B>domain</B> directive
are put into the message object file </LI>&#183;<LI>Duplicate <I>msgids</I> are defined in
the scope of each domain. That is, a <I>msgid</I> is considered a duplicate only
if the identical <I>msgid</I> exists in the same domain. </LI>&#183;<LI>All duplicate <I>msgids</I>
are ignored. </LI>
</UL>
</blockquote>
<P>
The <B>msgid</B> directive specifies the value of a message identifier
associated with the directive that follows it. The <I>message_identifier</I> string
identifies a target string to be used at retrieval time. Each statement
containing a <B>msgid</B> directive must be followed by a statement containing
a <B>msgstr</B> directive. <P>
The <B>msgstr</B> directive specifies the target string associated
with the <I>message_identifier</I> string declared in the immediately preceding
<B>msgid</B> directive. <P>
Message strings can contain the escape sequences <B>\n</B> for
newline, <B>\t</B> for tab, <B>\v</B> for vertical tab, <B>\b</B> for backspace, <B>\r</B> for carriage
return, <B>\f</B> for formfeed, <B>\\</B> for backslash, \" for double quote, <B>\ddd</B> for octal
bit pattern, and <B>\xDD</B> for hexadecimal bit pattern.
<H2><A NAME="sect4" HREF="#toc4">OPTIONS </A></H2>
<DL>
<DT><B>-v</B> </DT>
<DD>Verbose.
List duplicate message identifiers. Message strings are not redefined.
</DD>
<DT><B>-o</B><I> output-file</I> </DT>
<DD>Specify output file name as <I>output-file</I>. All <B>domain</B> directives
and duplicate <I>msgids</I> in the <B>.po</B> file are ignored. </DD>
</DL>
<H2><A NAME="sect5" HREF="#toc5">EXAMPLES </A></H2>
In this example
<B>module1.po</B> and <B>module2.po</B> are portable message objects files. <P>
<blockquote> example%
cat module1.po <BR>
# default domain "messages.mo" <BR>
msgid "msg 1" <BR>
msgstr "msg
1 translation" <BR>
# <BR>
domain "help_domain" <BR>
msgid "help 2" <BR>
msgstr "help
2 translation" <BR>
# <BR>
domain "error_domain" <BR>
msgid "error 3" <BR>
msgstr "error
3 translation" <BR>
<P>
example% cat module2.po <BR>
# default domain "messages.mo"
<BR>
msgid "mesg 4" <BR>
msgstr "mesg 4 translation" <BR>
# <BR>
domain "error_domain"
<BR>
msgid "error 5" <BR>
msgstr "error 5 translation" <BR>
# <BR>
domain "window_domain"
<BR>
msgid "window 6" <BR>
msgstr "window 6 translation" <BR>
</blockquote>
<P>
The following command
will produce the output files, <B>messages.mo</B>, <B>help_domain.mo</B>, and <B>error_domain.mo</B>.
<DL>
<DT><B>example% msgfmt module1.po</B> </DT>
<DD></DD>
</DL>
<P>
The following command will produce the output
files, <B>messages.mo</B>, <B>help_domain.mo</B>, <B>error_domain.mo</B>, and <B>window_domain.mo</B>.
<DL>
<DT><B>example% msgfmt module1.po module2.po</B> </DT>
<DD></DD>
</DL>
<P>
The following example will produce
the output file <B>hello.mo</B>.
<DL>
<DT><B>example% msgfmt -o hello.mo module1.po module2.po</B>
</DT>
<DD></DD>
</DL>
<P>
Install message object files in <B>/usr/lib/locale/</B><I>locale</I><B><FONT SIZE=-1>/LC_MESSAGES/</FONT>
</B><I>domain</I><B>.mo</B>
where <I>locale</I> is the message locale as set by <B><A HREF="http://hoth.stsci.edu/man/man3C/setlocale.html">setlocale</B>(3C)</A>
, and <I>domain</I>
is text domain as set by <B>textdomain()</B>. The <B>/usr/lib/locale</B> portion can
optionally be changed by calling <B>bindtextdomain()</B>. See <B><A HREF="http://hoth.stsci.edu/man/man3C/gettext.html">gettext</B>(3C)</A>
.
<H2><A NAME="sect6" HREF="#toc6">ENVIRONMENT
</A></H2>
See <B><A HREF="http://hoth.stsci.edu/man/man5/environ.html">environ</B>(5)</A>
for descriptions of the following environmental variables
that affect the execution of <B>msgfmt</B>: <FONT SIZE=-1><B>LC_CTYPE</FONT>
</B>, <FONT SIZE=-1><B>LC_MESSAGES</FONT>
</B>, <FONT SIZE=-1><B>NLSPATH</FONT>
</B>.
<H2><A NAME="sect7" HREF="#toc7">ATTRIBUTES </A></H2>
See <B><A HREF="http://hoth.stsci.edu/man/man5/attributes.html">attributes</B>(5)</A>
for descriptions of the following attributes:
<P>
<TABLE BORDER=0>
<TR> <TD ALIGN=CENTER><B>ATTRIBUTE TYPE</B> </TD> <TD ALIGN=CENTER><B>ATTRIBUTE VALUE</B> </TD> </TR>
<TR> <TR> <TD ALIGN=LEFT>Availability </TD> <TD ALIGN=LEFT>SUNWloc </TD> </TR>
<TR> <TD ALIGN=LEFT>CSI
</TD> <TD ALIGN=LEFT>Enabled </TD> </TR>
</TABLE>
<H2><A NAME="sect8" HREF="#toc8">SEE ALSO </A></H2>
<B><A HREF="http://hoth.stsci.edu/man/man1/xgettext.html">xgettext</B>(1)</A>
, <B><A HREF="http://hoth.stsci.edu/man/man3C/gettext.html">gettext</B>(3C)</A>
, <B><A HREF="http://hoth.stsci.edu/man/man3C/setlocale.html">setlocale</B>(3C)</A>
, <B><A HREF="http://hoth.stsci.edu/man/man5/attributes.html">attributes</B>(5)</A>
,
<B><A HREF="http://hoth.stsci.edu/man/man5/environ.html">environ</B>(5)</A>
<H2><A NAME="sect9" HREF="#toc9">NOTES </A></H2>
<P>
Neither <B>msgfmt</B> nor any <B>gettext()</B> routine imposes a limit
on the total length of a message. However, each line in the <B>*.po</B> file is
limited to <FONT SIZE=-1><B>MAX_INPUT </B></FONT>
(512) bytes. <P>
Installing message catalogs under the
C locale is pointless, since they are ignored for the sake of efficiency.
<P>
<HR><P>
<A NAME="toc"><B>Table of Contents</B></A><P>
<UL>
<LI><A NAME="toc0" HREF="#sect0">NAME</A></LI>
<LI><A NAME="toc1" HREF="#sect1">SYNOPSIS</A></LI>
<LI><A NAME="toc2" HREF="#sect2">DESCRIPTION</A></LI>
<UL>
<LI><A NAME="toc3" HREF="#sect3">Portable Object Files</A></LI>
</UL>
<LI><A NAME="toc4" HREF="#sect4">OPTIONS</A></LI>
<LI><A NAME="toc5" HREF="#sect5">EXAMPLES</A></LI>
<LI><A NAME="toc6" HREF="#sect6">ENVIRONMENT</A></LI>
<LI><A NAME="toc7" HREF="#sect7">ATTRIBUTES</A></LI>
<LI><A NAME="toc8" HREF="#sect8">SEE ALSO</A></LI>
<LI><A NAME="toc9" HREF="#sect9">NOTES</A></LI>
</UL>
</BODY></HTML>