3
<!-- This HTML file has been created by texi2html 1.51
4
from gettext.texi on 15 September 2001 -->
6
<TITLE>GNU gettext utilities - 4 Making the PO Template File</TITLE>
9
Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_3.html">previous</A>, <A HREF="gettext_5.html">next</A>, <A HREF="gettext_14.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>.
13
<H1><A NAME="SEC19" HREF="gettext_toc.html#TOC19">4 Making the PO Template File</A></H1>
16
After preparing the sources, the programmer creates a PO template file.
17
This section explains how to use <CODE>xgettext</CODE> for this purpose.
23
<H2><A NAME="SEC20" HREF="gettext_toc.html#TOC20">4.1 Invoking the <CODE>xgettext</CODE> Program</A></H2>
27
xgettext [<VAR>option</VAR>] <VAR>inputfile</VAR> ...
34
<DT><SAMP>`--extract-all'</SAMP>
38
<DT><SAMP>`-c [<VAR>tag</VAR>]'</SAMP>
40
<DT><SAMP>`--add-comments[=<VAR>tag</VAR>]'</SAMP>
42
Place comment block with <VAR>tag</VAR> (or those preceding keyword lines)
47
<DT><SAMP>`--c++'</SAMP>
49
Recognize C++ style comments.
51
<DT><SAMP>`--debug'</SAMP>
53
Use the flags <KBD>c-format</KBD> and <KBD>possible-c-format</KBD> to show who was
54
responsible for marking a message as a format string. The latter form is
55
used if the <CODE>xgettext</CODE> program decided, the format form is used if
56
the programmer prescribed it.
58
By default only the <KBD>c-format</KBD> form is used. The translator should
59
not have to care about these details.
61
<DT><SAMP>`-d <VAR>name</VAR>'</SAMP>
63
<DT><SAMP>`--default-domain=<VAR>name</VAR>'</SAMP>
65
Use <TT>`<VAR>name</VAR>.po'</TT> for output (instead of <TT>`messages.po'</TT>).
67
The special domain name <TT>`-'</TT> or <TT>`/dev/stdout'</TT> means to write
68
the output to <TT>`stdout'</TT>.
70
<DT><SAMP>`-D <VAR>directory</VAR>'</SAMP>
72
<DT><SAMP>`--directory=<VAR>directory</VAR>'</SAMP>
74
Change to <VAR>directory</VAR> before beginning to search and scan source
75
files. The resulting <TT>`.po'</TT> file will be written relative to the
76
original directory, though.
78
<DT><SAMP>`-f <VAR>file</VAR>'</SAMP>
80
<DT><SAMP>`--files-from=<VAR>file</VAR>'</SAMP>
82
Read the names of the input files from <VAR>file</VAR> instead of getting
83
them from the command line.
85
<DT><SAMP>`--force'</SAMP>
87
Always write an output file even if no message is defined.
91
<DT><SAMP>`--help'</SAMP>
93
Display this help and exit.
95
<DT><SAMP>`-I <VAR>list</VAR>'</SAMP>
97
<DT><SAMP>`--input-path=<VAR>list</VAR>'</SAMP>
99
List of directories searched for input files.
101
<DT><SAMP>`-j'</SAMP>
103
<DT><SAMP>`--join-existing'</SAMP>
105
Join messages with existing file.
107
<DT><SAMP>`-k <VAR>word</VAR>'</SAMP>
109
<DT><SAMP>`--keyword[=<VAR>keywordspec</VAR>]'</SAMP>
111
Additional keyword to be looked for (without <VAR>keywordspec</VAR> means not to
112
use default keywords).
114
If <VAR>keywordspec</VAR> is a C identifer <VAR>id</VAR>, <CODE>xgettext</CODE> looks
115
for strings in the first argument of each call to the function or macro
116
<VAR>id</VAR>. If <VAR>keywordspec</VAR> is of the form
117
<SAMP>`<VAR>id</VAR>:<VAR>argnum</VAR>'</SAMP>, <CODE>xgettext</CODE> looks for strings in the
118
<VAR>argnum</VAR>th argument of the call. If <VAR>keywordspec</VAR> is of the form
119
<SAMP>`<VAR>id</VAR>:<VAR>argnum1</VAR>,<VAR>argnum2</VAR>'</SAMP>, <CODE>xgettext</CODE> looks for
120
strings in the <VAR>argnum1</VAR>st argument and in the <VAR>argnum2</VAR>nd argument
121
of the call, and treats them as singular/plural variants for a message
122
with plural handling.
124
The default keyword specifications, which are always looked for if not
125
explicitly disabled, are <CODE>gettext</CODE>, <CODE>dgettext:2</CODE>,
126
<CODE>dcgettext:2</CODE>, <CODE>ngettext:1,2</CODE>, <CODE>dngettext:2,3</CODE>,
127
<CODE>dcngettext:2,3</CODE>, and <CODE>gettext_noop</CODE>.
129
<DT><SAMP>`-m [<VAR>string</VAR>]'</SAMP>
131
<DT><SAMP>`--msgstr-prefix[=<VAR>string</VAR>]'</SAMP>
133
Use <VAR>string</VAR> or "" as prefix for msgstr entries.
135
<DT><SAMP>`-M [<VAR>string</VAR>]'</SAMP>
137
<DT><SAMP>`--msgstr-suffix[=<VAR>string</VAR>]'</SAMP>
139
Use <VAR>string</VAR> or "" as suffix for msgstr entries.
141
<DT><SAMP>`--no-location'</SAMP>
143
Do not write <SAMP>`#: <VAR>filename</VAR>:<VAR>line</VAR>'</SAMP> lines.
145
<DT><SAMP>`-n'</SAMP>
147
<DT><SAMP>`--add-location'</SAMP>
149
Generate <SAMP>`#: <VAR>filename</VAR>:<VAR>line</VAR>'</SAMP> lines (default).
151
<DT><SAMP>`--omit-header'</SAMP>
153
Don't write header with <SAMP>`msgid ""'</SAMP> entry.
155
This is useful for testing purposes because it eliminates a source
156
of variance for generated <CODE>.gmo</CODE> files. We can ship some of
157
these files in the GNU <CODE>gettext</CODE> package, and the result of
158
regenerating them through <CODE>msgfmt</CODE> should yield the same values.
160
<DT><SAMP>`-p <VAR>dir</VAR>'</SAMP>
162
<DT><SAMP>`--output-dir=<VAR>dir</VAR>'</SAMP>
164
Output files will be placed in directory <VAR>dir</VAR>.
166
<DT><SAMP>`-s'</SAMP>
168
<DT><SAMP>`--sort-output'</SAMP>
170
Generate sorted output and remove duplicates.
172
<DT><SAMP>`--strict'</SAMP>
174
Write out a strict Uniforum conforming PO file.
176
<DT><SAMP>`-v'</SAMP>
178
<DT><SAMP>`--version'</SAMP>
180
Output version information and exit.
182
<DT><SAMP>`-x <VAR>file</VAR>'</SAMP>
184
<DT><SAMP>`--exclude-file=<VAR>file</VAR>'</SAMP>
186
Entries from <VAR>file</VAR> are not extracted.
191
Search path for supplementary PO files is:
192
<TT>`/usr/local/share/nls/src/'</TT>.
196
If <VAR>inputfile</VAR> is <SAMP>`-'</SAMP>, standard input is read.
200
This implementation of <CODE>xgettext</CODE> is able to process a few awkward
201
cases, like strings in preprocessor macros, ANSI concatenation of
202
adjacent strings, and escaped end of lines for continued strings.
206
Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_3.html">previous</A>, <A HREF="gettext_5.html">next</A>, <A HREF="gettext_14.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>.