2 .\" Copyright (c) 1999, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH XGETTEXT 1 "Mar 23, 1999"
8 xgettext \- extract gettext call strings from C programs
12 \fBxgettext\fR [\fB-ns\fR] [\fB-a\fR [\fB-x\fR \fIexclude-file\fR]] [\fB-c\fR \fIcomment-tag\fR]
13 [\fB-d\fR \fIdefault-domain\fR] [\fB-j\fR] [\fB-m\fR \fIprefix\fR] [\fB-M\fR \fIsuffix\fR]
14 [\fB-p\fR \fIpathname\fR] \fB-|\fR \fIfilename\fR...
19 \fBxgettext\fR \fB-h\fR
25 The \fBxgettext\fR utility is used to automate the creation of portable message
26 files (\fB\&.po\fR). A \fB\&.po\fR file contains copies of "C" strings that are
27 found in ANSI C source code in \fIfilename\fR or the standard input if
28 `\fB\(mi\fR\&' is specified on the command line. The \fB\&.po\fR file can be
29 used as input to the \fBmsgfmt\fR(1) utility, which produces a binary form of
30 the message file that can be used by application during run-time.
33 \fBxgettext\fR writes \fImsgid\fR strings from \fBgettext\fR(3C) calls in
34 \fIfilename\fR to the default output file \fBmessages.po\fR. The default output
35 file name can be changed by \fB-d\fR option. \fImsgid\fR strings in
36 \fBdgettext()\fR calls are written to the output file
37 \fBdomainname\fR\fB\&.po\fR where \fBdomainname\fR is the first parameter to
38 the \fBdgettext()\fR call.
41 By default, \fBxgettext\fR creates a \fB\&.po\fR file in the current working
42 directory, and each entry is in the same order that the strings are extracted
43 from \fIfilenames\fR. When the \fB-p\fR option is specified, the \fB\&.po\fR
44 file is created in the \fIpathname\fR directory. An existing \fB\&.po\fR file
48 Duplicate \fImsgid\fRs are written to the \fB\&.po\fR file as comment lines.
49 When the \fB-s\fR option is specified, the \fB\&.po\fR is sorted by the
50 \fImsgid\fR string, and all duplicated \fImsgid\fRs are removed. All
51 \fImsgstr\fR directives in the \fB\&.po\fR file are empty unless the \fB-m\fR
56 The following options are supported:
63 Add comment lines to the output file indicating file name and line number in
64 the source file where each extracted string is encountered. These lines appear
65 before each \fImsgid\fR in the following format:
69 # # File: \fIfilename\fR, line: \fIline-number\fR
82 Generate output sorted by \fImsgid\fRs with all duplicate \fImsgid\fRs
92 Extract all strings, not just those found in \fBgettext\fR(3C), and
93 \fBdgettext()\fR () calls. Only one \fB\&.po\fR file is created.
99 \fB\fB-c\fR \fIcomment-tag\fR\fR
102 The comment block beginning with \fIcomment-tag\fR as the first token of the
103 comment block is added to the output \fB\&.po\fR file as \fI#\fR delimited
104 comments. For multiple domains, \fBxgettext\fR directs comments and messages to
105 the prevailing text domain.
111 \fB\fB-d\fR \fIdefault-domain\fR\fR
114 Rename default output file from \fBmessages.po\fR to \fIdefault-domain\fR
124 Join messages with existing message files. If a \fB\&.po\fR file does not
125 exist, it is created. If a \fB\&.po\fR file does exist, new messages are
126 appended. Any duplicate \fBmsgid\fRs are commented out in the resulting
127 \fB\&.po\fR file. Domain directives in the existing \fB\&.po\fR file are
128 ignored. Results not guaranteed if the existing message file has been edited.
134 \fB\fB-m\fR \fIprefix\fR\fR
137 Fill in the \fImsgstr\fR with \fIprefix\fR. This is useful for debugging
138 purposes. To make \fImsgstr\fR identical to \fImsgid\fR, use an empty string
139 (\fB""\fR) for \fIprefix\fR.
145 \fB\fB-M\fR \fIsuffix\fR\fR
148 Fill in the \fImsgstr\fR with \fIsuffix\fR. This is useful for debugging
155 \fB\fB-p\fR \fIpathname\fR\fR
158 Specify the directory where the output files will be placed. This option
159 overrides the current working directory.
165 \fB\fB-x\fR \fIexclude-file\fR\fR
168 Specify a \fB\&.po\fR file that contains a list of \fImsgid\fRs that are not
169 to be extracted from the input files. The format of \fIexclude-file\fR is
170 identical to the \fB\&.po\fR file. However, only the \fImsgid\fR directive line
171 in \fIexclude-file\fR is used. All other lines are simply ignored. The
172 \fB-x\fR option can only be used with the \fB-a\fR option.
181 Print a help message on the standard output.
187 \fBmsgfmt\fR(1), \fBgettext\fR(3C), \fBattributes\fR(5)
191 \fBxgettext\fR is not able to extract cast strings, for example ANSI C casts of
192 literal strings to \fB(const char *)\fR. This is unnecessary anyway, since the
193 prototypes in \fB<libintl.h>\fR already specify this type.
196 In messages and translation notes, lines greater than 2048 characters are
197 truncated to 2048 characters and a warning message is printed to stderr.