xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/doc/gettext_9.html (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1<HTML>
2<HEAD>
3<!-- This HTML file has been created by texi2html 1.52b
4     from gettext.texi on 27 November 2006 -->
5
6<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
7<TITLE>GNU gettext utilities - 9  Manipulating PO Files</TITLE>
8</HEAD>
9<BODY>
10Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_8.html">previous</A>, <A HREF="gettext_10.html">next</A>, <A HREF="gettext_25.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>.
11<P><HR><P>
12
13
14<H1><A NAME="SEC73" HREF="gettext_toc.html#TOC73">9  Manipulating PO Files</A></H1>
15<P>
16<A NAME="IDX507"></A>
17
18</P>
19<P>
20Sometimes it is necessary to manipulate PO files in a way that is better
21performed automatically than by hand.  GNU <CODE>gettext</CODE> includes a
22complete set of tools for this purpose.
23
24</P>
25<P>
26<A NAME="IDX508"></A>
27When merging two packages into a single package, the resulting POT file
28will be the concatenation of the two packages' POT files.  Thus the
29maintainer must concatenate the two existing package translations into
30a single translation catalog, for each language.  This is best performed
31using <SAMP>&lsquo;msgcat&rsquo;</SAMP>.  It is then the translators' duty to deal with any
32possible conflicts that arose during the merge.
33
34</P>
35<P>
36<A NAME="IDX509"></A>
37When a translator takes over the translation job from another translator,
38but she uses a different character encoding in her locale, she will
39convert the catalog to her character encoding.  This is best done through
40the <SAMP>&lsquo;msgconv&rsquo;</SAMP> program.
41
42</P>
43<P>
44When a maintainer takes a source file with tagged messages from another
45package, he should also take the existing translations for this source
46file (and not let the translators do the same job twice).  One way to do
47this is through <SAMP>&lsquo;msggrep&rsquo;</SAMP>, another is to create a POT file for
48that source file and use <SAMP>&lsquo;msgmerge&rsquo;</SAMP>.
49
50</P>
51<P>
52<A NAME="IDX510"></A>
53<A NAME="IDX511"></A>
54When a translator wants to adjust some translation catalog for a special
55dialect or orthography -- for example, German as written in Switzerland
56versus German as written in Germany -- she needs to apply some text
57processing to every message in the catalog.  The tool for doing this is
58<SAMP>&lsquo;msgfilter&rsquo;</SAMP>.
59
60</P>
61<P>
62Another use of <CODE>msgfilter</CODE> is to produce approximately the POT file for
63which a given PO file was made.  This can be done through a filter command
64like <SAMP>&lsquo;msgfilter sed -e d | sed -e '/^# /d'&rsquo;</SAMP>.  Note that the original
65POT file may have had different comments and different plural message counts,
66that's why it's better to use the original POT file if available.
67
68</P>
69<P>
70<A NAME="IDX512"></A>
71When a translator wants to check her translations, for example according
72to orthography rules or using a non-interactive spell checker, she can do
73so using the <SAMP>&lsquo;msgexec&rsquo;</SAMP> program.
74
75</P>
76<P>
77<A NAME="IDX513"></A>
78When third party tools create PO or POT files, sometimes duplicates cannot
79be avoided.  But the GNU <CODE>gettext</CODE> tools give an error when they
80encounter duplicate msgids in the same file and in the same domain.
81To merge duplicates, the <SAMP>&lsquo;msguniq&rsquo;</SAMP> program can be used.
82
83</P>
84<P>
85<SAMP>&lsquo;msgcomm&rsquo;</SAMP> is a more general tool for keeping or throwing away
86duplicates, occurring in different files.
87
88</P>
89<P>
90<SAMP>&lsquo;msgcmp&rsquo;</SAMP> can be used to check whether a translation catalog is
91completely translated.
92
93</P>
94<P>
95<A NAME="IDX514"></A>
96<SAMP>&lsquo;msgattrib&rsquo;</SAMP> can be used to select and extract only the fuzzy
97or untranslated messages of a translation catalog.
98
99</P>
100<P>
101<SAMP>&lsquo;msgen&rsquo;</SAMP> is useful as a first step for preparing English translation
102catalogs.  It copies each message's msgid to its msgstr.
103
104</P>
105<P>
106Finally, for those applications where all these various programs are not
107sufficient, a library <SAMP>&lsquo;libgettextpo&rsquo;</SAMP> is provided that can be used to
108write other specialized programs that process PO files.
109
110</P>
111
112
113
114<H2><A NAME="SEC74" HREF="gettext_toc.html#TOC74">9.1  Invoking the <CODE>msgcat</CODE> Program</A></H2>
115
116<P>
117<A NAME="IDX515"></A>
118<A NAME="IDX516"></A>
119
120<PRE>
121msgcat [<VAR>option</VAR>] [<VAR>inputfile</VAR>]...
122</PRE>
123
124<P>
125<A NAME="IDX517"></A>
126<A NAME="IDX518"></A>
127The <CODE>msgcat</CODE> program concatenates and merges the specified PO files.
128It finds messages which are common to two or more of the specified PO files.
129By using the <CODE>--more-than</CODE> option, greater commonality may be requested
130before messages are printed.  Conversely, the <CODE>--less-than</CODE> option may be
131used to specify less commonality before messages are printed (i.e.
132<SAMP>&lsquo;--less-than=2&rsquo;</SAMP> will only print the unique messages).  Translations,
133comments and extract comments will be cumulated, except that if
134<CODE>--use-first</CODE> is specified, they will be taken from the first PO file
135to define them.  File positions from all PO files will be cumulated.
136
137</P>
138
139
140<H3><A NAME="SEC75" HREF="gettext_toc.html#TOC75">9.1.1  Input file location</A></H3>
141
142<DL COMPACT>
143
144<DT><SAMP>&lsquo;<VAR>inputfile</VAR> ...&rsquo;</SAMP>
145<DD>
146Input files.
147
148<DT><SAMP>&lsquo;-f <VAR>file</VAR>&rsquo;</SAMP>
149<DD>
150<DT><SAMP>&lsquo;--files-from=<VAR>file</VAR>&rsquo;</SAMP>
151<DD>
152<A NAME="IDX519"></A>
153<A NAME="IDX520"></A>
154Read the names of the input files from <VAR>file</VAR> instead of getting
155them from the command line.
156
157<DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
158<DD>
159<DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
160<DD>
161<A NAME="IDX521"></A>
162<A NAME="IDX522"></A>
163Add <VAR>directory</VAR> to the list of directories.  Source files are
164searched relative to this list of directories.  The resulting <TT>&lsquo;.po&rsquo;</TT>
165file will be written relative to the current directory, though.
166
167</DL>
168
169<P>
170If <VAR>inputfile</VAR> is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
171
172</P>
173
174
175<H3><A NAME="SEC76" HREF="gettext_toc.html#TOC76">9.1.2  Output file location</A></H3>
176
177<DL COMPACT>
178
179<DT><SAMP>&lsquo;-o <VAR>file</VAR>&rsquo;</SAMP>
180<DD>
181<DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
182<DD>
183<A NAME="IDX523"></A>
184<A NAME="IDX524"></A>
185Write output to specified file.
186
187</DL>
188
189<P>
190<A NAME="IDX525"></A>
191The results are written to standard output if no output file is specified
192or if it is <SAMP>&lsquo;-&rsquo;</SAMP>.
193
194</P>
195
196
197<H3><A NAME="SEC77" HREF="gettext_toc.html#TOC77">9.1.3  Message selection</A></H3>
198
199<DL COMPACT>
200
201<DT><SAMP>&lsquo;-&#60; <VAR>number</VAR>&rsquo;</SAMP>
202<DD>
203<DT><SAMP>&lsquo;--less-than=<VAR>number</VAR>&rsquo;</SAMP>
204<DD>
205<A NAME="IDX526"></A>
206<A NAME="IDX527"></A>
207Print messages with less than <VAR>number</VAR> definitions, defaults to infinite
208if not set.
209
210<DT><SAMP>&lsquo;-&#62; <VAR>number</VAR>&rsquo;</SAMP>
211<DD>
212<DT><SAMP>&lsquo;--more-than=<VAR>number</VAR>&rsquo;</SAMP>
213<DD>
214<A NAME="IDX528"></A>
215<A NAME="IDX529"></A>
216Print messages with more than <VAR>number</VAR> definitions, defaults to 0 if not
217set.
218
219<DT><SAMP>&lsquo;-u&rsquo;</SAMP>
220<DD>
221<DT><SAMP>&lsquo;--unique&rsquo;</SAMP>
222<DD>
223<A NAME="IDX530"></A>
224<A NAME="IDX531"></A>
225Shorthand for <SAMP>&lsquo;--less-than=2&rsquo;</SAMP>.  Requests that only unique messages be
226printed.
227
228</DL>
229
230
231
232<H3><A NAME="SEC78" HREF="gettext_toc.html#TOC78">9.1.4  Input file syntax</A></H3>
233
234<DL COMPACT>
235
236<DT><SAMP>&lsquo;-P&rsquo;</SAMP>
237<DD>
238<DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
239<DD>
240<A NAME="IDX532"></A>
241<A NAME="IDX533"></A>
242Assume the input files are Java ResourceBundles in Java <CODE>.properties</CODE>
243syntax, not in PO file syntax.
244
245<DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
246<DD>
247<A NAME="IDX534"></A>
248Assume the input files are NeXTstep/GNUstep localized resource files in
249<CODE>.strings</CODE> syntax, not in PO file syntax.
250
251</DL>
252
253
254
255<H3><A NAME="SEC79" HREF="gettext_toc.html#TOC79">9.1.5  Output details</A></H3>
256
257<DL COMPACT>
258
259<DT><SAMP>&lsquo;-t&rsquo;</SAMP>
260<DD>
261<DT><SAMP>&lsquo;--to-code=<VAR>name</VAR>&rsquo;</SAMP>
262<DD>
263<A NAME="IDX535"></A>
264<A NAME="IDX536"></A>
265Specify encoding for output.
266
267<DT><SAMP>&lsquo;--use-first&rsquo;</SAMP>
268<DD>
269<A NAME="IDX537"></A>
270Use first available translation for each message.  Don't merge several
271translations into one.
272
273<DT><SAMP>&lsquo;--force-po&rsquo;</SAMP>
274<DD>
275<A NAME="IDX538"></A>
276Always write an output file even if it contains no message.
277
278<DT><SAMP>&lsquo;-i&rsquo;</SAMP>
279<DD>
280<DT><SAMP>&lsquo;--indent&rsquo;</SAMP>
281<DD>
282<A NAME="IDX539"></A>
283<A NAME="IDX540"></A>
284Write the .po file using indented style.
285
286<DT><SAMP>&lsquo;--no-location&rsquo;</SAMP>
287<DD>
288<A NAME="IDX541"></A>
289Do not write <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines.
290
291<DT><SAMP>&lsquo;-n&rsquo;</SAMP>
292<DD>
293<DT><SAMP>&lsquo;--add-location&rsquo;</SAMP>
294<DD>
295<A NAME="IDX542"></A>
296<A NAME="IDX543"></A>
297Generate <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines (default).
298
299<DT><SAMP>&lsquo;--strict&rsquo;</SAMP>
300<DD>
301<A NAME="IDX544"></A>
302Write out a strict Uniforum conforming PO file.  Note that this
303Uniforum format should be avoided because it doesn't support the
304GNU extensions.
305
306<DT><SAMP>&lsquo;-p&rsquo;</SAMP>
307<DD>
308<DT><SAMP>&lsquo;--properties-output&rsquo;</SAMP>
309<DD>
310<A NAME="IDX545"></A>
311<A NAME="IDX546"></A>
312Write out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax.  Note
313that this file format doesn't support plural forms and silently drops
314obsolete messages.
315
316<DT><SAMP>&lsquo;--stringtable-output&rsquo;</SAMP>
317<DD>
318<A NAME="IDX547"></A>
319Write out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
320Note that this file format doesn't support plural forms.
321
322<DT><SAMP>&lsquo;-w <VAR>number</VAR>&rsquo;</SAMP>
323<DD>
324<DT><SAMP>&lsquo;--width=<VAR>number</VAR>&rsquo;</SAMP>
325<DD>
326<A NAME="IDX548"></A>
327<A NAME="IDX549"></A>
328Set the output page width.  Long strings in the output files will be
329split across multiple lines in order to ensure that each line's width
330(= number of screen columns) is less or equal to the given <VAR>number</VAR>.
331
332<DT><SAMP>&lsquo;--no-wrap&rsquo;</SAMP>
333<DD>
334<A NAME="IDX550"></A>
335Do not break long message lines.  Message lines whose width exceeds the
336output page width will not be split into several lines.  Only file reference
337lines which are wider than the output page width will be split.
338
339<DT><SAMP>&lsquo;-s&rsquo;</SAMP>
340<DD>
341<DT><SAMP>&lsquo;--sort-output&rsquo;</SAMP>
342<DD>
343<A NAME="IDX551"></A>
344<A NAME="IDX552"></A>
345<A NAME="IDX553"></A>
346Generate sorted output.  Note that using this option makes it much harder
347for the translator to understand each message's context.
348
349<DT><SAMP>&lsquo;-F&rsquo;</SAMP>
350<DD>
351<DT><SAMP>&lsquo;--sort-by-file&rsquo;</SAMP>
352<DD>
353<A NAME="IDX554"></A>
354<A NAME="IDX555"></A>
355Sort output by file location.
356
357</DL>
358
359
360
361<H3><A NAME="SEC80" HREF="gettext_toc.html#TOC80">9.1.6  Informative output</A></H3>
362
363<DL COMPACT>
364
365<DT><SAMP>&lsquo;-h&rsquo;</SAMP>
366<DD>
367<DT><SAMP>&lsquo;--help&rsquo;</SAMP>
368<DD>
369<A NAME="IDX556"></A>
370<A NAME="IDX557"></A>
371Display this help and exit.
372
373<DT><SAMP>&lsquo;-V&rsquo;</SAMP>
374<DD>
375<DT><SAMP>&lsquo;--version&rsquo;</SAMP>
376<DD>
377<A NAME="IDX558"></A>
378<A NAME="IDX559"></A>
379Output version information and exit.
380
381</DL>
382
383
384
385<H2><A NAME="SEC81" HREF="gettext_toc.html#TOC81">9.2  Invoking the <CODE>msgconv</CODE> Program</A></H2>
386
387<P>
388<A NAME="IDX560"></A>
389<A NAME="IDX561"></A>
390
391<PRE>
392msgconv [<VAR>option</VAR>] [<VAR>inputfile</VAR>]
393</PRE>
394
395<P>
396<A NAME="IDX562"></A>
397The <CODE>msgconv</CODE> program converts a translation catalog to a different
398character encoding.
399
400</P>
401
402
403<H3><A NAME="SEC82" HREF="gettext_toc.html#TOC82">9.2.1  Input file location</A></H3>
404
405<DL COMPACT>
406
407<DT><SAMP>&lsquo;<VAR>inputfile</VAR>&rsquo;</SAMP>
408<DD>
409Input PO file.
410
411<DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
412<DD>
413<DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
414<DD>
415<A NAME="IDX563"></A>
416<A NAME="IDX564"></A>
417Add <VAR>directory</VAR> to the list of directories.  Source files are
418searched relative to this list of directories.  The resulting <TT>&lsquo;.po&rsquo;</TT>
419file will be written relative to the current directory, though.
420
421</DL>
422
423<P>
424If no <VAR>inputfile</VAR> is given or if it is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
425
426</P>
427
428
429<H3><A NAME="SEC83" HREF="gettext_toc.html#TOC83">9.2.2  Output file location</A></H3>
430
431<DL COMPACT>
432
433<DT><SAMP>&lsquo;-o <VAR>file</VAR>&rsquo;</SAMP>
434<DD>
435<DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
436<DD>
437<A NAME="IDX565"></A>
438<A NAME="IDX566"></A>
439Write output to specified file.
440
441</DL>
442
443<P>
444The results are written to standard output if no output file is specified
445or if it is <SAMP>&lsquo;-&rsquo;</SAMP>.
446
447</P>
448
449
450<H3><A NAME="SEC84" HREF="gettext_toc.html#TOC84">9.2.3  Conversion target</A></H3>
451
452<DL COMPACT>
453
454<DT><SAMP>&lsquo;-t&rsquo;</SAMP>
455<DD>
456<DT><SAMP>&lsquo;--to-code=<VAR>name</VAR>&rsquo;</SAMP>
457<DD>
458<A NAME="IDX567"></A>
459<A NAME="IDX568"></A>
460Specify encoding for output.
461
462</DL>
463
464<P>
465The default encoding is the current locale's encoding.
466
467</P>
468
469
470<H3><A NAME="SEC85" HREF="gettext_toc.html#TOC85">9.2.4  Input file syntax</A></H3>
471
472<DL COMPACT>
473
474<DT><SAMP>&lsquo;-P&rsquo;</SAMP>
475<DD>
476<DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
477<DD>
478<A NAME="IDX569"></A>
479<A NAME="IDX570"></A>
480Assume the input file is a Java ResourceBundle in Java <CODE>.properties</CODE>
481syntax, not in PO file syntax.
482
483<DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
484<DD>
485<A NAME="IDX571"></A>
486Assume the input file is a NeXTstep/GNUstep localized resource file in
487<CODE>.strings</CODE> syntax, not in PO file syntax.
488
489</DL>
490
491
492
493<H3><A NAME="SEC86" HREF="gettext_toc.html#TOC86">9.2.5  Output details</A></H3>
494
495<DL COMPACT>
496
497<DT><SAMP>&lsquo;--force-po&rsquo;</SAMP>
498<DD>
499<A NAME="IDX572"></A>
500Always write an output file even if it contains no message.
501
502<DT><SAMP>&lsquo;-i&rsquo;</SAMP>
503<DD>
504<DT><SAMP>&lsquo;--indent&rsquo;</SAMP>
505<DD>
506<A NAME="IDX573"></A>
507<A NAME="IDX574"></A>
508Write the .po file using indented style.
509
510<DT><SAMP>&lsquo;--no-location&rsquo;</SAMP>
511<DD>
512<A NAME="IDX575"></A>
513Do not write <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines.
514
515<DT><SAMP>&lsquo;--add-location&rsquo;</SAMP>
516<DD>
517<A NAME="IDX576"></A>
518Generate <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines (default).
519
520<DT><SAMP>&lsquo;--strict&rsquo;</SAMP>
521<DD>
522<A NAME="IDX577"></A>
523Write out a strict Uniforum conforming PO file.  Note that this
524Uniforum format should be avoided because it doesn't support the
525GNU extensions.
526
527<DT><SAMP>&lsquo;-p&rsquo;</SAMP>
528<DD>
529<DT><SAMP>&lsquo;--properties-output&rsquo;</SAMP>
530<DD>
531<A NAME="IDX578"></A>
532<A NAME="IDX579"></A>
533Write out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax.  Note
534that this file format doesn't support plural forms and silently drops
535obsolete messages.
536
537<DT><SAMP>&lsquo;--stringtable-output&rsquo;</SAMP>
538<DD>
539<A NAME="IDX580"></A>
540Write out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
541Note that this file format doesn't support plural forms.
542
543<DT><SAMP>&lsquo;-w <VAR>number</VAR>&rsquo;</SAMP>
544<DD>
545<DT><SAMP>&lsquo;--width=<VAR>number</VAR>&rsquo;</SAMP>
546<DD>
547<A NAME="IDX581"></A>
548<A NAME="IDX582"></A>
549Set the output page width.  Long strings in the output files will be
550split across multiple lines in order to ensure that each line's width
551(= number of screen columns) is less or equal to the given <VAR>number</VAR>.
552
553<DT><SAMP>&lsquo;--no-wrap&rsquo;</SAMP>
554<DD>
555<A NAME="IDX583"></A>
556Do not break long message lines.  Message lines whose width exceeds the
557output page width will not be split into several lines.  Only file reference
558lines which are wider than the output page width will be split.
559
560<DT><SAMP>&lsquo;-s&rsquo;</SAMP>
561<DD>
562<DT><SAMP>&lsquo;--sort-output&rsquo;</SAMP>
563<DD>
564<A NAME="IDX584"></A>
565<A NAME="IDX585"></A>
566Generate sorted output.  Note that using this option makes it much harder
567for the translator to understand each message's context.
568
569<DT><SAMP>&lsquo;-F&rsquo;</SAMP>
570<DD>
571<DT><SAMP>&lsquo;--sort-by-file&rsquo;</SAMP>
572<DD>
573<A NAME="IDX586"></A>
574<A NAME="IDX587"></A>
575Sort output by file location.
576
577</DL>
578
579
580
581<H3><A NAME="SEC87" HREF="gettext_toc.html#TOC87">9.2.6  Informative output</A></H3>
582
583<DL COMPACT>
584
585<DT><SAMP>&lsquo;-h&rsquo;</SAMP>
586<DD>
587<DT><SAMP>&lsquo;--help&rsquo;</SAMP>
588<DD>
589<A NAME="IDX588"></A>
590<A NAME="IDX589"></A>
591Display this help and exit.
592
593<DT><SAMP>&lsquo;-V&rsquo;</SAMP>
594<DD>
595<DT><SAMP>&lsquo;--version&rsquo;</SAMP>
596<DD>
597<A NAME="IDX590"></A>
598<A NAME="IDX591"></A>
599Output version information and exit.
600
601</DL>
602
603
604
605<H2><A NAME="SEC88" HREF="gettext_toc.html#TOC88">9.3  Invoking the <CODE>msggrep</CODE> Program</A></H2>
606
607<P>
608<A NAME="IDX592"></A>
609<A NAME="IDX593"></A>
610
611<PRE>
612msggrep [<VAR>option</VAR>] [<VAR>inputfile</VAR>]
613</PRE>
614
615<P>
616<A NAME="IDX594"></A>
617The <CODE>msggrep</CODE> program extracts all messages of a translation catalog
618that match a given pattern or belong to some given source files.
619
620</P>
621
622
623<H3><A NAME="SEC89" HREF="gettext_toc.html#TOC89">9.3.1  Input file location</A></H3>
624
625<DL COMPACT>
626
627<DT><SAMP>&lsquo;<VAR>inputfile</VAR>&rsquo;</SAMP>
628<DD>
629Input PO file.
630
631<DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
632<DD>
633<DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
634<DD>
635<A NAME="IDX595"></A>
636<A NAME="IDX596"></A>
637Add <VAR>directory</VAR> to the list of directories.  Source files are
638searched relative to this list of directories.  The resulting <TT>&lsquo;.po&rsquo;</TT>
639file will be written relative to the current directory, though.
640
641</DL>
642
643<P>
644If no <VAR>inputfile</VAR> is given or if it is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
645
646</P>
647
648
649<H3><A NAME="SEC90" HREF="gettext_toc.html#TOC90">9.3.2  Output file location</A></H3>
650
651<DL COMPACT>
652
653<DT><SAMP>&lsquo;-o <VAR>file</VAR>&rsquo;</SAMP>
654<DD>
655<DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
656<DD>
657<A NAME="IDX597"></A>
658<A NAME="IDX598"></A>
659Write output to specified file.
660
661</DL>
662
663<P>
664The results are written to standard output if no output file is specified
665or if it is <SAMP>&lsquo;-&rsquo;</SAMP>.
666
667</P>
668
669
670<H3><A NAME="SEC91" HREF="gettext_toc.html#TOC91">9.3.3  Message selection</A></H3>
671
672
673<PRE>
674  [-N <VAR>sourcefile</VAR>]... [-M <VAR>domainname</VAR>]...
675  [-J <VAR>msgctxt-pattern</VAR> [-K <VAR>msgid-pattern</VAR>] [-T <VAR>msgstr-pattern</VAR>]
676  [-C <VAR>comment-pattern</VAR>]
677</PRE>
678
679<P>
680A message is selected if
681
682<UL>
683<LI>it comes from one of the specified source files,
684
685<LI>or if it comes from one of the specified domains,
686
687<LI>or if <SAMP>&lsquo;-J&rsquo;</SAMP> is given and its context (msgctxt) matches
688
689      <VAR>msgctxt-pattern</VAR>,
690<LI>or if <SAMP>&lsquo;-K&rsquo;</SAMP> is given and its key (msgid or msgid_plural) matches
691
692      <VAR>msgid-pattern</VAR>,
693<LI>or if <SAMP>&lsquo;-T&rsquo;</SAMP> is given and its translation (msgstr) matches
694
695      <VAR>msgstr-pattern</VAR>,
696<LI>or if <SAMP>&lsquo;-C&rsquo;</SAMP> is given and the translator's comment matches
697
698      <VAR>comment-pattern</VAR>.
699</UL>
700
701<P>
702When more than one selection criterion is specified, the set of selected
703messages is the union of the selected messages of each criterion.
704
705</P>
706<P>
707<VAR>msgid-pattern</VAR> or <VAR>msgstr-pattern</VAR> syntax:
708
709<PRE>
710  [-E | -F] [-e <VAR>pattern</VAR> | -f <VAR>file</VAR>]...
711</PRE>
712
713<P>
714<VAR>pattern</VAR>s are basic regular expressions by default, or extended regular
715expressions if -E is given, or fixed strings if -F is given.
716
717</P>
718<DL COMPACT>
719
720<DT><SAMP>&lsquo;-N <VAR>sourcefile</VAR>&rsquo;</SAMP>
721<DD>
722<DT><SAMP>&lsquo;--location=<VAR>sourcefile</VAR>&rsquo;</SAMP>
723<DD>
724<A NAME="IDX599"></A>
725<A NAME="IDX600"></A>
726Select messages extracted from <VAR>sourcefile</VAR>.  <VAR>sourcefile</VAR> can be
727either a literal file name or a wildcard pattern.
728
729<DT><SAMP>&lsquo;-M <VAR>domainname</VAR>&rsquo;</SAMP>
730<DD>
731<DT><SAMP>&lsquo;--domain=<VAR>domainname</VAR>&rsquo;</SAMP>
732<DD>
733<A NAME="IDX601"></A>
734<A NAME="IDX602"></A>
735Select messages belonging to domain <VAR>domainname</VAR>.
736
737<DT><SAMP>&lsquo;-J&rsquo;</SAMP>
738<DD>
739<DT><SAMP>&lsquo;--msgctxt&rsquo;</SAMP>
740<DD>
741<A NAME="IDX603"></A>
742<A NAME="IDX604"></A>
743Start of patterns for the msgctxt.
744
745<DT><SAMP>&lsquo;-K&rsquo;</SAMP>
746<DD>
747<DT><SAMP>&lsquo;--msgid&rsquo;</SAMP>
748<DD>
749<A NAME="IDX605"></A>
750<A NAME="IDX606"></A>
751Start of patterns for the msgid.
752
753<DT><SAMP>&lsquo;-T&rsquo;</SAMP>
754<DD>
755<DT><SAMP>&lsquo;--msgstr&rsquo;</SAMP>
756<DD>
757<A NAME="IDX607"></A>
758<A NAME="IDX608"></A>
759Start of patterns for the msgstr.
760
761<DT><SAMP>&lsquo;-C&rsquo;</SAMP>
762<DD>
763<DT><SAMP>&lsquo;--comment&rsquo;</SAMP>
764<DD>
765<A NAME="IDX609"></A>
766<A NAME="IDX610"></A>
767Start of patterns for the translator's comment.
768
769<DT><SAMP>&lsquo;-X&rsquo;</SAMP>
770<DD>
771<DT><SAMP>&lsquo;--extracted-comment&rsquo;</SAMP>
772<DD>
773<A NAME="IDX611"></A>
774<A NAME="IDX612"></A>
775Start of patterns for the extracted comments.
776
777<DT><SAMP>&lsquo;-E&rsquo;</SAMP>
778<DD>
779<DT><SAMP>&lsquo;--extended-regexp&rsquo;</SAMP>
780<DD>
781<A NAME="IDX613"></A>
782<A NAME="IDX614"></A>
783Specify that <VAR>pattern</VAR> is an extended regular expression.
784
785<DT><SAMP>&lsquo;-F&rsquo;</SAMP>
786<DD>
787<DT><SAMP>&lsquo;--fixed-strings&rsquo;</SAMP>
788<DD>
789<A NAME="IDX615"></A>
790<A NAME="IDX616"></A>
791Specify that <VAR>pattern</VAR> is a set of newline-separated strings.
792
793<DT><SAMP>&lsquo;-e <VAR>pattern</VAR>&rsquo;</SAMP>
794<DD>
795<DT><SAMP>&lsquo;--regexp=<VAR>pattern</VAR>&rsquo;</SAMP>
796<DD>
797<A NAME="IDX617"></A>
798<A NAME="IDX618"></A>
799Use <VAR>pattern</VAR> as a regular expression.
800
801<DT><SAMP>&lsquo;-f <VAR>file</VAR>&rsquo;</SAMP>
802<DD>
803<DT><SAMP>&lsquo;--file=<VAR>file</VAR>&rsquo;</SAMP>
804<DD>
805<A NAME="IDX619"></A>
806<A NAME="IDX620"></A>
807Obtain <VAR>pattern</VAR> from <VAR>file</VAR>.
808
809<DT><SAMP>&lsquo;-i&rsquo;</SAMP>
810<DD>
811<DT><SAMP>&lsquo;--ignore-case&rsquo;</SAMP>
812<DD>
813<A NAME="IDX621"></A>
814<A NAME="IDX622"></A>
815Ignore case distinctions.
816
817<DT><SAMP>&lsquo;-v&rsquo;</SAMP>
818<DD>
819<DT><SAMP>&lsquo;--invert-match&rsquo;</SAMP>
820<DD>
821<A NAME="IDX623"></A>
822<A NAME="IDX624"></A>
823Output only the messages that do not match any selection criterion, instead
824of the messages that match a selection criterion.
825
826</DL>
827
828
829
830<H3><A NAME="SEC92" HREF="gettext_toc.html#TOC92">9.3.4  Input file syntax</A></H3>
831
832<DL COMPACT>
833
834<DT><SAMP>&lsquo;-P&rsquo;</SAMP>
835<DD>
836<DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
837<DD>
838<A NAME="IDX625"></A>
839<A NAME="IDX626"></A>
840Assume the input file is a Java ResourceBundle in Java <CODE>.properties</CODE>
841syntax, not in PO file syntax.
842
843<DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
844<DD>
845<A NAME="IDX627"></A>
846Assume the input file is a NeXTstep/GNUstep localized resource file in
847<CODE>.strings</CODE> syntax, not in PO file syntax.
848
849</DL>
850
851
852
853<H3><A NAME="SEC93" HREF="gettext_toc.html#TOC93">9.3.5  Output details</A></H3>
854
855<DL COMPACT>
856
857<DT><SAMP>&lsquo;--force-po&rsquo;</SAMP>
858<DD>
859<A NAME="IDX628"></A>
860Always write an output file even if it contains no message.
861
862<DT><SAMP>&lsquo;--indent&rsquo;</SAMP>
863<DD>
864<A NAME="IDX629"></A>
865Write the .po file using indented style.
866
867<DT><SAMP>&lsquo;--no-location&rsquo;</SAMP>
868<DD>
869<A NAME="IDX630"></A>
870Do not write <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines.
871
872<DT><SAMP>&lsquo;--add-location&rsquo;</SAMP>
873<DD>
874<A NAME="IDX631"></A>
875Generate <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines (default).
876
877<DT><SAMP>&lsquo;--strict&rsquo;</SAMP>
878<DD>
879<A NAME="IDX632"></A>
880Write out a strict Uniforum conforming PO file.  Note that this
881Uniforum format should be avoided because it doesn't support the
882GNU extensions.
883
884<DT><SAMP>&lsquo;-p&rsquo;</SAMP>
885<DD>
886<DT><SAMP>&lsquo;--properties-output&rsquo;</SAMP>
887<DD>
888<A NAME="IDX633"></A>
889<A NAME="IDX634"></A>
890Write out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax.  Note
891that this file format doesn't support plural forms and silently drops
892obsolete messages.
893
894<DT><SAMP>&lsquo;--stringtable-output&rsquo;</SAMP>
895<DD>
896<A NAME="IDX635"></A>
897Write out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
898Note that this file format doesn't support plural forms.
899
900<DT><SAMP>&lsquo;-w <VAR>number</VAR>&rsquo;</SAMP>
901<DD>
902<DT><SAMP>&lsquo;--width=<VAR>number</VAR>&rsquo;</SAMP>
903<DD>
904<A NAME="IDX636"></A>
905<A NAME="IDX637"></A>
906Set the output page width.  Long strings in the output files will be
907split across multiple lines in order to ensure that each line's width
908(= number of screen columns) is less or equal to the given <VAR>number</VAR>.
909
910<DT><SAMP>&lsquo;--no-wrap&rsquo;</SAMP>
911<DD>
912<A NAME="IDX638"></A>
913Do not break long message lines.  Message lines whose width exceeds the
914output page width will not be split into several lines.  Only file reference
915lines which are wider than the output page width will be split.
916
917<DT><SAMP>&lsquo;--sort-output&rsquo;</SAMP>
918<DD>
919<A NAME="IDX639"></A>
920Generate sorted output.  Note that using this option makes it much harder
921for the translator to understand each message's context.
922
923<DT><SAMP>&lsquo;--sort-by-file&rsquo;</SAMP>
924<DD>
925<A NAME="IDX640"></A>
926Sort output by file location.
927
928</DL>
929
930
931
932<H3><A NAME="SEC94" HREF="gettext_toc.html#TOC94">9.3.6  Informative output</A></H3>
933
934<DL COMPACT>
935
936<DT><SAMP>&lsquo;-h&rsquo;</SAMP>
937<DD>
938<DT><SAMP>&lsquo;--help&rsquo;</SAMP>
939<DD>
940<A NAME="IDX641"></A>
941<A NAME="IDX642"></A>
942Display this help and exit.
943
944<DT><SAMP>&lsquo;-V&rsquo;</SAMP>
945<DD>
946<DT><SAMP>&lsquo;--version&rsquo;</SAMP>
947<DD>
948<A NAME="IDX643"></A>
949<A NAME="IDX644"></A>
950Output version information and exit.
951
952</DL>
953
954
955
956<H2><A NAME="SEC95" HREF="gettext_toc.html#TOC95">9.4  Invoking the <CODE>msgfilter</CODE> Program</A></H2>
957
958<P>
959<A NAME="IDX645"></A>
960<A NAME="IDX646"></A>
961
962<PRE>
963msgfilter [<VAR>option</VAR>] <VAR>filter</VAR> [<VAR>filter-option</VAR>]
964</PRE>
965
966<P>
967<A NAME="IDX647"></A>
968The <CODE>msgfilter</CODE> program applies a filter to all translations of a
969translation catalog.
970
971</P>
972
973
974<H3><A NAME="SEC96" HREF="gettext_toc.html#TOC96">9.4.1  Input file location</A></H3>
975
976<DL COMPACT>
977
978<DT><SAMP>&lsquo;-i <VAR>inputfile</VAR>&rsquo;</SAMP>
979<DD>
980<DT><SAMP>&lsquo;--input=<VAR>inputfile</VAR>&rsquo;</SAMP>
981<DD>
982<A NAME="IDX648"></A>
983<A NAME="IDX649"></A>
984Input PO file.
985
986<DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
987<DD>
988<DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
989<DD>
990<A NAME="IDX650"></A>
991<A NAME="IDX651"></A>
992Add <VAR>directory</VAR> to the list of directories.  Source files are
993searched relative to this list of directories.  The resulting <TT>&lsquo;.po&rsquo;</TT>
994file will be written relative to the current directory, though.
995
996</DL>
997
998<P>
999If no <VAR>inputfile</VAR> is given or if it is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
1000
1001</P>
1002
1003
1004<H3><A NAME="SEC97" HREF="gettext_toc.html#TOC97">9.4.2  Output file location</A></H3>
1005
1006<DL COMPACT>
1007
1008<DT><SAMP>&lsquo;-o <VAR>file</VAR>&rsquo;</SAMP>
1009<DD>
1010<DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
1011<DD>
1012<A NAME="IDX652"></A>
1013<A NAME="IDX653"></A>
1014Write output to specified file.
1015
1016</DL>
1017
1018<P>
1019The results are written to standard output if no output file is specified
1020or if it is <SAMP>&lsquo;-&rsquo;</SAMP>.
1021
1022</P>
1023
1024
1025<H3><A NAME="SEC98" HREF="gettext_toc.html#TOC98">9.4.3  The filter</A></H3>
1026
1027<P>
1028The <VAR>filter</VAR> can be any program that reads a translation from standard
1029input and writes a modified translation to standard output.  A frequently
1030used filter is <SAMP>&lsquo;sed&rsquo;</SAMP>.  A few particular built-in filters are also
1031recognized.
1032
1033</P>
1034<P>
1035<A NAME="IDX654"></A>
1036Note: If the filter is not a built-in filter, you have to care about encodings:
1037It is your responsibility to ensure that the <VAR>filter</VAR> can cope
1038with input encoded in the translation catalog's encoding.  If the
1039<VAR>filter</VAR> wants input in a particular encoding, you can in a first step
1040convert the translation catalog to that encoding using the <SAMP>&lsquo;msgconv&rsquo;</SAMP>
1041program, before invoking <SAMP>&lsquo;msgfilter&rsquo;</SAMP>.  If the <VAR>filter</VAR> wants input
1042in the locale's encoding, but you want to avoid the locale's encoding, then
1043you can first convert the translation catalog to UTF-8 using the
1044<SAMP>&lsquo;msgconv&rsquo;</SAMP> program and then make <SAMP>&lsquo;msgfilter&rsquo;</SAMP> work in an UTF-8
1045locale, by using the <CODE>LC_ALL</CODE> environment variable.
1046
1047</P>
1048<P>
1049<A NAME="IDX655"></A>
1050Note: Most translations in a translation catalog don't end with a newline
1051character.  For this reason, it is important that the <VAR>filter</VAR>
1052recognizes its last input line even if it ends without a newline, and that
1053it doesn't add an undesired trailing newline at the end.  The <SAMP>&lsquo;sed&rsquo;</SAMP>
1054program on some platforms is known to ignore the last line of input if it
1055is not terminated with a newline.  You can use GNU <CODE>sed</CODE> instead; it
1056does not have this limitation.
1057
1058</P>
1059
1060
1061<H3><A NAME="SEC99" HREF="gettext_toc.html#TOC99">9.4.4  Useful <VAR>filter-option</VAR>s when the <VAR>filter</VAR> is <SAMP>&lsquo;sed&rsquo;</SAMP></A></H3>
1062
1063<DL COMPACT>
1064
1065<DT><SAMP>&lsquo;-e <VAR>script</VAR>&rsquo;</SAMP>
1066<DD>
1067<DT><SAMP>&lsquo;--expression=<VAR>script</VAR>&rsquo;</SAMP>
1068<DD>
1069<A NAME="IDX656"></A>
1070<A NAME="IDX657"></A>
1071Add <VAR>script</VAR> to the commands to be executed.
1072
1073<DT><SAMP>&lsquo;-f <VAR>scriptfile</VAR>&rsquo;</SAMP>
1074<DD>
1075<DT><SAMP>&lsquo;--file=<VAR>scriptfile</VAR>&rsquo;</SAMP>
1076<DD>
1077<A NAME="IDX658"></A>
1078<A NAME="IDX659"></A>
1079Add the contents of <VAR>scriptfile</VAR> to the commands to be executed.
1080
1081<DT><SAMP>&lsquo;-n&rsquo;</SAMP>
1082<DD>
1083<DT><SAMP>&lsquo;--quiet&rsquo;</SAMP>
1084<DD>
1085<DT><SAMP>&lsquo;--silent&rsquo;</SAMP>
1086<DD>
1087<A NAME="IDX660"></A>
1088<A NAME="IDX661"></A>
1089<A NAME="IDX662"></A>
1090Suppress automatic printing of pattern space.
1091
1092</DL>
1093
1094
1095
1096<H3><A NAME="SEC100" HREF="gettext_toc.html#TOC100">9.4.5  Built-in <VAR>filter</VAR>s</A></H3>
1097
1098<P>
1099<A NAME="IDX663"></A>
1100<A NAME="IDX664"></A>
1101The filter <SAMP>&lsquo;recode-sr-latin&rsquo;</SAMP> is recognized as a built-in filter.
1102The command <SAMP>&lsquo;recode-sr-latin&rsquo;</SAMP> converts Serbian text, written in the
1103Cyrillic script, to the Latin script.
1104The command <SAMP>&lsquo;msgfilter recode-sr-latin&rsquo;</SAMP> applies this conversion to the
1105translations of a PO file.  Thus, it can be used to convert an <TT>&lsquo;sr.po&rsquo;</TT>
1106file to an <TT>&lsquo;sr@latin.po&rsquo;</TT> file.
1107
1108</P>
1109<P>
1110The use of built-in filters is not sensitive to the current locale's encoding.
1111Moreover, when used with a built-in filter, <SAMP>&lsquo;msgfilter&rsquo;</SAMP> can automatically
1112convert the message catalog to the UTF-8 encoding when needed.
1113
1114</P>
1115
1116
1117<H3><A NAME="SEC101" HREF="gettext_toc.html#TOC101">9.4.6  Input file syntax</A></H3>
1118
1119<DL COMPACT>
1120
1121<DT><SAMP>&lsquo;-P&rsquo;</SAMP>
1122<DD>
1123<DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
1124<DD>
1125<A NAME="IDX665"></A>
1126<A NAME="IDX666"></A>
1127Assume the input file is a Java ResourceBundle in Java <CODE>.properties</CODE>
1128syntax, not in PO file syntax.
1129
1130<DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
1131<DD>
1132<A NAME="IDX667"></A>
1133Assume the input file is a NeXTstep/GNUstep localized resource file in
1134<CODE>.strings</CODE> syntax, not in PO file syntax.
1135
1136</DL>
1137
1138
1139
1140<H3><A NAME="SEC102" HREF="gettext_toc.html#TOC102">9.4.7  Output details</A></H3>
1141
1142<DL COMPACT>
1143
1144<DT><SAMP>&lsquo;--force-po&rsquo;</SAMP>
1145<DD>
1146<A NAME="IDX668"></A>
1147Always write an output file even if it contains no message.
1148
1149<DT><SAMP>&lsquo;--indent&rsquo;</SAMP>
1150<DD>
1151<A NAME="IDX669"></A>
1152Write the .po file using indented style.
1153
1154<DT><SAMP>&lsquo;--keep-header&rsquo;</SAMP>
1155<DD>
1156<A NAME="IDX670"></A>
1157Keep the header entry, i.e. the message with <SAMP>&lsquo;msgid ""&rsquo;</SAMP>, unmodified,
1158instead of filtering it.  By default, the header entry is subject to
1159filtering like any other message.
1160
1161<DT><SAMP>&lsquo;--no-location&rsquo;</SAMP>
1162<DD>
1163<A NAME="IDX671"></A>
1164Do not write <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines.
1165
1166<DT><SAMP>&lsquo;--add-location&rsquo;</SAMP>
1167<DD>
1168<A NAME="IDX672"></A>
1169Generate <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines (default).
1170
1171<DT><SAMP>&lsquo;--strict&rsquo;</SAMP>
1172<DD>
1173<A NAME="IDX673"></A>
1174Write out a strict Uniforum conforming PO file.  Note that this
1175Uniforum format should be avoided because it doesn't support the
1176GNU extensions.
1177
1178<DT><SAMP>&lsquo;-p&rsquo;</SAMP>
1179<DD>
1180<DT><SAMP>&lsquo;--properties-output&rsquo;</SAMP>
1181<DD>
1182<A NAME="IDX674"></A>
1183<A NAME="IDX675"></A>
1184Write out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax.  Note
1185that this file format doesn't support plural forms and silently drops
1186obsolete messages.
1187
1188<DT><SAMP>&lsquo;--stringtable-output&rsquo;</SAMP>
1189<DD>
1190<A NAME="IDX676"></A>
1191Write out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
1192Note that this file format doesn't support plural forms.
1193
1194<DT><SAMP>&lsquo;-w <VAR>number</VAR>&rsquo;</SAMP>
1195<DD>
1196<DT><SAMP>&lsquo;--width=<VAR>number</VAR>&rsquo;</SAMP>
1197<DD>
1198<A NAME="IDX677"></A>
1199<A NAME="IDX678"></A>
1200Set the output page width.  Long strings in the output files will be
1201split across multiple lines in order to ensure that each line's width
1202(= number of screen columns) is less or equal to the given <VAR>number</VAR>.
1203
1204<DT><SAMP>&lsquo;--no-wrap&rsquo;</SAMP>
1205<DD>
1206<A NAME="IDX679"></A>
1207Do not break long message lines.  Message lines whose width exceeds the
1208output page width will not be split into several lines.  Only file reference
1209lines which are wider than the output page width will be split.
1210
1211<DT><SAMP>&lsquo;-s&rsquo;</SAMP>
1212<DD>
1213<DT><SAMP>&lsquo;--sort-output&rsquo;</SAMP>
1214<DD>
1215<A NAME="IDX680"></A>
1216<A NAME="IDX681"></A>
1217Generate sorted output.  Note that using this option makes it much harder
1218for the translator to understand each message's context.
1219
1220<DT><SAMP>&lsquo;-F&rsquo;</SAMP>
1221<DD>
1222<DT><SAMP>&lsquo;--sort-by-file&rsquo;</SAMP>
1223<DD>
1224<A NAME="IDX682"></A>
1225<A NAME="IDX683"></A>
1226Sort output by file location.
1227
1228</DL>
1229
1230
1231
1232<H3><A NAME="SEC103" HREF="gettext_toc.html#TOC103">9.4.8  Informative output</A></H3>
1233
1234<DL COMPACT>
1235
1236<DT><SAMP>&lsquo;-h&rsquo;</SAMP>
1237<DD>
1238<DT><SAMP>&lsquo;--help&rsquo;</SAMP>
1239<DD>
1240<A NAME="IDX684"></A>
1241<A NAME="IDX685"></A>
1242Display this help and exit.
1243
1244<DT><SAMP>&lsquo;-V&rsquo;</SAMP>
1245<DD>
1246<DT><SAMP>&lsquo;--version&rsquo;</SAMP>
1247<DD>
1248<A NAME="IDX686"></A>
1249<A NAME="IDX687"></A>
1250Output version information and exit.
1251
1252</DL>
1253
1254
1255
1256<H2><A NAME="SEC104" HREF="gettext_toc.html#TOC104">9.5  Invoking the <CODE>msguniq</CODE> Program</A></H2>
1257
1258<P>
1259<A NAME="IDX688"></A>
1260<A NAME="IDX689"></A>
1261
1262<PRE>
1263msguniq [<VAR>option</VAR>] [<VAR>inputfile</VAR>]
1264</PRE>
1265
1266<P>
1267<A NAME="IDX690"></A>
1268<A NAME="IDX691"></A>
1269The <CODE>msguniq</CODE> program unifies duplicate translations in a translation
1270catalog.  It finds duplicate translations of the same message ID.  Such
1271duplicates are invalid input for other programs like <CODE>msgfmt</CODE>,
1272<CODE>msgmerge</CODE> or <CODE>msgcat</CODE>.  By default, duplicates are merged
1273together.  When using the <SAMP>&lsquo;--repeated&rsquo;</SAMP> option, only duplicates are
1274output, and all other messages are discarded.  Comments and extracted
1275comments will be cumulated, except that if <SAMP>&lsquo;--use-first&rsquo;</SAMP> is
1276specified, they will be taken from the first translation.  File positions
1277will be cumulated.  When using the <SAMP>&lsquo;--unique&rsquo;</SAMP> option, duplicates are
1278discarded.
1279
1280</P>
1281
1282
1283<H3><A NAME="SEC105" HREF="gettext_toc.html#TOC105">9.5.1  Input file location</A></H3>
1284
1285<DL COMPACT>
1286
1287<DT><SAMP>&lsquo;<VAR>inputfile</VAR>&rsquo;</SAMP>
1288<DD>
1289Input PO file.
1290
1291<DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
1292<DD>
1293<DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
1294<DD>
1295<A NAME="IDX692"></A>
1296<A NAME="IDX693"></A>
1297Add <VAR>directory</VAR> to the list of directories.  Source files are
1298searched relative to this list of directories.  The resulting <TT>&lsquo;.po&rsquo;</TT>
1299file will be written relative to the current directory, though.
1300
1301</DL>
1302
1303<P>
1304If no <VAR>inputfile</VAR> is given or if it is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
1305
1306</P>
1307
1308
1309<H3><A NAME="SEC106" HREF="gettext_toc.html#TOC106">9.5.2  Output file location</A></H3>
1310
1311<DL COMPACT>
1312
1313<DT><SAMP>&lsquo;-o <VAR>file</VAR>&rsquo;</SAMP>
1314<DD>
1315<DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
1316<DD>
1317<A NAME="IDX694"></A>
1318<A NAME="IDX695"></A>
1319Write output to specified file.
1320
1321</DL>
1322
1323<P>
1324The results are written to standard output if no output file is specified
1325or if it is <SAMP>&lsquo;-&rsquo;</SAMP>.
1326
1327</P>
1328
1329
1330<H3><A NAME="SEC107" HREF="gettext_toc.html#TOC107">9.5.3  Message selection</A></H3>
1331
1332<DL COMPACT>
1333
1334<DT><SAMP>&lsquo;-d&rsquo;</SAMP>
1335<DD>
1336<DT><SAMP>&lsquo;--repeated&rsquo;</SAMP>
1337<DD>
1338<A NAME="IDX696"></A>
1339<A NAME="IDX697"></A>
1340Print only duplicates.
1341
1342<DT><SAMP>&lsquo;-u&rsquo;</SAMP>
1343<DD>
1344<DT><SAMP>&lsquo;--unique&rsquo;</SAMP>
1345<DD>
1346<A NAME="IDX698"></A>
1347<A NAME="IDX699"></A>
1348Print only unique messages, discard duplicates.
1349
1350</DL>
1351
1352
1353
1354<H3><A NAME="SEC108" HREF="gettext_toc.html#TOC108">9.5.4  Input file syntax</A></H3>
1355
1356<DL COMPACT>
1357
1358<DT><SAMP>&lsquo;-P&rsquo;</SAMP>
1359<DD>
1360<DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
1361<DD>
1362<A NAME="IDX700"></A>
1363<A NAME="IDX701"></A>
1364Assume the input file is a Java ResourceBundle in Java <CODE>.properties</CODE>
1365syntax, not in PO file syntax.
1366
1367<DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
1368<DD>
1369<A NAME="IDX702"></A>
1370Assume the input file is a NeXTstep/GNUstep localized resource file in
1371<CODE>.strings</CODE> syntax, not in PO file syntax.
1372
1373</DL>
1374
1375
1376
1377<H3><A NAME="SEC109" HREF="gettext_toc.html#TOC109">9.5.5  Output details</A></H3>
1378
1379<DL COMPACT>
1380
1381<DT><SAMP>&lsquo;-t&rsquo;</SAMP>
1382<DD>
1383<DT><SAMP>&lsquo;--to-code=<VAR>name</VAR>&rsquo;</SAMP>
1384<DD>
1385<A NAME="IDX703"></A>
1386<A NAME="IDX704"></A>
1387Specify encoding for output.
1388
1389<DT><SAMP>&lsquo;--use-first&rsquo;</SAMP>
1390<DD>
1391<A NAME="IDX705"></A>
1392Use first available translation for each message.  Don't merge several
1393translations into one.
1394
1395<DT><SAMP>&lsquo;--force-po&rsquo;</SAMP>
1396<DD>
1397<A NAME="IDX706"></A>
1398Always write an output file even if it contains no message.
1399
1400<DT><SAMP>&lsquo;-i&rsquo;</SAMP>
1401<DD>
1402<DT><SAMP>&lsquo;--indent&rsquo;</SAMP>
1403<DD>
1404<A NAME="IDX707"></A>
1405<A NAME="IDX708"></A>
1406Write the .po file using indented style.
1407
1408<DT><SAMP>&lsquo;--no-location&rsquo;</SAMP>
1409<DD>
1410<A NAME="IDX709"></A>
1411Do not write <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines.
1412
1413<DT><SAMP>&lsquo;-n&rsquo;</SAMP>
1414<DD>
1415<DT><SAMP>&lsquo;--add-location&rsquo;</SAMP>
1416<DD>
1417<A NAME="IDX710"></A>
1418<A NAME="IDX711"></A>
1419Generate <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines (default).
1420
1421<DT><SAMP>&lsquo;--strict&rsquo;</SAMP>
1422<DD>
1423<A NAME="IDX712"></A>
1424Write out a strict Uniforum conforming PO file.  Note that this
1425Uniforum format should be avoided because it doesn't support the
1426GNU extensions.
1427
1428<DT><SAMP>&lsquo;-p&rsquo;</SAMP>
1429<DD>
1430<DT><SAMP>&lsquo;--properties-output&rsquo;</SAMP>
1431<DD>
1432<A NAME="IDX713"></A>
1433<A NAME="IDX714"></A>
1434Write out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax.  Note
1435that this file format doesn't support plural forms and silently drops
1436obsolete messages.
1437
1438<DT><SAMP>&lsquo;--stringtable-output&rsquo;</SAMP>
1439<DD>
1440<A NAME="IDX715"></A>
1441Write out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
1442Note that this file format doesn't support plural forms.
1443
1444<DT><SAMP>&lsquo;-w <VAR>number</VAR>&rsquo;</SAMP>
1445<DD>
1446<DT><SAMP>&lsquo;--width=<VAR>number</VAR>&rsquo;</SAMP>
1447<DD>
1448<A NAME="IDX716"></A>
1449<A NAME="IDX717"></A>
1450Set the output page width.  Long strings in the output files will be
1451split across multiple lines in order to ensure that each line's width
1452(= number of screen columns) is less or equal to the given <VAR>number</VAR>.
1453
1454<DT><SAMP>&lsquo;--no-wrap&rsquo;</SAMP>
1455<DD>
1456<A NAME="IDX718"></A>
1457Do not break long message lines.  Message lines whose width exceeds the
1458output page width will not be split into several lines.  Only file reference
1459lines which are wider than the output page width will be split.
1460
1461<DT><SAMP>&lsquo;-s&rsquo;</SAMP>
1462<DD>
1463<DT><SAMP>&lsquo;--sort-output&rsquo;</SAMP>
1464<DD>
1465<A NAME="IDX719"></A>
1466<A NAME="IDX720"></A>
1467Generate sorted output.  Note that using this option makes it much harder
1468for the translator to understand each message's context.
1469
1470<DT><SAMP>&lsquo;-F&rsquo;</SAMP>
1471<DD>
1472<DT><SAMP>&lsquo;--sort-by-file&rsquo;</SAMP>
1473<DD>
1474<A NAME="IDX721"></A>
1475<A NAME="IDX722"></A>
1476Sort output by file location.
1477
1478</DL>
1479
1480
1481
1482<H3><A NAME="SEC110" HREF="gettext_toc.html#TOC110">9.5.6  Informative output</A></H3>
1483
1484<DL COMPACT>
1485
1486<DT><SAMP>&lsquo;-h&rsquo;</SAMP>
1487<DD>
1488<DT><SAMP>&lsquo;--help&rsquo;</SAMP>
1489<DD>
1490<A NAME="IDX723"></A>
1491<A NAME="IDX724"></A>
1492Display this help and exit.
1493
1494<DT><SAMP>&lsquo;-V&rsquo;</SAMP>
1495<DD>
1496<DT><SAMP>&lsquo;--version&rsquo;</SAMP>
1497<DD>
1498<A NAME="IDX725"></A>
1499<A NAME="IDX726"></A>
1500Output version information and exit.
1501
1502</DL>
1503
1504
1505
1506<H2><A NAME="SEC111" HREF="gettext_toc.html#TOC111">9.6  Invoking the <CODE>msgcomm</CODE> Program</A></H2>
1507
1508<P>
1509<A NAME="IDX727"></A>
1510<A NAME="IDX728"></A>
1511
1512<PRE>
1513msgcomm [<VAR>option</VAR>] [<VAR>inputfile</VAR>]...
1514</PRE>
1515
1516<P>
1517<A NAME="IDX729"></A>
1518The <CODE>msgcomm</CODE> program finds messages which are common to two or more
1519of the specified PO files.
1520By using the <CODE>--more-than</CODE> option, greater commonality may be requested
1521before messages are printed.  Conversely, the <CODE>--less-than</CODE> option may be
1522used to specify less commonality before messages are printed (i.e.
1523<SAMP>&lsquo;--less-than=2&rsquo;</SAMP> will only print the unique messages).  Translations,
1524comments and extract comments will be preserved, but only from the first
1525PO file to define them.  File positions from all PO files will be
1526cumulated.
1527
1528</P>
1529
1530
1531<H3><A NAME="SEC112" HREF="gettext_toc.html#TOC112">9.6.1  Input file location</A></H3>
1532
1533<DL COMPACT>
1534
1535<DT><SAMP>&lsquo;<VAR>inputfile</VAR> ...&rsquo;</SAMP>
1536<DD>
1537Input files.
1538
1539<DT><SAMP>&lsquo;-f <VAR>file</VAR>&rsquo;</SAMP>
1540<DD>
1541<DT><SAMP>&lsquo;--files-from=<VAR>file</VAR>&rsquo;</SAMP>
1542<DD>
1543<A NAME="IDX730"></A>
1544<A NAME="IDX731"></A>
1545Read the names of the input files from <VAR>file</VAR> instead of getting
1546them from the command line.
1547
1548<DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
1549<DD>
1550<DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
1551<DD>
1552<A NAME="IDX732"></A>
1553<A NAME="IDX733"></A>
1554Add <VAR>directory</VAR> to the list of directories.  Source files are
1555searched relative to this list of directories.  The resulting <TT>&lsquo;.po&rsquo;</TT>
1556file will be written relative to the current directory, though.
1557
1558</DL>
1559
1560<P>
1561If <VAR>inputfile</VAR> is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
1562
1563</P>
1564
1565
1566<H3><A NAME="SEC113" HREF="gettext_toc.html#TOC113">9.6.2  Output file location</A></H3>
1567
1568<DL COMPACT>
1569
1570<DT><SAMP>&lsquo;-o <VAR>file</VAR>&rsquo;</SAMP>
1571<DD>
1572<DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
1573<DD>
1574<A NAME="IDX734"></A>
1575<A NAME="IDX735"></A>
1576Write output to specified file.
1577
1578</DL>
1579
1580<P>
1581The results are written to standard output if no output file is specified
1582or if it is <SAMP>&lsquo;-&rsquo;</SAMP>.
1583
1584</P>
1585
1586
1587<H3><A NAME="SEC114" HREF="gettext_toc.html#TOC114">9.6.3  Message selection</A></H3>
1588
1589<DL COMPACT>
1590
1591<DT><SAMP>&lsquo;-&#60; <VAR>number</VAR>&rsquo;</SAMP>
1592<DD>
1593<DT><SAMP>&lsquo;--less-than=<VAR>number</VAR>&rsquo;</SAMP>
1594<DD>
1595<A NAME="IDX736"></A>
1596<A NAME="IDX737"></A>
1597Print messages with less than <VAR>number</VAR> definitions, defaults to infinite
1598if not set.
1599
1600<DT><SAMP>&lsquo;-&#62; <VAR>number</VAR>&rsquo;</SAMP>
1601<DD>
1602<DT><SAMP>&lsquo;--more-than=<VAR>number</VAR>&rsquo;</SAMP>
1603<DD>
1604<A NAME="IDX738"></A>
1605<A NAME="IDX739"></A>
1606Print messages with more than <VAR>number</VAR> definitions, defaults to 1 if not
1607set.
1608
1609<DT><SAMP>&lsquo;-u&rsquo;</SAMP>
1610<DD>
1611<DT><SAMP>&lsquo;--unique&rsquo;</SAMP>
1612<DD>
1613<A NAME="IDX740"></A>
1614<A NAME="IDX741"></A>
1615Shorthand for <SAMP>&lsquo;--less-than=2&rsquo;</SAMP>.  Requests that only unique messages be
1616printed.
1617
1618</DL>
1619
1620
1621
1622<H3><A NAME="SEC115" HREF="gettext_toc.html#TOC115">9.6.4  Input file syntax</A></H3>
1623
1624<DL COMPACT>
1625
1626<DT><SAMP>&lsquo;-P&rsquo;</SAMP>
1627<DD>
1628<DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
1629<DD>
1630<A NAME="IDX742"></A>
1631<A NAME="IDX743"></A>
1632Assume the input files are Java ResourceBundles in Java <CODE>.properties</CODE>
1633syntax, not in PO file syntax.
1634
1635<DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
1636<DD>
1637<A NAME="IDX744"></A>
1638Assume the input files are NeXTstep/GNUstep localized resource files in
1639<CODE>.strings</CODE> syntax, not in PO file syntax.
1640
1641</DL>
1642
1643
1644
1645<H3><A NAME="SEC116" HREF="gettext_toc.html#TOC116">9.6.5  Output details</A></H3>
1646
1647<DL COMPACT>
1648
1649<DT><SAMP>&lsquo;--force-po&rsquo;</SAMP>
1650<DD>
1651<A NAME="IDX745"></A>
1652Always write an output file even if it contains no message.
1653
1654<DT><SAMP>&lsquo;-i&rsquo;</SAMP>
1655<DD>
1656<DT><SAMP>&lsquo;--indent&rsquo;</SAMP>
1657<DD>
1658<A NAME="IDX746"></A>
1659<A NAME="IDX747"></A>
1660Write the .po file using indented style.
1661
1662<DT><SAMP>&lsquo;--no-location&rsquo;</SAMP>
1663<DD>
1664<A NAME="IDX748"></A>
1665Do not write <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines.
1666
1667<DT><SAMP>&lsquo;-n&rsquo;</SAMP>
1668<DD>
1669<DT><SAMP>&lsquo;--add-location&rsquo;</SAMP>
1670<DD>
1671<A NAME="IDX749"></A>
1672<A NAME="IDX750"></A>
1673Generate <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines (default).
1674
1675<DT><SAMP>&lsquo;--strict&rsquo;</SAMP>
1676<DD>
1677<A NAME="IDX751"></A>
1678Write out a strict Uniforum conforming PO file.  Note that this
1679Uniforum format should be avoided because it doesn't support the
1680GNU extensions.
1681
1682<DT><SAMP>&lsquo;-p&rsquo;</SAMP>
1683<DD>
1684<DT><SAMP>&lsquo;--properties-output&rsquo;</SAMP>
1685<DD>
1686<A NAME="IDX752"></A>
1687<A NAME="IDX753"></A>
1688Write out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax.  Note
1689that this file format doesn't support plural forms and silently drops
1690obsolete messages.
1691
1692<DT><SAMP>&lsquo;--stringtable-output&rsquo;</SAMP>
1693<DD>
1694<A NAME="IDX754"></A>
1695Write out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
1696Note that this file format doesn't support plural forms.
1697
1698<DT><SAMP>&lsquo;-w <VAR>number</VAR>&rsquo;</SAMP>
1699<DD>
1700<DT><SAMP>&lsquo;--width=<VAR>number</VAR>&rsquo;</SAMP>
1701<DD>
1702<A NAME="IDX755"></A>
1703<A NAME="IDX756"></A>
1704Set the output page width.  Long strings in the output files will be
1705split across multiple lines in order to ensure that each line's width
1706(= number of screen columns) is less or equal to the given <VAR>number</VAR>.
1707
1708<DT><SAMP>&lsquo;--no-wrap&rsquo;</SAMP>
1709<DD>
1710<A NAME="IDX757"></A>
1711Do not break long message lines.  Message lines whose width exceeds the
1712output page width will not be split into several lines.  Only file reference
1713lines which are wider than the output page width will be split.
1714
1715<DT><SAMP>&lsquo;-s&rsquo;</SAMP>
1716<DD>
1717<DT><SAMP>&lsquo;--sort-output&rsquo;</SAMP>
1718<DD>
1719<A NAME="IDX758"></A>
1720<A NAME="IDX759"></A>
1721Generate sorted output.  Note that using this option makes it much harder
1722for the translator to understand each message's context.
1723
1724<DT><SAMP>&lsquo;-F&rsquo;</SAMP>
1725<DD>
1726<DT><SAMP>&lsquo;--sort-by-file&rsquo;</SAMP>
1727<DD>
1728<A NAME="IDX760"></A>
1729<A NAME="IDX761"></A>
1730Sort output by file location.
1731
1732<DT><SAMP>&lsquo;--omit-header&rsquo;</SAMP>
1733<DD>
1734<A NAME="IDX762"></A>
1735Don't write header with <SAMP>&lsquo;msgid ""&rsquo;</SAMP> entry.
1736
1737</DL>
1738
1739
1740
1741<H3><A NAME="SEC117" HREF="gettext_toc.html#TOC117">9.6.6  Informative output</A></H3>
1742
1743<DL COMPACT>
1744
1745<DT><SAMP>&lsquo;-h&rsquo;</SAMP>
1746<DD>
1747<DT><SAMP>&lsquo;--help&rsquo;</SAMP>
1748<DD>
1749<A NAME="IDX763"></A>
1750<A NAME="IDX764"></A>
1751Display this help and exit.
1752
1753<DT><SAMP>&lsquo;-V&rsquo;</SAMP>
1754<DD>
1755<DT><SAMP>&lsquo;--version&rsquo;</SAMP>
1756<DD>
1757<A NAME="IDX765"></A>
1758<A NAME="IDX766"></A>
1759Output version information and exit.
1760
1761</DL>
1762
1763
1764
1765<H2><A NAME="SEC118" HREF="gettext_toc.html#TOC118">9.7  Invoking the <CODE>msgcmp</CODE> Program</A></H2>
1766
1767<P>
1768<A NAME="IDX767"></A>
1769<A NAME="IDX768"></A>
1770
1771<PRE>
1772msgcmp [<VAR>option</VAR>] <VAR>def</VAR>.po <VAR>ref</VAR>.pot
1773</PRE>
1774
1775<P>
1776<A NAME="IDX769"></A>
1777The <CODE>msgcmp</CODE> program compares two Uniforum style .po files to check that
1778both contain the same set of msgid strings.  The <VAR>def</VAR>.po file is an
1779existing PO file with the translations.  The <VAR>ref</VAR>.pot file is the last
1780created PO file, or a PO Template file (generally created by <CODE>xgettext</CODE>).
1781This is useful for checking that you have translated each and every message
1782in your program.  Where an exact match cannot be found, fuzzy matching is
1783used to produce better diagnostics.
1784
1785</P>
1786
1787
1788<H3><A NAME="SEC119" HREF="gettext_toc.html#TOC119">9.7.1  Input file location</A></H3>
1789
1790<DL COMPACT>
1791
1792<DT><SAMP>&lsquo;<VAR>def</VAR>.po&rsquo;</SAMP>
1793<DD>
1794Translations.
1795
1796<DT><SAMP>&lsquo;<VAR>ref</VAR>.pot&rsquo;</SAMP>
1797<DD>
1798References to the sources.
1799
1800<DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
1801<DD>
1802<DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
1803<DD>
1804<A NAME="IDX770"></A>
1805<A NAME="IDX771"></A>
1806Add <VAR>directory</VAR> to the list of directories.  Source files are
1807searched relative to this list of directories.
1808
1809</DL>
1810
1811
1812
1813<H3><A NAME="SEC120" HREF="gettext_toc.html#TOC120">9.7.2  Operation modifiers</A></H3>
1814
1815<DL COMPACT>
1816
1817<DT><SAMP>&lsquo;-m&rsquo;</SAMP>
1818<DD>
1819<DT><SAMP>&lsquo;--multi-domain&rsquo;</SAMP>
1820<DD>
1821<A NAME="IDX772"></A>
1822<A NAME="IDX773"></A>
1823Apply <VAR>ref</VAR>.pot to each of the domains in <VAR>def</VAR>.po.
1824
1825<DT><SAMP>&lsquo;--use-fuzzy&rsquo;</SAMP>
1826<DD>
1827<A NAME="IDX774"></A>
1828Consider fuzzy messages in the <VAR>def</VAR>.po file like translated messages.
1829Note that using this option is usually wrong, because fuzzy messages are
1830exactly those which have not been validated by a human translator.
1831
1832<DT><SAMP>&lsquo;--use-untranslated&rsquo;</SAMP>
1833<DD>
1834<A NAME="IDX775"></A>
1835Consider untranslated messages in the <VAR>def</VAR>.po file like translated
1836messages.  Note that using this option is usually wrong.
1837
1838</DL>
1839
1840
1841
1842<H3><A NAME="SEC121" HREF="gettext_toc.html#TOC121">9.7.3  Input file syntax</A></H3>
1843
1844<DL COMPACT>
1845
1846<DT><SAMP>&lsquo;-P&rsquo;</SAMP>
1847<DD>
1848<DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
1849<DD>
1850<A NAME="IDX776"></A>
1851<A NAME="IDX777"></A>
1852Assume the input files are Java ResourceBundles in Java <CODE>.properties</CODE>
1853syntax, not in PO file syntax.
1854
1855<DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
1856<DD>
1857<A NAME="IDX778"></A>
1858Assume the input files are NeXTstep/GNUstep localized resource files in
1859<CODE>.strings</CODE> syntax, not in PO file syntax.
1860
1861</DL>
1862
1863
1864
1865<H3><A NAME="SEC122" HREF="gettext_toc.html#TOC122">9.7.4  Informative output</A></H3>
1866
1867<DL COMPACT>
1868
1869<DT><SAMP>&lsquo;-h&rsquo;</SAMP>
1870<DD>
1871<DT><SAMP>&lsquo;--help&rsquo;</SAMP>
1872<DD>
1873<A NAME="IDX779"></A>
1874<A NAME="IDX780"></A>
1875Display this help and exit.
1876
1877<DT><SAMP>&lsquo;-V&rsquo;</SAMP>
1878<DD>
1879<DT><SAMP>&lsquo;--version&rsquo;</SAMP>
1880<DD>
1881<A NAME="IDX781"></A>
1882<A NAME="IDX782"></A>
1883Output version information and exit.
1884
1885</DL>
1886
1887
1888
1889<H2><A NAME="SEC123" HREF="gettext_toc.html#TOC123">9.8  Invoking the <CODE>msgattrib</CODE> Program</A></H2>
1890
1891<P>
1892<A NAME="IDX783"></A>
1893<A NAME="IDX784"></A>
1894
1895<PRE>
1896msgattrib [<VAR>option</VAR>] [<VAR>inputfile</VAR>]
1897</PRE>
1898
1899<P>
1900<A NAME="IDX785"></A>
1901<A NAME="IDX786"></A>
1902The <CODE>msgattrib</CODE> program filters the messages of a translation catalog
1903according to their attributes, and manipulates the attributes.
1904
1905</P>
1906
1907
1908<H3><A NAME="SEC124" HREF="gettext_toc.html#TOC124">9.8.1  Input file location</A></H3>
1909
1910<DL COMPACT>
1911
1912<DT><SAMP>&lsquo;<VAR>inputfile</VAR>&rsquo;</SAMP>
1913<DD>
1914Input PO file.
1915
1916<DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
1917<DD>
1918<DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
1919<DD>
1920<A NAME="IDX787"></A>
1921<A NAME="IDX788"></A>
1922Add <VAR>directory</VAR> to the list of directories.  Source files are
1923searched relative to this list of directories.  The resulting <TT>&lsquo;.po&rsquo;</TT>
1924file will be written relative to the current directory, though.
1925
1926</DL>
1927
1928<P>
1929If no <VAR>inputfile</VAR> is given or if it is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
1930
1931</P>
1932
1933
1934<H3><A NAME="SEC125" HREF="gettext_toc.html#TOC125">9.8.2  Output file location</A></H3>
1935
1936<DL COMPACT>
1937
1938<DT><SAMP>&lsquo;-o <VAR>file</VAR>&rsquo;</SAMP>
1939<DD>
1940<DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
1941<DD>
1942<A NAME="IDX789"></A>
1943<A NAME="IDX790"></A>
1944Write output to specified file.
1945
1946</DL>
1947
1948<P>
1949The results are written to standard output if no output file is specified
1950or if it is <SAMP>&lsquo;-&rsquo;</SAMP>.
1951
1952</P>
1953
1954
1955<H3><A NAME="SEC126" HREF="gettext_toc.html#TOC126">9.8.3  Message selection</A></H3>
1956
1957<DL COMPACT>
1958
1959<DT><SAMP>&lsquo;--translated&rsquo;</SAMP>
1960<DD>
1961<A NAME="IDX791"></A>
1962Keep translated messages, remove untranslated messages.
1963
1964<DT><SAMP>&lsquo;--untranslated&rsquo;</SAMP>
1965<DD>
1966<A NAME="IDX792"></A>
1967Keep untranslated messages, remove translated messages.
1968
1969<DT><SAMP>&lsquo;--no-fuzzy&rsquo;</SAMP>
1970<DD>
1971<A NAME="IDX793"></A>
1972Remove
1973‘fuzzy’
1974marked messages.
1975
1976<DT><SAMP>&lsquo;--only-fuzzy&rsquo;</SAMP>
1977<DD>
1978<A NAME="IDX794"></A>
1979Keep
1980‘fuzzy’
1981marked messages, remove all other messages.
1982
1983<DT><SAMP>&lsquo;--no-obsolete&rsquo;</SAMP>
1984<DD>
1985<A NAME="IDX795"></A>
1986Remove obsolete #~ messages.
1987
1988<DT><SAMP>&lsquo;--only-obsolete&rsquo;</SAMP>
1989<DD>
1990<A NAME="IDX796"></A>
1991Keep obsolete #~ messages, remove all other messages.
1992
1993</DL>
1994
1995
1996
1997<H3><A NAME="SEC127" HREF="gettext_toc.html#TOC127">9.8.4  Attribute manipulation</A></H3>
1998
1999<P>
2000<A NAME="IDX797"></A>
2001Attributes are modified after the message selection/removal has been
2002performed.  If the <SAMP>&lsquo;--only-file&rsquo;</SAMP> or <SAMP>&lsquo;--ignore-file&rsquo;</SAMP> option is
2003specified, the attribute modification is applied only to those messages
2004that are listed in the <VAR>only-file</VAR> and not listed in the
2005<VAR>ignore-file</VAR>.
2006
2007</P>
2008<DL COMPACT>
2009
2010<DT><SAMP>&lsquo;--set-fuzzy&rsquo;</SAMP>
2011<DD>
2012<A NAME="IDX798"></A>
2013Set all messages
2014‘fuzzy’.
2015
2016<DT><SAMP>&lsquo;--clear-fuzzy&rsquo;</SAMP>
2017<DD>
2018<A NAME="IDX799"></A>
2019Set all messages
2020non-‘fuzzy’.
2021
2022<DT><SAMP>&lsquo;--set-obsolete&rsquo;</SAMP>
2023<DD>
2024<A NAME="IDX800"></A>
2025Set all messages obsolete.
2026
2027<DT><SAMP>&lsquo;--clear-obsolete&rsquo;</SAMP>
2028<DD>
2029<A NAME="IDX801"></A>
2030Set all messages non-obsolete.
2031
2032<DT><SAMP>&lsquo;--clear-previous&rsquo;</SAMP>
2033<DD>
2034<A NAME="IDX802"></A>
2035Remove the “previous msgid” (<SAMP>&lsquo;#|&rsquo;</SAMP>) comments from all messages.
2036
2037<DT><SAMP>&lsquo;--only-file=<VAR>file</VAR>&rsquo;</SAMP>
2038<DD>
2039<A NAME="IDX803"></A>
2040Limit the attribute changes to entries that are listed in <VAR>file</VAR>.
2041<VAR>file</VAR> should be a PO or POT file.
2042
2043<DT><SAMP>&lsquo;--ignore-file=<VAR>file</VAR>&rsquo;</SAMP>
2044<DD>
2045<A NAME="IDX804"></A>
2046Limit the attribute changes to entries that are not listed in <VAR>file</VAR>.
2047<VAR>file</VAR> should be a PO or POT file.
2048
2049<DT><SAMP>&lsquo;--fuzzy&rsquo;</SAMP>
2050<DD>
2051<A NAME="IDX805"></A>
2052Synonym for <SAMP>&lsquo;--only-fuzzy --clear-fuzzy&rsquo;</SAMP>: It keeps only the fuzzy
2053messages and removes their
2054‘fuzzy’
2055mark.
2056
2057<DT><SAMP>&lsquo;--obsolete&rsquo;</SAMP>
2058<DD>
2059<A NAME="IDX806"></A>
2060Synonym for <SAMP>&lsquo;--only-obsolete --clear-obsolete&rsquo;</SAMP>: It keeps only the
2061obsolete messages and makes them non-obsolete.
2062
2063</DL>
2064
2065
2066
2067<H3><A NAME="SEC128" HREF="gettext_toc.html#TOC128">9.8.5  Input file syntax</A></H3>
2068
2069<DL COMPACT>
2070
2071<DT><SAMP>&lsquo;-P&rsquo;</SAMP>
2072<DD>
2073<DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
2074<DD>
2075<A NAME="IDX807"></A>
2076<A NAME="IDX808"></A>
2077Assume the input file is a Java ResourceBundle in Java <CODE>.properties</CODE>
2078syntax, not in PO file syntax.
2079
2080<DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
2081<DD>
2082<A NAME="IDX809"></A>
2083Assume the input file is a NeXTstep/GNUstep localized resource file in
2084<CODE>.strings</CODE> syntax, not in PO file syntax.
2085
2086</DL>
2087
2088
2089
2090<H3><A NAME="SEC129" HREF="gettext_toc.html#TOC129">9.8.6  Output details</A></H3>
2091
2092<DL COMPACT>
2093
2094<DT><SAMP>&lsquo;--force-po&rsquo;</SAMP>
2095<DD>
2096<A NAME="IDX810"></A>
2097Always write an output file even if it contains no message.
2098
2099<DT><SAMP>&lsquo;-i&rsquo;</SAMP>
2100<DD>
2101<DT><SAMP>&lsquo;--indent&rsquo;</SAMP>
2102<DD>
2103<A NAME="IDX811"></A>
2104<A NAME="IDX812"></A>
2105Write the .po file using indented style.
2106
2107<DT><SAMP>&lsquo;--no-location&rsquo;</SAMP>
2108<DD>
2109<A NAME="IDX813"></A>
2110Do not write <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines.
2111
2112<DT><SAMP>&lsquo;-n&rsquo;</SAMP>
2113<DD>
2114<DT><SAMP>&lsquo;--add-location&rsquo;</SAMP>
2115<DD>
2116<A NAME="IDX814"></A>
2117<A NAME="IDX815"></A>
2118Generate <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines (default).
2119
2120<DT><SAMP>&lsquo;--strict&rsquo;</SAMP>
2121<DD>
2122<A NAME="IDX816"></A>
2123Write out a strict Uniforum conforming PO file.  Note that this
2124Uniforum format should be avoided because it doesn't support the
2125GNU extensions.
2126
2127<DT><SAMP>&lsquo;-p&rsquo;</SAMP>
2128<DD>
2129<DT><SAMP>&lsquo;--properties-output&rsquo;</SAMP>
2130<DD>
2131<A NAME="IDX817"></A>
2132<A NAME="IDX818"></A>
2133Write out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax.  Note
2134that this file format doesn't support plural forms and silently drops
2135obsolete messages.
2136
2137<DT><SAMP>&lsquo;--stringtable-output&rsquo;</SAMP>
2138<DD>
2139<A NAME="IDX819"></A>
2140Write out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
2141Note that this file format doesn't support plural forms.
2142
2143<DT><SAMP>&lsquo;-w <VAR>number</VAR>&rsquo;</SAMP>
2144<DD>
2145<DT><SAMP>&lsquo;--width=<VAR>number</VAR>&rsquo;</SAMP>
2146<DD>
2147<A NAME="IDX820"></A>
2148<A NAME="IDX821"></A>
2149Set the output page width.  Long strings in the output files will be
2150split across multiple lines in order to ensure that each line's width
2151(= number of screen columns) is less or equal to the given <VAR>number</VAR>.
2152
2153<DT><SAMP>&lsquo;--no-wrap&rsquo;</SAMP>
2154<DD>
2155<A NAME="IDX822"></A>
2156Do not break long message lines.  Message lines whose width exceeds the
2157output page width will not be split into several lines.  Only file reference
2158lines which are wider than the output page width will be split.
2159
2160<DT><SAMP>&lsquo;-s&rsquo;</SAMP>
2161<DD>
2162<DT><SAMP>&lsquo;--sort-output&rsquo;</SAMP>
2163<DD>
2164<A NAME="IDX823"></A>
2165<A NAME="IDX824"></A>
2166Generate sorted output.  Note that using this option makes it much harder
2167for the translator to understand each message's context.
2168
2169<DT><SAMP>&lsquo;-F&rsquo;</SAMP>
2170<DD>
2171<DT><SAMP>&lsquo;--sort-by-file&rsquo;</SAMP>
2172<DD>
2173<A NAME="IDX825"></A>
2174<A NAME="IDX826"></A>
2175Sort output by file location.
2176
2177</DL>
2178
2179
2180
2181<H3><A NAME="SEC130" HREF="gettext_toc.html#TOC130">9.8.7  Informative output</A></H3>
2182
2183<DL COMPACT>
2184
2185<DT><SAMP>&lsquo;-h&rsquo;</SAMP>
2186<DD>
2187<DT><SAMP>&lsquo;--help&rsquo;</SAMP>
2188<DD>
2189<A NAME="IDX827"></A>
2190<A NAME="IDX828"></A>
2191Display this help and exit.
2192
2193<DT><SAMP>&lsquo;-V&rsquo;</SAMP>
2194<DD>
2195<DT><SAMP>&lsquo;--version&rsquo;</SAMP>
2196<DD>
2197<A NAME="IDX829"></A>
2198<A NAME="IDX830"></A>
2199Output version information and exit.
2200
2201</DL>
2202
2203
2204
2205<H2><A NAME="SEC131" HREF="gettext_toc.html#TOC131">9.9  Invoking the <CODE>msgen</CODE> Program</A></H2>
2206
2207<P>
2208<A NAME="IDX831"></A>
2209<A NAME="IDX832"></A>
2210
2211<PRE>
2212msgen [<VAR>option</VAR>] <VAR>inputfile</VAR>
2213</PRE>
2214
2215<P>
2216<A NAME="IDX833"></A>
2217The <CODE>msgen</CODE> program creates an English translation catalog.  The
2218input file is the last created English PO file, or a PO Template file
2219(generally created by xgettext).  Untranslated entries are assigned a
2220translation that is identical to the msgid.
2221
2222</P>
2223<P>
2224Note: <SAMP>&lsquo;msginit --no-translator --locale=en&rsquo;</SAMP> performs a very similar
2225task.  The main difference is that <CODE>msginit</CODE> cares specially about
2226the header entry, whereas <CODE>msgen</CODE> doesn't.
2227
2228</P>
2229
2230
2231<H3><A NAME="SEC132" HREF="gettext_toc.html#TOC132">9.9.1  Input file location</A></H3>
2232
2233<DL COMPACT>
2234
2235<DT><SAMP>&lsquo;<VAR>inputfile</VAR>&rsquo;</SAMP>
2236<DD>
2237Input PO or POT file.
2238
2239<DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
2240<DD>
2241<DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
2242<DD>
2243<A NAME="IDX834"></A>
2244<A NAME="IDX835"></A>
2245Add <VAR>directory</VAR> to the list of directories.  Source files are
2246searched relative to this list of directories.  The resulting <TT>&lsquo;.po&rsquo;</TT>
2247file will be written relative to the current directory, though.
2248
2249</DL>
2250
2251<P>
2252If <VAR>inputfile</VAR> is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
2253
2254</P>
2255
2256
2257<H3><A NAME="SEC133" HREF="gettext_toc.html#TOC133">9.9.2  Output file location</A></H3>
2258
2259<DL COMPACT>
2260
2261<DT><SAMP>&lsquo;-o <VAR>file</VAR>&rsquo;</SAMP>
2262<DD>
2263<DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
2264<DD>
2265<A NAME="IDX836"></A>
2266<A NAME="IDX837"></A>
2267Write output to specified file.
2268
2269</DL>
2270
2271<P>
2272The results are written to standard output if no output file is specified
2273or if it is <SAMP>&lsquo;-&rsquo;</SAMP>.
2274
2275</P>
2276
2277
2278<H3><A NAME="SEC134" HREF="gettext_toc.html#TOC134">9.9.3  Input file syntax</A></H3>
2279
2280<DL COMPACT>
2281
2282<DT><SAMP>&lsquo;-P&rsquo;</SAMP>
2283<DD>
2284<DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
2285<DD>
2286<A NAME="IDX838"></A>
2287<A NAME="IDX839"></A>
2288Assume the input file is a Java ResourceBundle in Java <CODE>.properties</CODE>
2289syntax, not in PO file syntax.
2290
2291<DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
2292<DD>
2293<A NAME="IDX840"></A>
2294Assume the input file is a NeXTstep/GNUstep localized resource file in
2295<CODE>.strings</CODE> syntax, not in PO file syntax.
2296
2297</DL>
2298
2299
2300
2301<H3><A NAME="SEC135" HREF="gettext_toc.html#TOC135">9.9.4  Output details</A></H3>
2302
2303<DL COMPACT>
2304
2305<DT><SAMP>&lsquo;--force-po&rsquo;</SAMP>
2306<DD>
2307<A NAME="IDX841"></A>
2308Always write an output file even if it contains no message.
2309
2310<DT><SAMP>&lsquo;-i&rsquo;</SAMP>
2311<DD>
2312<DT><SAMP>&lsquo;--indent&rsquo;</SAMP>
2313<DD>
2314<A NAME="IDX842"></A>
2315<A NAME="IDX843"></A>
2316Write the .po file using indented style.
2317
2318<DT><SAMP>&lsquo;--no-location&rsquo;</SAMP>
2319<DD>
2320<A NAME="IDX844"></A>
2321Do not write <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines.
2322
2323<DT><SAMP>&lsquo;--add-location&rsquo;</SAMP>
2324<DD>
2325<A NAME="IDX845"></A>
2326Generate <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines (default).
2327
2328<DT><SAMP>&lsquo;--strict&rsquo;</SAMP>
2329<DD>
2330<A NAME="IDX846"></A>
2331Write out a strict Uniforum conforming PO file.  Note that this
2332Uniforum format should be avoided because it doesn't support the
2333GNU extensions.
2334
2335<DT><SAMP>&lsquo;-p&rsquo;</SAMP>
2336<DD>
2337<DT><SAMP>&lsquo;--properties-output&rsquo;</SAMP>
2338<DD>
2339<A NAME="IDX847"></A>
2340<A NAME="IDX848"></A>
2341Write out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax.  Note
2342that this file format doesn't support plural forms and silently drops
2343obsolete messages.
2344
2345<DT><SAMP>&lsquo;--stringtable-output&rsquo;</SAMP>
2346<DD>
2347<A NAME="IDX849"></A>
2348Write out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
2349Note that this file format doesn't support plural forms.
2350
2351<DT><SAMP>&lsquo;-w <VAR>number</VAR>&rsquo;</SAMP>
2352<DD>
2353<DT><SAMP>&lsquo;--width=<VAR>number</VAR>&rsquo;</SAMP>
2354<DD>
2355<A NAME="IDX850"></A>
2356<A NAME="IDX851"></A>
2357Set the output page width.  Long strings in the output files will be
2358split across multiple lines in order to ensure that each line's width
2359(= number of screen columns) is less or equal to the given <VAR>number</VAR>.
2360
2361<DT><SAMP>&lsquo;--no-wrap&rsquo;</SAMP>
2362<DD>
2363<A NAME="IDX852"></A>
2364Do not break long message lines.  Message lines whose width exceeds the
2365output page width will not be split into several lines.  Only file reference
2366lines which are wider than the output page width will be split.
2367
2368<DT><SAMP>&lsquo;-s&rsquo;</SAMP>
2369<DD>
2370<DT><SAMP>&lsquo;--sort-output&rsquo;</SAMP>
2371<DD>
2372<A NAME="IDX853"></A>
2373<A NAME="IDX854"></A>
2374Generate sorted output.  Note that using this option makes it much harder
2375for the translator to understand each message's context.
2376
2377<DT><SAMP>&lsquo;-F&rsquo;</SAMP>
2378<DD>
2379<DT><SAMP>&lsquo;--sort-by-file&rsquo;</SAMP>
2380<DD>
2381<A NAME="IDX855"></A>
2382<A NAME="IDX856"></A>
2383Sort output by file location.
2384
2385</DL>
2386
2387
2388
2389<H3><A NAME="SEC136" HREF="gettext_toc.html#TOC136">9.9.5  Informative output</A></H3>
2390
2391<DL COMPACT>
2392
2393<DT><SAMP>&lsquo;-h&rsquo;</SAMP>
2394<DD>
2395<DT><SAMP>&lsquo;--help&rsquo;</SAMP>
2396<DD>
2397<A NAME="IDX857"></A>
2398<A NAME="IDX858"></A>
2399Display this help and exit.
2400
2401<DT><SAMP>&lsquo;-V&rsquo;</SAMP>
2402<DD>
2403<DT><SAMP>&lsquo;--version&rsquo;</SAMP>
2404<DD>
2405<A NAME="IDX859"></A>
2406<A NAME="IDX860"></A>
2407Output version information and exit.
2408
2409</DL>
2410
2411
2412
2413<H2><A NAME="SEC137" HREF="gettext_toc.html#TOC137">9.10  Invoking the <CODE>msgexec</CODE> Program</A></H2>
2414
2415<P>
2416<A NAME="IDX861"></A>
2417<A NAME="IDX862"></A>
2418
2419<PRE>
2420msgexec [<VAR>option</VAR>] <VAR>command</VAR> [<VAR>command-option</VAR>]
2421</PRE>
2422
2423<P>
2424<A NAME="IDX863"></A>
2425The <CODE>msgexec</CODE> program applies a command to all translations of a
2426translation catalog.
2427The <VAR>command</VAR> can be any program that reads a translation from standard
2428input.  It is invoked once for each translation.  Its output becomes
2429msgexec's output.  <CODE>msgexec</CODE>'s return code is the maximum return code
2430across all invocations.
2431
2432</P>
2433<P>
2434<A NAME="IDX864"></A>
2435A special builtin command called <SAMP>&lsquo;0&rsquo;</SAMP> outputs the translation, followed
2436by a null byte.  The output of <SAMP>&lsquo;msgexec 0&rsquo;</SAMP> is suitable as input for
2437<SAMP>&lsquo;xargs -0&rsquo;</SAMP>.
2438
2439</P>
2440<P>
2441<A NAME="IDX865"></A>
2442<A NAME="IDX866"></A>
2443<A NAME="IDX867"></A>
2444During each <VAR>command</VAR> invocation, the environment variable
2445<CODE>MSGEXEC_MSGID</CODE> is bound to the message's msgid, and the environment
2446variable <CODE>MSGEXEC_LOCATION</CODE> is bound to the location in the PO file
2447of the message.  If the message has a context, the environment variable
2448<CODE>MSGEXEC_MSGCTXT</CODE> is bound to the message's msgctxt, otherwise it is
2449unbound.
2450
2451</P>
2452<P>
2453<A NAME="IDX868"></A>
2454Note: It is your responsibility to ensure that the <VAR>command</VAR> can cope
2455with input encoded in the translation catalog's encoding.  If the
2456<VAR>command</VAR> wants input in a particular encoding, you can in a first step
2457convert the translation catalog to that encoding using the <SAMP>&lsquo;msgconv&rsquo;</SAMP>
2458program, before invoking <SAMP>&lsquo;msgexec&rsquo;</SAMP>.  If the <VAR>command</VAR> wants input
2459in the locale's encoding, but you want to avoid the locale's encoding, then
2460you can first convert the translation catalog to UTF-8 using the
2461<SAMP>&lsquo;msgconv&rsquo;</SAMP> program and then make <SAMP>&lsquo;msgexec&rsquo;</SAMP> work in an UTF-8
2462locale, by using the <CODE>LC_ALL</CODE> environment variable.
2463
2464</P>
2465
2466
2467<H3><A NAME="SEC138" HREF="gettext_toc.html#TOC138">9.10.1  Input file location</A></H3>
2468
2469<DL COMPACT>
2470
2471<DT><SAMP>&lsquo;-i <VAR>inputfile</VAR>&rsquo;</SAMP>
2472<DD>
2473<DT><SAMP>&lsquo;--input=<VAR>inputfile</VAR>&rsquo;</SAMP>
2474<DD>
2475<A NAME="IDX869"></A>
2476<A NAME="IDX870"></A>
2477Input PO file.
2478
2479<DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
2480<DD>
2481<DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
2482<DD>
2483<A NAME="IDX871"></A>
2484<A NAME="IDX872"></A>
2485Add <VAR>directory</VAR> to the list of directories.  Source files are
2486searched relative to this list of directories.  The resulting <TT>&lsquo;.po&rsquo;</TT>
2487file will be written relative to the current directory, though.
2488
2489</DL>
2490
2491<P>
2492If no <VAR>inputfile</VAR> is given or if it is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
2493
2494</P>
2495
2496
2497<H3><A NAME="SEC139" HREF="gettext_toc.html#TOC139">9.10.2  Input file syntax</A></H3>
2498
2499<DL COMPACT>
2500
2501<DT><SAMP>&lsquo;-P&rsquo;</SAMP>
2502<DD>
2503<DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
2504<DD>
2505<A NAME="IDX873"></A>
2506<A NAME="IDX874"></A>
2507Assume the input file is a Java ResourceBundle in Java <CODE>.properties</CODE>
2508syntax, not in PO file syntax.
2509
2510<DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
2511<DD>
2512<A NAME="IDX875"></A>
2513Assume the input file is a NeXTstep/GNUstep localized resource file in
2514<CODE>.strings</CODE> syntax, not in PO file syntax.
2515
2516</DL>
2517
2518
2519
2520<H3><A NAME="SEC140" HREF="gettext_toc.html#TOC140">9.10.3  Informative output</A></H3>
2521
2522<DL COMPACT>
2523
2524<DT><SAMP>&lsquo;-h&rsquo;</SAMP>
2525<DD>
2526<DT><SAMP>&lsquo;--help&rsquo;</SAMP>
2527<DD>
2528<A NAME="IDX876"></A>
2529<A NAME="IDX877"></A>
2530Display this help and exit.
2531
2532<DT><SAMP>&lsquo;-V&rsquo;</SAMP>
2533<DD>
2534<DT><SAMP>&lsquo;--version&rsquo;</SAMP>
2535<DD>
2536<A NAME="IDX878"></A>
2537<A NAME="IDX879"></A>
2538Output version information and exit.
2539
2540</DL>
2541
2542
2543
2544<H2><A NAME="SEC141" HREF="gettext_toc.html#TOC141">9.11  Writing your own programs that process PO files</A></H2>
2545
2546<P>
2547For the tasks for which a combination of <SAMP>&lsquo;msgattrib&rsquo;</SAMP>, <SAMP>&lsquo;msgcat&rsquo;</SAMP> etc.
2548is not sufficient, a set of C functions is provided in a library, to make it
2549possible to process PO files in your own programs.  When you use this library,
2550you don't need to write routines to parse the PO file; instead, you retrieve
2551a pointer in memory to each of messages contained in the PO file.  Functions
2552for writing PO files are not provided at this time.
2553
2554</P>
2555<P>
2556The functions are declared in the header file <SAMP>&lsquo;&#60;gettext-po.h&#62;&rsquo;</SAMP>, and are
2557defined in a library called <SAMP>&lsquo;libgettextpo&rsquo;</SAMP>.
2558
2559</P>
2560<P>
2561<DL>
2562<DT><U>Data Type:</U> <B>po_file_t</B>
2563<DD><A NAME="IDX880"></A>
2564This is a pointer type that refers to the contents of a PO file, after it has
2565been read into memory.
2566</DL>
2567
2568</P>
2569<P>
2570<DL>
2571<DT><U>Data Type:</U> <B>po_message_iterator_t</B>
2572<DD><A NAME="IDX881"></A>
2573This is a pointer type that refers to an iterator that produces a sequence of
2574messages.
2575</DL>
2576
2577</P>
2578<P>
2579<DL>
2580<DT><U>Data Type:</U> <B>po_message_t</B>
2581<DD><A NAME="IDX882"></A>
2582This is a pointer type that refers to a message of a PO file, including its
2583translation.
2584</DL>
2585
2586</P>
2587<P>
2588<DL>
2589<DT><U>Function:</U> po_file_t <B>po_file_read</B> <I>(const char *<VAR>filename</VAR>)</I>
2590<DD><A NAME="IDX883"></A>
2591The <CODE>po_file_read</CODE> function reads a PO file into memory.  The file name
2592is given as argument.  The return value is a handle to the PO file's contents,
2593valid until <CODE>po_file_free</CODE> is called on it.  In case of error, the return
2594value is <CODE>NULL</CODE>, and <CODE>errno</CODE> is set.
2595</DL>
2596
2597</P>
2598<P>
2599<DL>
2600<DT><U>Function:</U> void <B>po_file_free</B> <I>(po_file_t <VAR>file</VAR>)</I>
2601<DD><A NAME="IDX884"></A>
2602The <CODE>po_file_free</CODE> function frees a PO file's contents from memory,
2603including all messages that are only implicitly accessible through iterators.
2604</DL>
2605
2606</P>
2607<P>
2608<DL>
2609<DT><U>Function:</U> const char * const * <B>po_file_domains</B> <I>(po_file_t <VAR>file</VAR>)</I>
2610<DD><A NAME="IDX885"></A>
2611The <CODE>po_file_domains</CODE> function returns the domains for which the given
2612PO file has messages.  The return value is a <CODE>NULL</CODE> terminated array
2613which is valid as long as the <VAR>file</VAR> handle is valid.  For PO files which
2614contain no <SAMP>&lsquo;domain&rsquo;</SAMP> directive, the return value contains only one domain,
2615namely the default domain <CODE>"messages"</CODE>.
2616</DL>
2617
2618</P>
2619<P>
2620<DL>
2621<DT><U>Function:</U> po_message_iterator_t <B>po_message_iterator</B> <I>(po_file_t <VAR>file</VAR>, const char *<VAR>domain</VAR>)</I>
2622<DD><A NAME="IDX886"></A>
2623The <CODE>po_message_iterator</CODE> returns an iterator that will produce the
2624messages of <VAR>file</VAR> that belong to the given <VAR>domain</VAR>.  If <VAR>domain</VAR>
2625is <CODE>NULL</CODE>, the default domain is used instead.  To list the messages,
2626use the function <CODE>po_next_message</CODE> repeatedly.
2627</DL>
2628
2629</P>
2630<P>
2631<DL>
2632<DT><U>Function:</U> void <B>po_message_iterator_free</B> <I>(po_message_iterator_t <VAR>iterator</VAR>)</I>
2633<DD><A NAME="IDX887"></A>
2634The <CODE>po_message_iterator_free</CODE> function frees an iterator previously
2635allocated through the <CODE>po_message_iterator</CODE> function.
2636</DL>
2637
2638</P>
2639<P>
2640<DL>
2641<DT><U>Function:</U> po_message_t <B>po_next_message</B> <I>(po_message_iterator_t <VAR>iterator</VAR>)</I>
2642<DD><A NAME="IDX888"></A>
2643The <CODE>po_next_message</CODE> function returns the next message from
2644<VAR>iterator</VAR> and advances the iterator.  It returns <CODE>NULL</CODE> when the
2645iterator has reached the end of its message list.
2646</DL>
2647
2648</P>
2649<P>
2650The following functions returns details of a <CODE>po_message_t</CODE>.  Recall
2651that the results are valid as long as the <VAR>file</VAR> handle is valid.
2652
2653</P>
2654<P>
2655<DL>
2656<DT><U>Function:</U> const char * <B>po_message_msgid</B> <I>(po_message_t <VAR>message</VAR>)</I>
2657<DD><A NAME="IDX889"></A>
2658The <CODE>po_message_msgid</CODE> function returns the <CODE>msgid</CODE> (untranslated
2659English string) of a message.  This is guaranteed to be non-<CODE>NULL</CODE>.
2660</DL>
2661
2662</P>
2663<P>
2664<DL>
2665<DT><U>Function:</U> const char * <B>po_message_msgid_plural</B> <I>(po_message_t <VAR>message</VAR>)</I>
2666<DD><A NAME="IDX890"></A>
2667The <CODE>po_message_msgid_plural</CODE> function returns the <CODE>msgid_plural</CODE>
2668(untranslated English plural string) of a message with plurals, or <CODE>NULL</CODE>
2669for a message without plural.
2670</DL>
2671
2672</P>
2673<P>
2674<DL>
2675<DT><U>Function:</U> const char * <B>po_message_msgstr</B> <I>(po_message_t <VAR>message</VAR>)</I>
2676<DD><A NAME="IDX891"></A>
2677The <CODE>po_message_msgstr</CODE> function returns the <CODE>msgstr</CODE> (translation)
2678of a message.  For an untranslated message, the return value is an empty
2679string.
2680</DL>
2681
2682</P>
2683<P>
2684<DL>
2685<DT><U>Function:</U> const char * <B>po_message_msgstr_plural</B> <I>(po_message_t <VAR>message</VAR>, int <VAR>index</VAR>)</I>
2686<DD><A NAME="IDX892"></A>
2687The <CODE>po_message_msgstr_plural</CODE> function returns the
2688<CODE>msgstr[<VAR>index</VAR>]</CODE> of a message with plurals, or <CODE>NULL</CODE> when
2689the <VAR>index</VAR> is out of range or for a message without plural.
2690</DL>
2691
2692</P>
2693<P>
2694Here is an example code how these functions can be used.
2695
2696</P>
2697
2698<PRE>
2699const char *filename = ...;
2700po_file_t file = po_file_read (filename);
2701
2702if (file == NULL)
2703  error (EXIT_FAILURE, errno, "couldn't open the PO file %s", filename);
2704{
2705  const char * const *domains = po_file_domains (file);
2706  const char * const *domainp;
2707
2708  for (domainp = domains; *domainp; domainp++)
2709    {
2710      const char *domain = *domainp;
2711      po_message_iterator_t iterator = po_message_iterator (file, domain);
2712
2713      for (;;)
2714        {
2715          po_message_t *message = po_next_message (iterator);
2716
2717          if (message == NULL)
2718            break;
2719          {
2720            const char *msgid = po_message_msgid (message);
2721            const char *msgstr = po_message_msgstr (message);
2722
2723            ...
2724          }
2725        }
2726      po_message_iterator_free (iterator);
2727    }
2728}
2729po_file_free (file);
2730</PRE>
2731
2732<P><HR><P>
2733Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_8.html">previous</A>, <A HREF="gettext_10.html">next</A>, <A HREF="gettext_25.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>.
2734</BODY>
2735</HTML>
2736