~ubuntu-branches/ubuntu/breezy/gettext/breezy

« back to all changes in this revision

Viewing changes to doc/gettext_4.html

  • Committer: Bazaar Package Importer
  • Author(s): Santiago Vila
  • Date: 2004-03-14 17:40:02 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040314174002-p1ad5ldve1hqzhye
Tags: 0.14.1-2
* Added libexpat1-dev to Build-Depends, for glade support.
* Added libc0.1-dev to Build-Depends, for GNU/kFreeBSD.
* Removed special-casing of knetbsd-gnu in debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<HTML>
2
 
<HEAD>
3
 
<!-- This HTML file has been created by texi2html 1.51
4
 
     from gettext.texi on 15 September 2001 -->
5
 
 
6
 
<TITLE>GNU gettext utilities - 4  Making the PO Template File</TITLE>
7
 
</HEAD>
8
 
<BODY>
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>.
10
 
<P><HR><P>
11
 
 
12
 
 
13
 
<H1><A NAME="SEC19" HREF="gettext_toc.html#TOC19">4  Making the PO Template File</A></H1>
14
 
 
15
 
<P>
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.
18
 
 
19
 
</P>
20
 
 
21
 
 
22
 
 
23
 
<H2><A NAME="SEC20" HREF="gettext_toc.html#TOC20">4.1  Invoking the <CODE>xgettext</CODE> Program</A></H2>
24
 
 
25
 
 
26
 
<PRE>
27
 
xgettext [<VAR>option</VAR>] <VAR>inputfile</VAR> ...
28
 
</PRE>
29
 
 
30
 
<DL COMPACT>
31
 
 
32
 
<DT><SAMP>`-a'</SAMP>
33
 
<DD>
34
 
<DT><SAMP>`--extract-all'</SAMP>
35
 
<DD>
36
 
Extract all strings.
37
 
 
38
 
<DT><SAMP>`-c [<VAR>tag</VAR>]'</SAMP>
39
 
<DD>
40
 
<DT><SAMP>`--add-comments[=<VAR>tag</VAR>]'</SAMP>
41
 
<DD>
42
 
Place comment block with <VAR>tag</VAR> (or those preceding keyword lines)
43
 
in output file.
44
 
 
45
 
<DT><SAMP>`-C'</SAMP>
46
 
<DD>
47
 
<DT><SAMP>`--c++'</SAMP>
48
 
<DD>
49
 
Recognize C++ style comments.
50
 
 
51
 
<DT><SAMP>`--debug'</SAMP>
52
 
<DD>
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.
57
 
 
58
 
By default only the <KBD>c-format</KBD> form is used.  The translator should
59
 
not have to care about these details.
60
 
 
61
 
<DT><SAMP>`-d <VAR>name</VAR>'</SAMP>
62
 
<DD>
63
 
<DT><SAMP>`--default-domain=<VAR>name</VAR>'</SAMP>
64
 
<DD>
65
 
Use <TT>`<VAR>name</VAR>.po'</TT> for output (instead of <TT>`messages.po'</TT>).
66
 
 
67
 
The special domain name <TT>`-'</TT> or <TT>`/dev/stdout'</TT> means to write
68
 
the output to <TT>`stdout'</TT>.
69
 
 
70
 
<DT><SAMP>`-D <VAR>directory</VAR>'</SAMP>
71
 
<DD>
72
 
<DT><SAMP>`--directory=<VAR>directory</VAR>'</SAMP>
73
 
<DD>
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.
77
 
 
78
 
<DT><SAMP>`-f <VAR>file</VAR>'</SAMP>
79
 
<DD>
80
 
<DT><SAMP>`--files-from=<VAR>file</VAR>'</SAMP>
81
 
<DD>
82
 
Read the names of the input files from <VAR>file</VAR> instead of getting
83
 
them from the command line.
84
 
 
85
 
<DT><SAMP>`--force'</SAMP>
86
 
<DD>
87
 
Always write an output file even if no message is defined.
88
 
 
89
 
<DT><SAMP>`-h'</SAMP>
90
 
<DD>
91
 
<DT><SAMP>`--help'</SAMP>
92
 
<DD>
93
 
Display this help and exit.
94
 
 
95
 
<DT><SAMP>`-I <VAR>list</VAR>'</SAMP>
96
 
<DD>
97
 
<DT><SAMP>`--input-path=<VAR>list</VAR>'</SAMP>
98
 
<DD>
99
 
List of directories searched for input files.
100
 
 
101
 
<DT><SAMP>`-j'</SAMP>
102
 
<DD>
103
 
<DT><SAMP>`--join-existing'</SAMP>
104
 
<DD>
105
 
Join messages with existing file.
106
 
 
107
 
<DT><SAMP>`-k <VAR>word</VAR>'</SAMP>
108
 
<DD>
109
 
<DT><SAMP>`--keyword[=<VAR>keywordspec</VAR>]'</SAMP>
110
 
<DD>
111
 
Additional keyword to be looked for (without <VAR>keywordspec</VAR> means not to
112
 
use default keywords).
113
 
 
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.
123
 
 
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>.
128
 
 
129
 
<DT><SAMP>`-m [<VAR>string</VAR>]'</SAMP>
130
 
<DD>
131
 
<DT><SAMP>`--msgstr-prefix[=<VAR>string</VAR>]'</SAMP>
132
 
<DD>
133
 
Use <VAR>string</VAR> or "" as prefix for msgstr entries.
134
 
 
135
 
<DT><SAMP>`-M [<VAR>string</VAR>]'</SAMP>
136
 
<DD>
137
 
<DT><SAMP>`--msgstr-suffix[=<VAR>string</VAR>]'</SAMP>
138
 
<DD>
139
 
Use <VAR>string</VAR> or "" as suffix for msgstr entries.
140
 
 
141
 
<DT><SAMP>`--no-location'</SAMP>
142
 
<DD>
143
 
Do not write <SAMP>`#: <VAR>filename</VAR>:<VAR>line</VAR>'</SAMP> lines.
144
 
 
145
 
<DT><SAMP>`-n'</SAMP>
146
 
<DD>
147
 
<DT><SAMP>`--add-location'</SAMP>
148
 
<DD>
149
 
Generate <SAMP>`#: <VAR>filename</VAR>:<VAR>line</VAR>'</SAMP> lines (default).
150
 
 
151
 
<DT><SAMP>`--omit-header'</SAMP>
152
 
<DD>
153
 
Don't write header with <SAMP>`msgid ""'</SAMP> entry.
154
 
 
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.
159
 
 
160
 
<DT><SAMP>`-p <VAR>dir</VAR>'</SAMP>
161
 
<DD>
162
 
<DT><SAMP>`--output-dir=<VAR>dir</VAR>'</SAMP>
163
 
<DD>
164
 
Output files will be placed in directory <VAR>dir</VAR>.
165
 
 
166
 
<DT><SAMP>`-s'</SAMP>
167
 
<DD>
168
 
<DT><SAMP>`--sort-output'</SAMP>
169
 
<DD>
170
 
Generate sorted output and remove duplicates.
171
 
 
172
 
<DT><SAMP>`--strict'</SAMP>
173
 
<DD>
174
 
Write out a strict Uniforum conforming PO file.
175
 
 
176
 
<DT><SAMP>`-v'</SAMP>
177
 
<DD>
178
 
<DT><SAMP>`--version'</SAMP>
179
 
<DD>
180
 
Output version information and exit.
181
 
 
182
 
<DT><SAMP>`-x <VAR>file</VAR>'</SAMP>
183
 
<DD>
184
 
<DT><SAMP>`--exclude-file=<VAR>file</VAR>'</SAMP>
185
 
<DD>
186
 
Entries from <VAR>file</VAR> are not extracted.
187
 
 
188
 
</DL>
189
 
 
190
 
<P>
191
 
Search path for supplementary PO files is:
192
 
<TT>`/usr/local/share/nls/src/'</TT>.
193
 
 
194
 
</P>
195
 
<P>
196
 
If <VAR>inputfile</VAR> is <SAMP>`-'</SAMP>, standard input is read.
197
 
 
198
 
</P>
199
 
<P>
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.
203
 
 
204
 
</P>
205
 
<P><HR><P>
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>.
207
 
</BODY>
208
 
</HTML>