Install gettext-0.18.1.1.tar.gz
[msysgit.git] / mingw / share / doc / gettext / gettext_9.html
blob536a39e586316b18af57b0ee8b59c6be04450a1a
1 <HTML>
2 <HEAD>
3 <!-- This HTML file has been created by texi2html 1.52b
4 from gettext.texi on 6 June 2010 -->
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>
10 Go 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>
14 <H1><A NAME="SEC79" HREF="gettext_toc.html#TOC79">9 Manipulating PO Files</A></H1>
15 <P>
16 <A NAME="IDX534"></A>
18 </P>
19 <P>
20 Sometimes it is necessary to manipulate PO files in a way that is better
21 performed automatically than by hand. GNU <CODE>gettext</CODE> includes a
22 complete set of tools for this purpose.
24 </P>
25 <P>
26 <A NAME="IDX535"></A>
27 When merging two packages into a single package, the resulting POT file
28 will be the concatenation of the two packages' POT files. Thus the
29 maintainer must concatenate the two existing package translations into
30 a single translation catalog, for each language. This is best performed
31 using <SAMP>&lsquo;msgcat&rsquo;</SAMP>. It is then the translators' duty to deal with any
32 possible conflicts that arose during the merge.
34 </P>
35 <P>
36 <A NAME="IDX536"></A>
37 When a translator takes over the translation job from another translator,
38 but she uses a different character encoding in her locale, she will
39 convert the catalog to her character encoding. This is best done through
40 the <SAMP>&lsquo;msgconv&rsquo;</SAMP> program.
42 </P>
43 <P>
44 When a maintainer takes a source file with tagged messages from another
45 package, he should also take the existing translations for this source
46 file (and not let the translators do the same job twice). One way to do
47 this is through <SAMP>&lsquo;msggrep&rsquo;</SAMP>, another is to create a POT file for
48 that source file and use <SAMP>&lsquo;msgmerge&rsquo;</SAMP>.
50 </P>
51 <P>
52 <A NAME="IDX537"></A>
53 <A NAME="IDX538"></A>
54 When a translator wants to adjust some translation catalog for a special
55 dialect or orthography -- for example, German as written in Switzerland
56 versus German as written in Germany -- she needs to apply some text
57 processing to every message in the catalog. The tool for doing this is
58 <SAMP>&lsquo;msgfilter&rsquo;</SAMP>.
60 </P>
61 <P>
62 Another use of <CODE>msgfilter</CODE> is to produce approximately the POT file for
63 which a given PO file was made. This can be done through a filter command
64 like <SAMP>&lsquo;msgfilter sed -e d | sed -e '/^# /d'&rsquo;</SAMP>. Note that the original
65 POT file may have had different comments and different plural message counts,
66 that's why it's better to use the original POT file if available.
68 </P>
69 <P>
70 <A NAME="IDX539"></A>
71 When a translator wants to check her translations, for example according
72 to orthography rules or using a non-interactive spell checker, she can do
73 so using the <SAMP>&lsquo;msgexec&rsquo;</SAMP> program.
75 </P>
76 <P>
77 <A NAME="IDX540"></A>
78 When third party tools create PO or POT files, sometimes duplicates cannot
79 be avoided. But the GNU <CODE>gettext</CODE> tools give an error when they
80 encounter duplicate msgids in the same file and in the same domain.
81 To merge duplicates, the <SAMP>&lsquo;msguniq&rsquo;</SAMP> program can be used.
83 </P>
84 <P>
85 <SAMP>&lsquo;msgcomm&rsquo;</SAMP> is a more general tool for keeping or throwing away
86 duplicates, occurring in different files.
88 </P>
89 <P>
90 <SAMP>&lsquo;msgcmp&rsquo;</SAMP> can be used to check whether a translation catalog is
91 completely translated.
93 </P>
94 <P>
95 <A NAME="IDX541"></A>
96 <SAMP>&lsquo;msgattrib&rsquo;</SAMP> can be used to select and extract only the fuzzy
97 or untranslated messages of a translation catalog.
99 </P>
101 <SAMP>&lsquo;msgen&rsquo;</SAMP> is useful as a first step for preparing English translation
102 catalogs. It copies each message's msgid to its msgstr.
104 </P>
106 Finally, for those applications where all these various programs are not
107 sufficient, a library <SAMP>&lsquo;libgettextpo&rsquo;</SAMP> is provided that can be used to
108 write other specialized programs that process PO files.
110 </P>
114 <H2><A NAME="SEC80" HREF="gettext_toc.html#TOC80">9.1 Invoking the <CODE>msgcat</CODE> Program</A></H2>
117 <A NAME="IDX542"></A>
118 <A NAME="IDX543"></A>
120 <PRE>
121 msgcat [<VAR>option</VAR>] [<VAR>inputfile</VAR>]...
122 </PRE>
125 <A NAME="IDX544"></A>
126 <A NAME="IDX545"></A>
127 The <CODE>msgcat</CODE> program concatenates and merges the specified PO files.
128 It finds messages which are common to two or more of the specified PO files.
129 By using the <CODE>--more-than</CODE> option, greater commonality may be requested
130 before messages are printed. Conversely, the <CODE>--less-than</CODE> option may be
131 used 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,
133 comments 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
135 to define them. File positions from all PO files will be cumulated.
137 </P>
140 <H3><A NAME="SEC81" HREF="gettext_toc.html#TOC81">9.1.1 Input file location</A></H3>
142 <DL COMPACT>
144 <DT><SAMP>&lsquo;<VAR>inputfile</VAR> ...&rsquo;</SAMP>
145 <DD>
146 Input files.
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="IDX546"></A>
153 <A NAME="IDX547"></A>
154 Read the names of the input files from <VAR>file</VAR> instead of getting
155 them from the command line.
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="IDX548"></A>
162 <A NAME="IDX549"></A>
163 Add <VAR>directory</VAR> to the list of directories. Source files are
164 searched relative to this list of directories. The resulting <TT>&lsquo;.po&rsquo;</TT>
165 file will be written relative to the current directory, though.
167 </DL>
170 If <VAR>inputfile</VAR> is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
172 </P>
175 <H3><A NAME="SEC82" HREF="gettext_toc.html#TOC82">9.1.2 Output file location</A></H3>
177 <DL COMPACT>
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="IDX550"></A>
184 <A NAME="IDX551"></A>
185 Write output to specified file.
187 </DL>
190 <A NAME="IDX552"></A>
191 The results are written to standard output if no output file is specified
192 or if it is <SAMP>&lsquo;-&rsquo;</SAMP>.
194 </P>
197 <H3><A NAME="SEC83" HREF="gettext_toc.html#TOC83">9.1.3 Message selection</A></H3>
199 <DL COMPACT>
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="IDX553"></A>
206 <A NAME="IDX554"></A>
207 Print messages with less than <VAR>number</VAR> definitions, defaults to infinite
208 if not set.
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="IDX555"></A>
215 <A NAME="IDX556"></A>
216 Print messages with more than <VAR>number</VAR> definitions, defaults to 0 if not
217 set.
219 <DT><SAMP>&lsquo;-u&rsquo;</SAMP>
220 <DD>
221 <DT><SAMP>&lsquo;--unique&rsquo;</SAMP>
222 <DD>
223 <A NAME="IDX557"></A>
224 <A NAME="IDX558"></A>
225 Shorthand for <SAMP>&lsquo;--less-than=2&rsquo;</SAMP>. Requests that only unique messages be
226 printed.
228 </DL>
232 <H3><A NAME="SEC84" HREF="gettext_toc.html#TOC84">9.1.4 Input file syntax</A></H3>
234 <DL COMPACT>
236 <DT><SAMP>&lsquo;-P&rsquo;</SAMP>
237 <DD>
238 <DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
239 <DD>
240 <A NAME="IDX559"></A>
241 <A NAME="IDX560"></A>
242 Assume the input files are Java ResourceBundles in Java <CODE>.properties</CODE>
243 syntax, not in PO file syntax.
245 <DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
246 <DD>
247 <A NAME="IDX561"></A>
248 Assume the input files are NeXTstep/GNUstep localized resource files in
249 <CODE>.strings</CODE> syntax, not in PO file syntax.
251 </DL>
255 <H3><A NAME="SEC85" HREF="gettext_toc.html#TOC85">9.1.5 Output details</A></H3>
257 <DL COMPACT>
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="IDX562"></A>
264 <A NAME="IDX563"></A>
265 Specify encoding for output.
267 <DT><SAMP>&lsquo;--use-first&rsquo;</SAMP>
268 <DD>
269 <A NAME="IDX564"></A>
270 Use first available translation for each message. Don't merge several
271 translations into one.
273 <DT><SAMP>&lsquo;--lang=<VAR>catalogname</VAR>&rsquo;</SAMP>
274 <DD>
275 <A NAME="IDX565"></A>
276 Specify the <SAMP>&lsquo;Language&rsquo;</SAMP> field to be used in the header entry. See
277 section <A HREF="gettext_6.html#SEC44">6.2 Filling in the Header Entry</A> for the meaning of this field. Note: The
278 <SAMP>&lsquo;Language-Team&rsquo;</SAMP> and <SAMP>&lsquo;Plural-Forms&rsquo;</SAMP> fields are left unchanged.
280 <DT><SAMP>&lsquo;--color&rsquo;</SAMP>
281 <DD>
282 <DT><SAMP>&lsquo;--color=<VAR>when</VAR>&rsquo;</SAMP>
283 <DD>
284 <A NAME="IDX566"></A>
285 Specify whether or when to use colors and other text attributes.
286 See section <A HREF="gettext_9.html#SEC150">9.11.1 The <CODE>--color</CODE> option</A> for details.
288 <DT><SAMP>&lsquo;--style=<VAR>style_file</VAR>&rsquo;</SAMP>
289 <DD>
290 <A NAME="IDX567"></A>
291 Specify the CSS style rule file to use for <CODE>--color</CODE>.
292 See section <A HREF="gettext_9.html#SEC152">9.11.3 The <CODE>--style</CODE> option</A> for details.
294 <DT><SAMP>&lsquo;--force-po&rsquo;</SAMP>
295 <DD>
296 <A NAME="IDX568"></A>
297 Always write an output file even if it contains no message.
299 <DT><SAMP>&lsquo;-i&rsquo;</SAMP>
300 <DD>
301 <DT><SAMP>&lsquo;--indent&rsquo;</SAMP>
302 <DD>
303 <A NAME="IDX569"></A>
304 <A NAME="IDX570"></A>
305 Write the .po file using indented style.
307 <DT><SAMP>&lsquo;--no-location&rsquo;</SAMP>
308 <DD>
309 <A NAME="IDX571"></A>
310 Do not write <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines.
312 <DT><SAMP>&lsquo;-n&rsquo;</SAMP>
313 <DD>
314 <DT><SAMP>&lsquo;--add-location&rsquo;</SAMP>
315 <DD>
316 <A NAME="IDX572"></A>
317 <A NAME="IDX573"></A>
318 Generate <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines (default).
320 <DT><SAMP>&lsquo;--strict&rsquo;</SAMP>
321 <DD>
322 <A NAME="IDX574"></A>
323 Write out a strict Uniforum conforming PO file. Note that this
324 Uniforum format should be avoided because it doesn't support the
325 GNU extensions.
327 <DT><SAMP>&lsquo;-p&rsquo;</SAMP>
328 <DD>
329 <DT><SAMP>&lsquo;--properties-output&rsquo;</SAMP>
330 <DD>
331 <A NAME="IDX575"></A>
332 <A NAME="IDX576"></A>
333 Write out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax. Note
334 that this file format doesn't support plural forms and silently drops
335 obsolete messages.
337 <DT><SAMP>&lsquo;--stringtable-output&rsquo;</SAMP>
338 <DD>
339 <A NAME="IDX577"></A>
340 Write out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
341 Note that this file format doesn't support plural forms.
343 <DT><SAMP>&lsquo;-w <VAR>number</VAR>&rsquo;</SAMP>
344 <DD>
345 <DT><SAMP>&lsquo;--width=<VAR>number</VAR>&rsquo;</SAMP>
346 <DD>
347 <A NAME="IDX578"></A>
348 <A NAME="IDX579"></A>
349 Set the output page width. Long strings in the output files will be
350 split across multiple lines in order to ensure that each line's width
351 (= number of screen columns) is less or equal to the given <VAR>number</VAR>.
353 <DT><SAMP>&lsquo;--no-wrap&rsquo;</SAMP>
354 <DD>
355 <A NAME="IDX580"></A>
356 Do not break long message lines. Message lines whose width exceeds the
357 output page width will not be split into several lines. Only file reference
358 lines which are wider than the output page width will be split.
360 <DT><SAMP>&lsquo;-s&rsquo;</SAMP>
361 <DD>
362 <DT><SAMP>&lsquo;--sort-output&rsquo;</SAMP>
363 <DD>
364 <A NAME="IDX581"></A>
365 <A NAME="IDX582"></A>
366 <A NAME="IDX583"></A>
367 Generate sorted output. Note that using this option makes it much harder
368 for the translator to understand each message's context.
370 <DT><SAMP>&lsquo;-F&rsquo;</SAMP>
371 <DD>
372 <DT><SAMP>&lsquo;--sort-by-file&rsquo;</SAMP>
373 <DD>
374 <A NAME="IDX584"></A>
375 <A NAME="IDX585"></A>
376 Sort output by file location.
378 </DL>
382 <H3><A NAME="SEC86" HREF="gettext_toc.html#TOC86">9.1.6 Informative output</A></H3>
384 <DL COMPACT>
386 <DT><SAMP>&lsquo;-h&rsquo;</SAMP>
387 <DD>
388 <DT><SAMP>&lsquo;--help&rsquo;</SAMP>
389 <DD>
390 <A NAME="IDX586"></A>
391 <A NAME="IDX587"></A>
392 Display this help and exit.
394 <DT><SAMP>&lsquo;-V&rsquo;</SAMP>
395 <DD>
396 <DT><SAMP>&lsquo;--version&rsquo;</SAMP>
397 <DD>
398 <A NAME="IDX588"></A>
399 <A NAME="IDX589"></A>
400 Output version information and exit.
402 </DL>
406 <H2><A NAME="SEC87" HREF="gettext_toc.html#TOC87">9.2 Invoking the <CODE>msgconv</CODE> Program</A></H2>
409 <A NAME="IDX590"></A>
410 <A NAME="IDX591"></A>
412 <PRE>
413 msgconv [<VAR>option</VAR>] [<VAR>inputfile</VAR>]
414 </PRE>
417 <A NAME="IDX592"></A>
418 The <CODE>msgconv</CODE> program converts a translation catalog to a different
419 character encoding.
421 </P>
424 <H3><A NAME="SEC88" HREF="gettext_toc.html#TOC88">9.2.1 Input file location</A></H3>
426 <DL COMPACT>
428 <DT><SAMP>&lsquo;<VAR>inputfile</VAR>&rsquo;</SAMP>
429 <DD>
430 Input PO file.
432 <DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
433 <DD>
434 <DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
435 <DD>
436 <A NAME="IDX593"></A>
437 <A NAME="IDX594"></A>
438 Add <VAR>directory</VAR> to the list of directories. Source files are
439 searched relative to this list of directories. The resulting <TT>&lsquo;.po&rsquo;</TT>
440 file will be written relative to the current directory, though.
442 </DL>
445 If no <VAR>inputfile</VAR> is given or if it is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
447 </P>
450 <H3><A NAME="SEC89" HREF="gettext_toc.html#TOC89">9.2.2 Output file location</A></H3>
452 <DL COMPACT>
454 <DT><SAMP>&lsquo;-o <VAR>file</VAR>&rsquo;</SAMP>
455 <DD>
456 <DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
457 <DD>
458 <A NAME="IDX595"></A>
459 <A NAME="IDX596"></A>
460 Write output to specified file.
462 </DL>
465 The results are written to standard output if no output file is specified
466 or if it is <SAMP>&lsquo;-&rsquo;</SAMP>.
468 </P>
471 <H3><A NAME="SEC90" HREF="gettext_toc.html#TOC90">9.2.3 Conversion target</A></H3>
473 <DL COMPACT>
475 <DT><SAMP>&lsquo;-t&rsquo;</SAMP>
476 <DD>
477 <DT><SAMP>&lsquo;--to-code=<VAR>name</VAR>&rsquo;</SAMP>
478 <DD>
479 <A NAME="IDX597"></A>
480 <A NAME="IDX598"></A>
481 Specify encoding for output.
483 </DL>
486 The default encoding is the current locale's encoding.
488 </P>
491 <H3><A NAME="SEC91" HREF="gettext_toc.html#TOC91">9.2.4 Input file syntax</A></H3>
493 <DL COMPACT>
495 <DT><SAMP>&lsquo;-P&rsquo;</SAMP>
496 <DD>
497 <DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
498 <DD>
499 <A NAME="IDX599"></A>
500 <A NAME="IDX600"></A>
501 Assume the input file is a Java ResourceBundle in Java <CODE>.properties</CODE>
502 syntax, not in PO file syntax.
504 <DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
505 <DD>
506 <A NAME="IDX601"></A>
507 Assume the input file is a NeXTstep/GNUstep localized resource file in
508 <CODE>.strings</CODE> syntax, not in PO file syntax.
510 </DL>
514 <H3><A NAME="SEC92" HREF="gettext_toc.html#TOC92">9.2.5 Output details</A></H3>
516 <DL COMPACT>
518 <DT><SAMP>&lsquo;--color&rsquo;</SAMP>
519 <DD>
520 <DT><SAMP>&lsquo;--color=<VAR>when</VAR>&rsquo;</SAMP>
521 <DD>
522 <A NAME="IDX602"></A>
523 Specify whether or when to use colors and other text attributes.
524 See section <A HREF="gettext_9.html#SEC150">9.11.1 The <CODE>--color</CODE> option</A> for details.
526 <DT><SAMP>&lsquo;--style=<VAR>style_file</VAR>&rsquo;</SAMP>
527 <DD>
528 <A NAME="IDX603"></A>
529 Specify the CSS style rule file to use for <CODE>--color</CODE>.
530 See section <A HREF="gettext_9.html#SEC152">9.11.3 The <CODE>--style</CODE> option</A> for details.
532 <DT><SAMP>&lsquo;--force-po&rsquo;</SAMP>
533 <DD>
534 <A NAME="IDX604"></A>
535 Always write an output file even if it contains no message.
537 <DT><SAMP>&lsquo;-i&rsquo;</SAMP>
538 <DD>
539 <DT><SAMP>&lsquo;--indent&rsquo;</SAMP>
540 <DD>
541 <A NAME="IDX605"></A>
542 <A NAME="IDX606"></A>
543 Write the .po file using indented style.
545 <DT><SAMP>&lsquo;--no-location&rsquo;</SAMP>
546 <DD>
547 <A NAME="IDX607"></A>
548 Do not write <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines.
550 <DT><SAMP>&lsquo;--add-location&rsquo;</SAMP>
551 <DD>
552 <A NAME="IDX608"></A>
553 Generate <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines (default).
555 <DT><SAMP>&lsquo;--strict&rsquo;</SAMP>
556 <DD>
557 <A NAME="IDX609"></A>
558 Write out a strict Uniforum conforming PO file. Note that this
559 Uniforum format should be avoided because it doesn't support the
560 GNU extensions.
562 <DT><SAMP>&lsquo;-p&rsquo;</SAMP>
563 <DD>
564 <DT><SAMP>&lsquo;--properties-output&rsquo;</SAMP>
565 <DD>
566 <A NAME="IDX610"></A>
567 <A NAME="IDX611"></A>
568 Write out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax. Note
569 that this file format doesn't support plural forms and silently drops
570 obsolete messages.
572 <DT><SAMP>&lsquo;--stringtable-output&rsquo;</SAMP>
573 <DD>
574 <A NAME="IDX612"></A>
575 Write out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
576 Note that this file format doesn't support plural forms.
578 <DT><SAMP>&lsquo;-w <VAR>number</VAR>&rsquo;</SAMP>
579 <DD>
580 <DT><SAMP>&lsquo;--width=<VAR>number</VAR>&rsquo;</SAMP>
581 <DD>
582 <A NAME="IDX613"></A>
583 <A NAME="IDX614"></A>
584 Set the output page width. Long strings in the output files will be
585 split across multiple lines in order to ensure that each line's width
586 (= number of screen columns) is less or equal to the given <VAR>number</VAR>.
588 <DT><SAMP>&lsquo;--no-wrap&rsquo;</SAMP>
589 <DD>
590 <A NAME="IDX615"></A>
591 Do not break long message lines. Message lines whose width exceeds the
592 output page width will not be split into several lines. Only file reference
593 lines which are wider than the output page width will be split.
595 <DT><SAMP>&lsquo;-s&rsquo;</SAMP>
596 <DD>
597 <DT><SAMP>&lsquo;--sort-output&rsquo;</SAMP>
598 <DD>
599 <A NAME="IDX616"></A>
600 <A NAME="IDX617"></A>
601 Generate sorted output. Note that using this option makes it much harder
602 for the translator to understand each message's context.
604 <DT><SAMP>&lsquo;-F&rsquo;</SAMP>
605 <DD>
606 <DT><SAMP>&lsquo;--sort-by-file&rsquo;</SAMP>
607 <DD>
608 <A NAME="IDX618"></A>
609 <A NAME="IDX619"></A>
610 Sort output by file location.
612 </DL>
616 <H3><A NAME="SEC93" HREF="gettext_toc.html#TOC93">9.2.6 Informative output</A></H3>
618 <DL COMPACT>
620 <DT><SAMP>&lsquo;-h&rsquo;</SAMP>
621 <DD>
622 <DT><SAMP>&lsquo;--help&rsquo;</SAMP>
623 <DD>
624 <A NAME="IDX620"></A>
625 <A NAME="IDX621"></A>
626 Display this help and exit.
628 <DT><SAMP>&lsquo;-V&rsquo;</SAMP>
629 <DD>
630 <DT><SAMP>&lsquo;--version&rsquo;</SAMP>
631 <DD>
632 <A NAME="IDX622"></A>
633 <A NAME="IDX623"></A>
634 Output version information and exit.
636 </DL>
640 <H2><A NAME="SEC94" HREF="gettext_toc.html#TOC94">9.3 Invoking the <CODE>msggrep</CODE> Program</A></H2>
643 <A NAME="IDX624"></A>
644 <A NAME="IDX625"></A>
646 <PRE>
647 msggrep [<VAR>option</VAR>] [<VAR>inputfile</VAR>]
648 </PRE>
651 <A NAME="IDX626"></A>
652 The <CODE>msggrep</CODE> program extracts all messages of a translation catalog
653 that match a given pattern or belong to some given source files.
655 </P>
658 <H3><A NAME="SEC95" HREF="gettext_toc.html#TOC95">9.3.1 Input file location</A></H3>
660 <DL COMPACT>
662 <DT><SAMP>&lsquo;<VAR>inputfile</VAR>&rsquo;</SAMP>
663 <DD>
664 Input PO file.
666 <DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
667 <DD>
668 <DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
669 <DD>
670 <A NAME="IDX627"></A>
671 <A NAME="IDX628"></A>
672 Add <VAR>directory</VAR> to the list of directories. Source files are
673 searched relative to this list of directories. The resulting <TT>&lsquo;.po&rsquo;</TT>
674 file will be written relative to the current directory, though.
676 </DL>
679 If no <VAR>inputfile</VAR> is given or if it is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
681 </P>
684 <H3><A NAME="SEC96" HREF="gettext_toc.html#TOC96">9.3.2 Output file location</A></H3>
686 <DL COMPACT>
688 <DT><SAMP>&lsquo;-o <VAR>file</VAR>&rsquo;</SAMP>
689 <DD>
690 <DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
691 <DD>
692 <A NAME="IDX629"></A>
693 <A NAME="IDX630"></A>
694 Write output to specified file.
696 </DL>
699 The results are written to standard output if no output file is specified
700 or if it is <SAMP>&lsquo;-&rsquo;</SAMP>.
702 </P>
705 <H3><A NAME="SEC97" HREF="gettext_toc.html#TOC97">9.3.3 Message selection</A></H3>
708 <PRE>
709 [-N <VAR>sourcefile</VAR>]... [-M <VAR>domainname</VAR>]...
710 [-J <VAR>msgctxt-pattern</VAR>] [-K <VAR>msgid-pattern</VAR>] [-T <VAR>msgstr-pattern</VAR>]
711 [-C <VAR>comment-pattern</VAR>]
712 </PRE>
715 A message is selected if
717 <UL>
718 <LI>it comes from one of the specified source files,
720 <LI>or if it comes from one of the specified domains,
722 <LI>or if <SAMP>&lsquo;-J&rsquo;</SAMP> is given and its context (msgctxt) matches
724 <VAR>msgctxt-pattern</VAR>,
725 <LI>or if <SAMP>&lsquo;-K&rsquo;</SAMP> is given and its key (msgid or msgid_plural) matches
727 <VAR>msgid-pattern</VAR>,
728 <LI>or if <SAMP>&lsquo;-T&rsquo;</SAMP> is given and its translation (msgstr) matches
730 <VAR>msgstr-pattern</VAR>,
731 <LI>or if <SAMP>&lsquo;-C&rsquo;</SAMP> is given and the translator's comment matches
733 <VAR>comment-pattern</VAR>.
734 </UL>
737 When more than one selection criterion is specified, the set of selected
738 messages is the union of the selected messages of each criterion.
740 </P>
742 <VAR>msgctxt-pattern</VAR> or <VAR>msgid-pattern</VAR> or <VAR>msgstr-pattern</VAR> syntax:
744 <PRE>
745 [-E | -F] [-e <VAR>pattern</VAR> | -f <VAR>file</VAR>]...
746 </PRE>
749 <VAR>pattern</VAR>s are basic regular expressions by default, or extended regular
750 expressions if -E is given, or fixed strings if -F is given.
752 </P>
753 <DL COMPACT>
755 <DT><SAMP>&lsquo;-N <VAR>sourcefile</VAR>&rsquo;</SAMP>
756 <DD>
757 <DT><SAMP>&lsquo;--location=<VAR>sourcefile</VAR>&rsquo;</SAMP>
758 <DD>
759 <A NAME="IDX631"></A>
760 <A NAME="IDX632"></A>
761 Select messages extracted from <VAR>sourcefile</VAR>. <VAR>sourcefile</VAR> can be
762 either a literal file name or a wildcard pattern.
764 <DT><SAMP>&lsquo;-M <VAR>domainname</VAR>&rsquo;</SAMP>
765 <DD>
766 <DT><SAMP>&lsquo;--domain=<VAR>domainname</VAR>&rsquo;</SAMP>
767 <DD>
768 <A NAME="IDX633"></A>
769 <A NAME="IDX634"></A>
770 Select messages belonging to domain <VAR>domainname</VAR>.
772 <DT><SAMP>&lsquo;-J&rsquo;</SAMP>
773 <DD>
774 <DT><SAMP>&lsquo;--msgctxt&rsquo;</SAMP>
775 <DD>
776 <A NAME="IDX635"></A>
777 <A NAME="IDX636"></A>
778 Start of patterns for the msgctxt.
780 <DT><SAMP>&lsquo;-K&rsquo;</SAMP>
781 <DD>
782 <DT><SAMP>&lsquo;--msgid&rsquo;</SAMP>
783 <DD>
784 <A NAME="IDX637"></A>
785 <A NAME="IDX638"></A>
786 Start of patterns for the msgid.
788 <DT><SAMP>&lsquo;-T&rsquo;</SAMP>
789 <DD>
790 <DT><SAMP>&lsquo;--msgstr&rsquo;</SAMP>
791 <DD>
792 <A NAME="IDX639"></A>
793 <A NAME="IDX640"></A>
794 Start of patterns for the msgstr.
796 <DT><SAMP>&lsquo;-C&rsquo;</SAMP>
797 <DD>
798 <DT><SAMP>&lsquo;--comment&rsquo;</SAMP>
799 <DD>
800 <A NAME="IDX641"></A>
801 <A NAME="IDX642"></A>
802 Start of patterns for the translator's comment.
804 <DT><SAMP>&lsquo;-X&rsquo;</SAMP>
805 <DD>
806 <DT><SAMP>&lsquo;--extracted-comment&rsquo;</SAMP>
807 <DD>
808 <A NAME="IDX643"></A>
809 <A NAME="IDX644"></A>
810 Start of patterns for the extracted comments.
812 <DT><SAMP>&lsquo;-E&rsquo;</SAMP>
813 <DD>
814 <DT><SAMP>&lsquo;--extended-regexp&rsquo;</SAMP>
815 <DD>
816 <A NAME="IDX645"></A>
817 <A NAME="IDX646"></A>
818 Specify that <VAR>pattern</VAR> is an extended regular expression.
820 <DT><SAMP>&lsquo;-F&rsquo;</SAMP>
821 <DD>
822 <DT><SAMP>&lsquo;--fixed-strings&rsquo;</SAMP>
823 <DD>
824 <A NAME="IDX647"></A>
825 <A NAME="IDX648"></A>
826 Specify that <VAR>pattern</VAR> is a set of newline-separated strings.
828 <DT><SAMP>&lsquo;-e <VAR>pattern</VAR>&rsquo;</SAMP>
829 <DD>
830 <DT><SAMP>&lsquo;--regexp=<VAR>pattern</VAR>&rsquo;</SAMP>
831 <DD>
832 <A NAME="IDX649"></A>
833 <A NAME="IDX650"></A>
834 Use <VAR>pattern</VAR> as a regular expression.
836 <DT><SAMP>&lsquo;-f <VAR>file</VAR>&rsquo;</SAMP>
837 <DD>
838 <DT><SAMP>&lsquo;--file=<VAR>file</VAR>&rsquo;</SAMP>
839 <DD>
840 <A NAME="IDX651"></A>
841 <A NAME="IDX652"></A>
842 Obtain <VAR>pattern</VAR> from <VAR>file</VAR>.
844 <DT><SAMP>&lsquo;-i&rsquo;</SAMP>
845 <DD>
846 <DT><SAMP>&lsquo;--ignore-case&rsquo;</SAMP>
847 <DD>
848 <A NAME="IDX653"></A>
849 <A NAME="IDX654"></A>
850 Ignore case distinctions.
852 <DT><SAMP>&lsquo;-v&rsquo;</SAMP>
853 <DD>
854 <DT><SAMP>&lsquo;--invert-match&rsquo;</SAMP>
855 <DD>
856 <A NAME="IDX655"></A>
857 <A NAME="IDX656"></A>
858 Output only the messages that do not match any selection criterion, instead
859 of the messages that match a selection criterion.
861 </DL>
865 <H3><A NAME="SEC98" HREF="gettext_toc.html#TOC98">9.3.4 Input file syntax</A></H3>
867 <DL COMPACT>
869 <DT><SAMP>&lsquo;-P&rsquo;</SAMP>
870 <DD>
871 <DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
872 <DD>
873 <A NAME="IDX657"></A>
874 <A NAME="IDX658"></A>
875 Assume the input file is a Java ResourceBundle in Java <CODE>.properties</CODE>
876 syntax, not in PO file syntax.
878 <DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
879 <DD>
880 <A NAME="IDX659"></A>
881 Assume the input file is a NeXTstep/GNUstep localized resource file in
882 <CODE>.strings</CODE> syntax, not in PO file syntax.
884 </DL>
888 <H3><A NAME="SEC99" HREF="gettext_toc.html#TOC99">9.3.5 Output details</A></H3>
890 <DL COMPACT>
892 <DT><SAMP>&lsquo;--color&rsquo;</SAMP>
893 <DD>
894 <DT><SAMP>&lsquo;--color=<VAR>when</VAR>&rsquo;</SAMP>
895 <DD>
896 <A NAME="IDX660"></A>
897 Specify whether or when to use colors and other text attributes.
898 See section <A HREF="gettext_9.html#SEC150">9.11.1 The <CODE>--color</CODE> option</A> for details.
900 <DT><SAMP>&lsquo;--style=<VAR>style_file</VAR>&rsquo;</SAMP>
901 <DD>
902 <A NAME="IDX661"></A>
903 Specify the CSS style rule file to use for <CODE>--color</CODE>.
904 See section <A HREF="gettext_9.html#SEC152">9.11.3 The <CODE>--style</CODE> option</A> for details.
906 <DT><SAMP>&lsquo;--force-po&rsquo;</SAMP>
907 <DD>
908 <A NAME="IDX662"></A>
909 Always write an output file even if it contains no message.
911 <DT><SAMP>&lsquo;--indent&rsquo;</SAMP>
912 <DD>
913 <A NAME="IDX663"></A>
914 Write the .po file using indented style.
916 <DT><SAMP>&lsquo;--no-location&rsquo;</SAMP>
917 <DD>
918 <A NAME="IDX664"></A>
919 Do not write <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines.
921 <DT><SAMP>&lsquo;--add-location&rsquo;</SAMP>
922 <DD>
923 <A NAME="IDX665"></A>
924 Generate <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines (default).
926 <DT><SAMP>&lsquo;--strict&rsquo;</SAMP>
927 <DD>
928 <A NAME="IDX666"></A>
929 Write out a strict Uniforum conforming PO file. Note that this
930 Uniforum format should be avoided because it doesn't support the
931 GNU extensions.
933 <DT><SAMP>&lsquo;-p&rsquo;</SAMP>
934 <DD>
935 <DT><SAMP>&lsquo;--properties-output&rsquo;</SAMP>
936 <DD>
937 <A NAME="IDX667"></A>
938 <A NAME="IDX668"></A>
939 Write out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax. Note
940 that this file format doesn't support plural forms and silently drops
941 obsolete messages.
943 <DT><SAMP>&lsquo;--stringtable-output&rsquo;</SAMP>
944 <DD>
945 <A NAME="IDX669"></A>
946 Write out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
947 Note that this file format doesn't support plural forms.
949 <DT><SAMP>&lsquo;-w <VAR>number</VAR>&rsquo;</SAMP>
950 <DD>
951 <DT><SAMP>&lsquo;--width=<VAR>number</VAR>&rsquo;</SAMP>
952 <DD>
953 <A NAME="IDX670"></A>
954 <A NAME="IDX671"></A>
955 Set the output page width. Long strings in the output files will be
956 split across multiple lines in order to ensure that each line's width
957 (= number of screen columns) is less or equal to the given <VAR>number</VAR>.
959 <DT><SAMP>&lsquo;--no-wrap&rsquo;</SAMP>
960 <DD>
961 <A NAME="IDX672"></A>
962 Do not break long message lines. Message lines whose width exceeds the
963 output page width will not be split into several lines. Only file reference
964 lines which are wider than the output page width will be split.
966 <DT><SAMP>&lsquo;--sort-output&rsquo;</SAMP>
967 <DD>
968 <A NAME="IDX673"></A>
969 Generate sorted output. Note that using this option makes it much harder
970 for the translator to understand each message's context.
972 <DT><SAMP>&lsquo;--sort-by-file&rsquo;</SAMP>
973 <DD>
974 <A NAME="IDX674"></A>
975 Sort output by file location.
977 </DL>
981 <H3><A NAME="SEC100" HREF="gettext_toc.html#TOC100">9.3.6 Informative output</A></H3>
983 <DL COMPACT>
985 <DT><SAMP>&lsquo;-h&rsquo;</SAMP>
986 <DD>
987 <DT><SAMP>&lsquo;--help&rsquo;</SAMP>
988 <DD>
989 <A NAME="IDX675"></A>
990 <A NAME="IDX676"></A>
991 Display this help and exit.
993 <DT><SAMP>&lsquo;-V&rsquo;</SAMP>
994 <DD>
995 <DT><SAMP>&lsquo;--version&rsquo;</SAMP>
996 <DD>
997 <A NAME="IDX677"></A>
998 <A NAME="IDX678"></A>
999 Output version information and exit.
1001 </DL>
1005 <H3><A NAME="SEC101" HREF="gettext_toc.html#TOC101">9.3.7 Examples</A></H3>
1008 To extract the messages that come from the source files
1009 <CODE>gnulib-lib/error.c</CODE> and <CODE>gnulib-lib/getopt.c</CODE>:
1011 </P>
1013 <PRE>
1014 msggrep -N gnulib-lib/error.c -N gnulib-lib/getopt.c input.po
1015 </PRE>
1018 To extract the messages that contain the string “Please specify” in the
1019 original string:
1021 </P>
1023 <PRE>
1024 msggrep --msgid -F -e 'Please specify' input.po
1025 </PRE>
1028 To extract the messages that have a context specifier of either “Menu&#62;File”
1029 or “Menu&#62;Edit” or a submenu of them:
1031 </P>
1033 <PRE>
1034 msggrep --msgctxt -E -e '^Menu&#62;(File|Edit)' input.po
1035 </PRE>
1038 To extract the messages whose translation contains one of the strings in the
1039 file <CODE>wordlist.txt</CODE>:
1041 </P>
1043 <PRE>
1044 msggrep --msgstr -F -f wordlist.txt input.po
1045 </PRE>
1049 <H2><A NAME="SEC102" HREF="gettext_toc.html#TOC102">9.4 Invoking the <CODE>msgfilter</CODE> Program</A></H2>
1052 <A NAME="IDX679"></A>
1053 <A NAME="IDX680"></A>
1055 <PRE>
1056 msgfilter [<VAR>option</VAR>] <VAR>filter</VAR> [<VAR>filter-option</VAR>]
1057 </PRE>
1060 <A NAME="IDX681"></A>
1061 The <CODE>msgfilter</CODE> program applies a filter to all translations of a
1062 translation catalog.
1064 </P>
1066 <A NAME="IDX682"></A>
1067 <A NAME="IDX683"></A>
1068 <A NAME="IDX684"></A>
1069 During each <VAR>filter</VAR> invocation, the environment variable
1070 <CODE>MSGFILTER_MSGID</CODE> is bound to the message's msgid, and the environment
1071 variable <CODE>MSGFILTER_LOCATION</CODE> is bound to the location in the PO file
1072 of the message. If the message has a context, the environment variable
1073 <CODE>MSGFILTER_MSGCTXT</CODE> is bound to the message's msgctxt, otherwise it is
1074 unbound.
1076 </P>
1079 <H3><A NAME="SEC103" HREF="gettext_toc.html#TOC103">9.4.1 Input file location</A></H3>
1081 <DL COMPACT>
1083 <DT><SAMP>&lsquo;-i <VAR>inputfile</VAR>&rsquo;</SAMP>
1084 <DD>
1085 <DT><SAMP>&lsquo;--input=<VAR>inputfile</VAR>&rsquo;</SAMP>
1086 <DD>
1087 <A NAME="IDX685"></A>
1088 <A NAME="IDX686"></A>
1089 Input PO file.
1091 <DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
1092 <DD>
1093 <DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
1094 <DD>
1095 <A NAME="IDX687"></A>
1096 <A NAME="IDX688"></A>
1097 Add <VAR>directory</VAR> to the list of directories. Source files are
1098 searched relative to this list of directories. The resulting <TT>&lsquo;.po&rsquo;</TT>
1099 file will be written relative to the current directory, though.
1101 </DL>
1104 If no <VAR>inputfile</VAR> is given or if it is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
1106 </P>
1109 <H3><A NAME="SEC104" HREF="gettext_toc.html#TOC104">9.4.2 Output file location</A></H3>
1111 <DL COMPACT>
1113 <DT><SAMP>&lsquo;-o <VAR>file</VAR>&rsquo;</SAMP>
1114 <DD>
1115 <DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
1116 <DD>
1117 <A NAME="IDX689"></A>
1118 <A NAME="IDX690"></A>
1119 Write output to specified file.
1121 </DL>
1124 The results are written to standard output if no output file is specified
1125 or if it is <SAMP>&lsquo;-&rsquo;</SAMP>.
1127 </P>
1130 <H3><A NAME="SEC105" HREF="gettext_toc.html#TOC105">9.4.3 The filter</A></H3>
1133 The <VAR>filter</VAR> can be any program that reads a translation from standard
1134 input and writes a modified translation to standard output. A frequently
1135 used filter is <SAMP>&lsquo;sed&rsquo;</SAMP>. A few particular built-in filters are also
1136 recognized.
1138 </P>
1140 <A NAME="IDX691"></A>
1141 Note: If the filter is not a built-in filter, you have to care about encodings:
1142 It is your responsibility to ensure that the <VAR>filter</VAR> can cope
1143 with input encoded in the translation catalog's encoding. If the
1144 <VAR>filter</VAR> wants input in a particular encoding, you can in a first step
1145 convert the translation catalog to that encoding using the <SAMP>&lsquo;msgconv&rsquo;</SAMP>
1146 program, before invoking <SAMP>&lsquo;msgfilter&rsquo;</SAMP>. If the <VAR>filter</VAR> wants input
1147 in the locale's encoding, but you want to avoid the locale's encoding, then
1148 you can first convert the translation catalog to UTF-8 using the
1149 <SAMP>&lsquo;msgconv&rsquo;</SAMP> program and then make <SAMP>&lsquo;msgfilter&rsquo;</SAMP> work in an UTF-8
1150 locale, by using the <CODE>LC_ALL</CODE> environment variable.
1152 </P>
1154 <A NAME="IDX692"></A>
1155 Note: Most translations in a translation catalog don't end with a newline
1156 character. For this reason, it is important that the <VAR>filter</VAR>
1157 recognizes its last input line even if it ends without a newline, and that
1158 it doesn't add an undesired trailing newline at the end. The <SAMP>&lsquo;sed&rsquo;</SAMP>
1159 program on some platforms is known to ignore the last line of input if it
1160 is not terminated with a newline. You can use GNU <CODE>sed</CODE> instead; it
1161 does not have this limitation.
1163 </P>
1166 <H3><A NAME="SEC106" HREF="gettext_toc.html#TOC106">9.4.4 Useful <VAR>filter-option</VAR>s when the <VAR>filter</VAR> is <SAMP>&lsquo;sed&rsquo;</SAMP></A></H3>
1168 <DL COMPACT>
1170 <DT><SAMP>&lsquo;-e <VAR>script</VAR>&rsquo;</SAMP>
1171 <DD>
1172 <DT><SAMP>&lsquo;--expression=<VAR>script</VAR>&rsquo;</SAMP>
1173 <DD>
1174 <A NAME="IDX693"></A>
1175 <A NAME="IDX694"></A>
1176 Add <VAR>script</VAR> to the commands to be executed.
1178 <DT><SAMP>&lsquo;-f <VAR>scriptfile</VAR>&rsquo;</SAMP>
1179 <DD>
1180 <DT><SAMP>&lsquo;--file=<VAR>scriptfile</VAR>&rsquo;</SAMP>
1181 <DD>
1182 <A NAME="IDX695"></A>
1183 <A NAME="IDX696"></A>
1184 Add the contents of <VAR>scriptfile</VAR> to the commands to be executed.
1186 <DT><SAMP>&lsquo;-n&rsquo;</SAMP>
1187 <DD>
1188 <DT><SAMP>&lsquo;--quiet&rsquo;</SAMP>
1189 <DD>
1190 <DT><SAMP>&lsquo;--silent&rsquo;</SAMP>
1191 <DD>
1192 <A NAME="IDX697"></A>
1193 <A NAME="IDX698"></A>
1194 <A NAME="IDX699"></A>
1195 Suppress automatic printing of pattern space.
1197 </DL>
1201 <H3><A NAME="SEC107" HREF="gettext_toc.html#TOC107">9.4.5 Built-in <VAR>filter</VAR>s</A></H3>
1204 <A NAME="IDX700"></A>
1205 <A NAME="IDX701"></A>
1206 The filter <SAMP>&lsquo;recode-sr-latin&rsquo;</SAMP> is recognized as a built-in filter.
1207 The command <SAMP>&lsquo;recode-sr-latin&rsquo;</SAMP> converts Serbian text, written in the
1208 Cyrillic script, to the Latin script.
1209 The command <SAMP>&lsquo;msgfilter recode-sr-latin&rsquo;</SAMP> applies this conversion to the
1210 translations of a PO file. Thus, it can be used to convert an <TT>&lsquo;sr.po&rsquo;</TT>
1211 file to an <TT>&lsquo;sr@latin.po&rsquo;</TT> file.
1213 </P>
1215 The use of built-in filters is not sensitive to the current locale's encoding.
1216 Moreover, when used with a built-in filter, <SAMP>&lsquo;msgfilter&rsquo;</SAMP> can automatically
1217 convert the message catalog to the UTF-8 encoding when needed.
1219 </P>
1222 <H3><A NAME="SEC108" HREF="gettext_toc.html#TOC108">9.4.6 Input file syntax</A></H3>
1224 <DL COMPACT>
1226 <DT><SAMP>&lsquo;-P&rsquo;</SAMP>
1227 <DD>
1228 <DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
1229 <DD>
1230 <A NAME="IDX702"></A>
1231 <A NAME="IDX703"></A>
1232 Assume the input file is a Java ResourceBundle in Java <CODE>.properties</CODE>
1233 syntax, not in PO file syntax.
1235 <DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
1236 <DD>
1237 <A NAME="IDX704"></A>
1238 Assume the input file is a NeXTstep/GNUstep localized resource file in
1239 <CODE>.strings</CODE> syntax, not in PO file syntax.
1241 </DL>
1245 <H3><A NAME="SEC109" HREF="gettext_toc.html#TOC109">9.4.7 Output details</A></H3>
1247 <DL COMPACT>
1249 <DT><SAMP>&lsquo;--color&rsquo;</SAMP>
1250 <DD>
1251 <DT><SAMP>&lsquo;--color=<VAR>when</VAR>&rsquo;</SAMP>
1252 <DD>
1253 <A NAME="IDX705"></A>
1254 Specify whether or when to use colors and other text attributes.
1255 See section <A HREF="gettext_9.html#SEC150">9.11.1 The <CODE>--color</CODE> option</A> for details.
1257 <DT><SAMP>&lsquo;--style=<VAR>style_file</VAR>&rsquo;</SAMP>
1258 <DD>
1259 <A NAME="IDX706"></A>
1260 Specify the CSS style rule file to use for <CODE>--color</CODE>.
1261 See section <A HREF="gettext_9.html#SEC152">9.11.3 The <CODE>--style</CODE> option</A> for details.
1263 <DT><SAMP>&lsquo;--force-po&rsquo;</SAMP>
1264 <DD>
1265 <A NAME="IDX707"></A>
1266 Always write an output file even if it contains no message.
1268 <DT><SAMP>&lsquo;--indent&rsquo;</SAMP>
1269 <DD>
1270 <A NAME="IDX708"></A>
1271 Write the .po file using indented style.
1273 <DT><SAMP>&lsquo;--keep-header&rsquo;</SAMP>
1274 <DD>
1275 <A NAME="IDX709"></A>
1276 Keep the header entry, i.e. the message with <SAMP>&lsquo;msgid ""&rsquo;</SAMP>, unmodified,
1277 instead of filtering it. By default, the header entry is subject to
1278 filtering like any other message.
1280 <DT><SAMP>&lsquo;--no-location&rsquo;</SAMP>
1281 <DD>
1282 <A NAME="IDX710"></A>
1283 Do not write <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines.
1285 <DT><SAMP>&lsquo;--add-location&rsquo;</SAMP>
1286 <DD>
1287 <A NAME="IDX711"></A>
1288 Generate <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines (default).
1290 <DT><SAMP>&lsquo;--strict&rsquo;</SAMP>
1291 <DD>
1292 <A NAME="IDX712"></A>
1293 Write out a strict Uniforum conforming PO file. Note that this
1294 Uniforum format should be avoided because it doesn't support the
1295 GNU extensions.
1297 <DT><SAMP>&lsquo;-p&rsquo;</SAMP>
1298 <DD>
1299 <DT><SAMP>&lsquo;--properties-output&rsquo;</SAMP>
1300 <DD>
1301 <A NAME="IDX713"></A>
1302 <A NAME="IDX714"></A>
1303 Write out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax. Note
1304 that this file format doesn't support plural forms and silently drops
1305 obsolete messages.
1307 <DT><SAMP>&lsquo;--stringtable-output&rsquo;</SAMP>
1308 <DD>
1309 <A NAME="IDX715"></A>
1310 Write out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
1311 Note that this file format doesn't support plural forms.
1313 <DT><SAMP>&lsquo;-w <VAR>number</VAR>&rsquo;</SAMP>
1314 <DD>
1315 <DT><SAMP>&lsquo;--width=<VAR>number</VAR>&rsquo;</SAMP>
1316 <DD>
1317 <A NAME="IDX716"></A>
1318 <A NAME="IDX717"></A>
1319 Set the output page width. Long strings in the output files will be
1320 split across multiple lines in order to ensure that each line's width
1321 (= number of screen columns) is less or equal to the given <VAR>number</VAR>.
1323 <DT><SAMP>&lsquo;--no-wrap&rsquo;</SAMP>
1324 <DD>
1325 <A NAME="IDX718"></A>
1326 Do not break long message lines. Message lines whose width exceeds the
1327 output page width will not be split into several lines. Only file reference
1328 lines which are wider than the output page width will be split.
1330 <DT><SAMP>&lsquo;-s&rsquo;</SAMP>
1331 <DD>
1332 <DT><SAMP>&lsquo;--sort-output&rsquo;</SAMP>
1333 <DD>
1334 <A NAME="IDX719"></A>
1335 <A NAME="IDX720"></A>
1336 Generate sorted output. Note that using this option makes it much harder
1337 for the translator to understand each message's context.
1339 <DT><SAMP>&lsquo;-F&rsquo;</SAMP>
1340 <DD>
1341 <DT><SAMP>&lsquo;--sort-by-file&rsquo;</SAMP>
1342 <DD>
1343 <A NAME="IDX721"></A>
1344 <A NAME="IDX722"></A>
1345 Sort output by file location.
1347 </DL>
1351 <H3><A NAME="SEC110" HREF="gettext_toc.html#TOC110">9.4.8 Informative output</A></H3>
1353 <DL COMPACT>
1355 <DT><SAMP>&lsquo;-h&rsquo;</SAMP>
1356 <DD>
1357 <DT><SAMP>&lsquo;--help&rsquo;</SAMP>
1358 <DD>
1359 <A NAME="IDX723"></A>
1360 <A NAME="IDX724"></A>
1361 Display this help and exit.
1363 <DT><SAMP>&lsquo;-V&rsquo;</SAMP>
1364 <DD>
1365 <DT><SAMP>&lsquo;--version&rsquo;</SAMP>
1366 <DD>
1367 <A NAME="IDX725"></A>
1368 <A NAME="IDX726"></A>
1369 Output version information and exit.
1371 </DL>
1375 <H3><A NAME="SEC111" HREF="gettext_toc.html#TOC111">9.4.9 Examples</A></H3>
1378 To convert German translations to Swiss orthography (in an UTF-8 locale):
1380 </P>
1382 <PRE>
1383 msgconv -t UTF-8 de.po | msgfilter sed -e 's/&szlig;/ss/g'
1384 </PRE>
1387 To convert Serbian translations in Cyrillic script to Latin script:
1389 </P>
1391 <PRE>
1392 msgfilter recode-sr-latin &#60; sr.po
1393 </PRE>
1397 <H2><A NAME="SEC112" HREF="gettext_toc.html#TOC112">9.5 Invoking the <CODE>msguniq</CODE> Program</A></H2>
1400 <A NAME="IDX727"></A>
1401 <A NAME="IDX728"></A>
1403 <PRE>
1404 msguniq [<VAR>option</VAR>] [<VAR>inputfile</VAR>]
1405 </PRE>
1408 <A NAME="IDX729"></A>
1409 <A NAME="IDX730"></A>
1410 The <CODE>msguniq</CODE> program unifies duplicate translations in a translation
1411 catalog. It finds duplicate translations of the same message ID. Such
1412 duplicates are invalid input for other programs like <CODE>msgfmt</CODE>,
1413 <CODE>msgmerge</CODE> or <CODE>msgcat</CODE>. By default, duplicates are merged
1414 together. When using the <SAMP>&lsquo;--repeated&rsquo;</SAMP> option, only duplicates are
1415 output, and all other messages are discarded. Comments and extracted
1416 comments will be cumulated, except that if <SAMP>&lsquo;--use-first&rsquo;</SAMP> is
1417 specified, they will be taken from the first translation. File positions
1418 will be cumulated. When using the <SAMP>&lsquo;--unique&rsquo;</SAMP> option, duplicates are
1419 discarded.
1421 </P>
1424 <H3><A NAME="SEC113" HREF="gettext_toc.html#TOC113">9.5.1 Input file location</A></H3>
1426 <DL COMPACT>
1428 <DT><SAMP>&lsquo;<VAR>inputfile</VAR>&rsquo;</SAMP>
1429 <DD>
1430 Input PO file.
1432 <DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
1433 <DD>
1434 <DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
1435 <DD>
1436 <A NAME="IDX731"></A>
1437 <A NAME="IDX732"></A>
1438 Add <VAR>directory</VAR> to the list of directories. Source files are
1439 searched relative to this list of directories. The resulting <TT>&lsquo;.po&rsquo;</TT>
1440 file will be written relative to the current directory, though.
1442 </DL>
1445 If no <VAR>inputfile</VAR> is given or if it is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
1447 </P>
1450 <H3><A NAME="SEC114" HREF="gettext_toc.html#TOC114">9.5.2 Output file location</A></H3>
1452 <DL COMPACT>
1454 <DT><SAMP>&lsquo;-o <VAR>file</VAR>&rsquo;</SAMP>
1455 <DD>
1456 <DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
1457 <DD>
1458 <A NAME="IDX733"></A>
1459 <A NAME="IDX734"></A>
1460 Write output to specified file.
1462 </DL>
1465 The results are written to standard output if no output file is specified
1466 or if it is <SAMP>&lsquo;-&rsquo;</SAMP>.
1468 </P>
1471 <H3><A NAME="SEC115" HREF="gettext_toc.html#TOC115">9.5.3 Message selection</A></H3>
1473 <DL COMPACT>
1475 <DT><SAMP>&lsquo;-d&rsquo;</SAMP>
1476 <DD>
1477 <DT><SAMP>&lsquo;--repeated&rsquo;</SAMP>
1478 <DD>
1479 <A NAME="IDX735"></A>
1480 <A NAME="IDX736"></A>
1481 Print only duplicates.
1483 <DT><SAMP>&lsquo;-u&rsquo;</SAMP>
1484 <DD>
1485 <DT><SAMP>&lsquo;--unique&rsquo;</SAMP>
1486 <DD>
1487 <A NAME="IDX737"></A>
1488 <A NAME="IDX738"></A>
1489 Print only unique messages, discard duplicates.
1491 </DL>
1495 <H3><A NAME="SEC116" HREF="gettext_toc.html#TOC116">9.5.4 Input file syntax</A></H3>
1497 <DL COMPACT>
1499 <DT><SAMP>&lsquo;-P&rsquo;</SAMP>
1500 <DD>
1501 <DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
1502 <DD>
1503 <A NAME="IDX739"></A>
1504 <A NAME="IDX740"></A>
1505 Assume the input file is a Java ResourceBundle in Java <CODE>.properties</CODE>
1506 syntax, not in PO file syntax.
1508 <DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
1509 <DD>
1510 <A NAME="IDX741"></A>
1511 Assume the input file is a NeXTstep/GNUstep localized resource file in
1512 <CODE>.strings</CODE> syntax, not in PO file syntax.
1514 </DL>
1518 <H3><A NAME="SEC117" HREF="gettext_toc.html#TOC117">9.5.5 Output details</A></H3>
1520 <DL COMPACT>
1522 <DT><SAMP>&lsquo;-t&rsquo;</SAMP>
1523 <DD>
1524 <DT><SAMP>&lsquo;--to-code=<VAR>name</VAR>&rsquo;</SAMP>
1525 <DD>
1526 <A NAME="IDX742"></A>
1527 <A NAME="IDX743"></A>
1528 Specify encoding for output.
1530 <DT><SAMP>&lsquo;--use-first&rsquo;</SAMP>
1531 <DD>
1532 <A NAME="IDX744"></A>
1533 Use first available translation for each message. Don't merge several
1534 translations into one.
1536 <DT><SAMP>&lsquo;--color&rsquo;</SAMP>
1537 <DD>
1538 <DT><SAMP>&lsquo;--color=<VAR>when</VAR>&rsquo;</SAMP>
1539 <DD>
1540 <A NAME="IDX745"></A>
1541 Specify whether or when to use colors and other text attributes.
1542 See section <A HREF="gettext_9.html#SEC150">9.11.1 The <CODE>--color</CODE> option</A> for details.
1544 <DT><SAMP>&lsquo;--style=<VAR>style_file</VAR>&rsquo;</SAMP>
1545 <DD>
1546 <A NAME="IDX746"></A>
1547 Specify the CSS style rule file to use for <CODE>--color</CODE>.
1548 See section <A HREF="gettext_9.html#SEC152">9.11.3 The <CODE>--style</CODE> option</A> for details.
1550 <DT><SAMP>&lsquo;--force-po&rsquo;</SAMP>
1551 <DD>
1552 <A NAME="IDX747"></A>
1553 Always write an output file even if it contains no message.
1555 <DT><SAMP>&lsquo;-i&rsquo;</SAMP>
1556 <DD>
1557 <DT><SAMP>&lsquo;--indent&rsquo;</SAMP>
1558 <DD>
1559 <A NAME="IDX748"></A>
1560 <A NAME="IDX749"></A>
1561 Write the .po file using indented style.
1563 <DT><SAMP>&lsquo;--no-location&rsquo;</SAMP>
1564 <DD>
1565 <A NAME="IDX750"></A>
1566 Do not write <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines.
1568 <DT><SAMP>&lsquo;-n&rsquo;</SAMP>
1569 <DD>
1570 <DT><SAMP>&lsquo;--add-location&rsquo;</SAMP>
1571 <DD>
1572 <A NAME="IDX751"></A>
1573 <A NAME="IDX752"></A>
1574 Generate <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines (default).
1576 <DT><SAMP>&lsquo;--strict&rsquo;</SAMP>
1577 <DD>
1578 <A NAME="IDX753"></A>
1579 Write out a strict Uniforum conforming PO file. Note that this
1580 Uniforum format should be avoided because it doesn't support the
1581 GNU extensions.
1583 <DT><SAMP>&lsquo;-p&rsquo;</SAMP>
1584 <DD>
1585 <DT><SAMP>&lsquo;--properties-output&rsquo;</SAMP>
1586 <DD>
1587 <A NAME="IDX754"></A>
1588 <A NAME="IDX755"></A>
1589 Write out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax. Note
1590 that this file format doesn't support plural forms and silently drops
1591 obsolete messages.
1593 <DT><SAMP>&lsquo;--stringtable-output&rsquo;</SAMP>
1594 <DD>
1595 <A NAME="IDX756"></A>
1596 Write out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
1597 Note that this file format doesn't support plural forms.
1599 <DT><SAMP>&lsquo;-w <VAR>number</VAR>&rsquo;</SAMP>
1600 <DD>
1601 <DT><SAMP>&lsquo;--width=<VAR>number</VAR>&rsquo;</SAMP>
1602 <DD>
1603 <A NAME="IDX757"></A>
1604 <A NAME="IDX758"></A>
1605 Set the output page width. Long strings in the output files will be
1606 split across multiple lines in order to ensure that each line's width
1607 (= number of screen columns) is less or equal to the given <VAR>number</VAR>.
1609 <DT><SAMP>&lsquo;--no-wrap&rsquo;</SAMP>
1610 <DD>
1611 <A NAME="IDX759"></A>
1612 Do not break long message lines. Message lines whose width exceeds the
1613 output page width will not be split into several lines. Only file reference
1614 lines which are wider than the output page width will be split.
1616 <DT><SAMP>&lsquo;-s&rsquo;</SAMP>
1617 <DD>
1618 <DT><SAMP>&lsquo;--sort-output&rsquo;</SAMP>
1619 <DD>
1620 <A NAME="IDX760"></A>
1621 <A NAME="IDX761"></A>
1622 Generate sorted output. Note that using this option makes it much harder
1623 for the translator to understand each message's context.
1625 <DT><SAMP>&lsquo;-F&rsquo;</SAMP>
1626 <DD>
1627 <DT><SAMP>&lsquo;--sort-by-file&rsquo;</SAMP>
1628 <DD>
1629 <A NAME="IDX762"></A>
1630 <A NAME="IDX763"></A>
1631 Sort output by file location.
1633 </DL>
1637 <H3><A NAME="SEC118" HREF="gettext_toc.html#TOC118">9.5.6 Informative output</A></H3>
1639 <DL COMPACT>
1641 <DT><SAMP>&lsquo;-h&rsquo;</SAMP>
1642 <DD>
1643 <DT><SAMP>&lsquo;--help&rsquo;</SAMP>
1644 <DD>
1645 <A NAME="IDX764"></A>
1646 <A NAME="IDX765"></A>
1647 Display this help and exit.
1649 <DT><SAMP>&lsquo;-V&rsquo;</SAMP>
1650 <DD>
1651 <DT><SAMP>&lsquo;--version&rsquo;</SAMP>
1652 <DD>
1653 <A NAME="IDX766"></A>
1654 <A NAME="IDX767"></A>
1655 Output version information and exit.
1657 </DL>
1661 <H2><A NAME="SEC119" HREF="gettext_toc.html#TOC119">9.6 Invoking the <CODE>msgcomm</CODE> Program</A></H2>
1664 <A NAME="IDX768"></A>
1665 <A NAME="IDX769"></A>
1667 <PRE>
1668 msgcomm [<VAR>option</VAR>] [<VAR>inputfile</VAR>]...
1669 </PRE>
1672 <A NAME="IDX770"></A>
1673 The <CODE>msgcomm</CODE> program finds messages which are common to two or more
1674 of the specified PO files.
1675 By using the <CODE>--more-than</CODE> option, greater commonality may be requested
1676 before messages are printed. Conversely, the <CODE>--less-than</CODE> option may be
1677 used to specify less commonality before messages are printed (i.e.
1678 <SAMP>&lsquo;--less-than=2&rsquo;</SAMP> will only print the unique messages). Translations,
1679 comments and extract comments will be preserved, but only from the first
1680 PO file to define them. File positions from all PO files will be
1681 cumulated.
1683 </P>
1686 <H3><A NAME="SEC120" HREF="gettext_toc.html#TOC120">9.6.1 Input file location</A></H3>
1688 <DL COMPACT>
1690 <DT><SAMP>&lsquo;<VAR>inputfile</VAR> ...&rsquo;</SAMP>
1691 <DD>
1692 Input files.
1694 <DT><SAMP>&lsquo;-f <VAR>file</VAR>&rsquo;</SAMP>
1695 <DD>
1696 <DT><SAMP>&lsquo;--files-from=<VAR>file</VAR>&rsquo;</SAMP>
1697 <DD>
1698 <A NAME="IDX771"></A>
1699 <A NAME="IDX772"></A>
1700 Read the names of the input files from <VAR>file</VAR> instead of getting
1701 them from the command line.
1703 <DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
1704 <DD>
1705 <DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
1706 <DD>
1707 <A NAME="IDX773"></A>
1708 <A NAME="IDX774"></A>
1709 Add <VAR>directory</VAR> to the list of directories. Source files are
1710 searched relative to this list of directories. The resulting <TT>&lsquo;.po&rsquo;</TT>
1711 file will be written relative to the current directory, though.
1713 </DL>
1716 If <VAR>inputfile</VAR> is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
1718 </P>
1721 <H3><A NAME="SEC121" HREF="gettext_toc.html#TOC121">9.6.2 Output file location</A></H3>
1723 <DL COMPACT>
1725 <DT><SAMP>&lsquo;-o <VAR>file</VAR>&rsquo;</SAMP>
1726 <DD>
1727 <DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
1728 <DD>
1729 <A NAME="IDX775"></A>
1730 <A NAME="IDX776"></A>
1731 Write output to specified file.
1733 </DL>
1736 The results are written to standard output if no output file is specified
1737 or if it is <SAMP>&lsquo;-&rsquo;</SAMP>.
1739 </P>
1742 <H3><A NAME="SEC122" HREF="gettext_toc.html#TOC122">9.6.3 Message selection</A></H3>
1744 <DL COMPACT>
1746 <DT><SAMP>&lsquo;-&#60; <VAR>number</VAR>&rsquo;</SAMP>
1747 <DD>
1748 <DT><SAMP>&lsquo;--less-than=<VAR>number</VAR>&rsquo;</SAMP>
1749 <DD>
1750 <A NAME="IDX777"></A>
1751 <A NAME="IDX778"></A>
1752 Print messages with less than <VAR>number</VAR> definitions, defaults to infinite
1753 if not set.
1755 <DT><SAMP>&lsquo;-&#62; <VAR>number</VAR>&rsquo;</SAMP>
1756 <DD>
1757 <DT><SAMP>&lsquo;--more-than=<VAR>number</VAR>&rsquo;</SAMP>
1758 <DD>
1759 <A NAME="IDX779"></A>
1760 <A NAME="IDX780"></A>
1761 Print messages with more than <VAR>number</VAR> definitions, defaults to 1 if not
1762 set.
1764 <DT><SAMP>&lsquo;-u&rsquo;</SAMP>
1765 <DD>
1766 <DT><SAMP>&lsquo;--unique&rsquo;</SAMP>
1767 <DD>
1768 <A NAME="IDX781"></A>
1769 <A NAME="IDX782"></A>
1770 Shorthand for <SAMP>&lsquo;--less-than=2&rsquo;</SAMP>. Requests that only unique messages be
1771 printed.
1773 </DL>
1777 <H3><A NAME="SEC123" HREF="gettext_toc.html#TOC123">9.6.4 Input file syntax</A></H3>
1779 <DL COMPACT>
1781 <DT><SAMP>&lsquo;-P&rsquo;</SAMP>
1782 <DD>
1783 <DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
1784 <DD>
1785 <A NAME="IDX783"></A>
1786 <A NAME="IDX784"></A>
1787 Assume the input files are Java ResourceBundles in Java <CODE>.properties</CODE>
1788 syntax, not in PO file syntax.
1790 <DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
1791 <DD>
1792 <A NAME="IDX785"></A>
1793 Assume the input files are NeXTstep/GNUstep localized resource files in
1794 <CODE>.strings</CODE> syntax, not in PO file syntax.
1796 </DL>
1800 <H3><A NAME="SEC124" HREF="gettext_toc.html#TOC124">9.6.5 Output details</A></H3>
1802 <DL COMPACT>
1804 <DT><SAMP>&lsquo;--color&rsquo;</SAMP>
1805 <DD>
1806 <DT><SAMP>&lsquo;--color=<VAR>when</VAR>&rsquo;</SAMP>
1807 <DD>
1808 <A NAME="IDX786"></A>
1809 Specify whether or when to use colors and other text attributes.
1810 See section <A HREF="gettext_9.html#SEC150">9.11.1 The <CODE>--color</CODE> option</A> for details.
1812 <DT><SAMP>&lsquo;--style=<VAR>style_file</VAR>&rsquo;</SAMP>
1813 <DD>
1814 <A NAME="IDX787"></A>
1815 Specify the CSS style rule file to use for <CODE>--color</CODE>.
1816 See section <A HREF="gettext_9.html#SEC152">9.11.3 The <CODE>--style</CODE> option</A> for details.
1818 <DT><SAMP>&lsquo;--force-po&rsquo;</SAMP>
1819 <DD>
1820 <A NAME="IDX788"></A>
1821 Always write an output file even if it contains no message.
1823 <DT><SAMP>&lsquo;-i&rsquo;</SAMP>
1824 <DD>
1825 <DT><SAMP>&lsquo;--indent&rsquo;</SAMP>
1826 <DD>
1827 <A NAME="IDX789"></A>
1828 <A NAME="IDX790"></A>
1829 Write the .po file using indented style.
1831 <DT><SAMP>&lsquo;--no-location&rsquo;</SAMP>
1832 <DD>
1833 <A NAME="IDX791"></A>
1834 Do not write <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines.
1836 <DT><SAMP>&lsquo;-n&rsquo;</SAMP>
1837 <DD>
1838 <DT><SAMP>&lsquo;--add-location&rsquo;</SAMP>
1839 <DD>
1840 <A NAME="IDX792"></A>
1841 <A NAME="IDX793"></A>
1842 Generate <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines (default).
1844 <DT><SAMP>&lsquo;--strict&rsquo;</SAMP>
1845 <DD>
1846 <A NAME="IDX794"></A>
1847 Write out a strict Uniforum conforming PO file. Note that this
1848 Uniforum format should be avoided because it doesn't support the
1849 GNU extensions.
1851 <DT><SAMP>&lsquo;-p&rsquo;</SAMP>
1852 <DD>
1853 <DT><SAMP>&lsquo;--properties-output&rsquo;</SAMP>
1854 <DD>
1855 <A NAME="IDX795"></A>
1856 <A NAME="IDX796"></A>
1857 Write out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax. Note
1858 that this file format doesn't support plural forms and silently drops
1859 obsolete messages.
1861 <DT><SAMP>&lsquo;--stringtable-output&rsquo;</SAMP>
1862 <DD>
1863 <A NAME="IDX797"></A>
1864 Write out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
1865 Note that this file format doesn't support plural forms.
1867 <DT><SAMP>&lsquo;-w <VAR>number</VAR>&rsquo;</SAMP>
1868 <DD>
1869 <DT><SAMP>&lsquo;--width=<VAR>number</VAR>&rsquo;</SAMP>
1870 <DD>
1871 <A NAME="IDX798"></A>
1872 <A NAME="IDX799"></A>
1873 Set the output page width. Long strings in the output files will be
1874 split across multiple lines in order to ensure that each line's width
1875 (= number of screen columns) is less or equal to the given <VAR>number</VAR>.
1877 <DT><SAMP>&lsquo;--no-wrap&rsquo;</SAMP>
1878 <DD>
1879 <A NAME="IDX800"></A>
1880 Do not break long message lines. Message lines whose width exceeds the
1881 output page width will not be split into several lines. Only file reference
1882 lines which are wider than the output page width will be split.
1884 <DT><SAMP>&lsquo;-s&rsquo;</SAMP>
1885 <DD>
1886 <DT><SAMP>&lsquo;--sort-output&rsquo;</SAMP>
1887 <DD>
1888 <A NAME="IDX801"></A>
1889 <A NAME="IDX802"></A>
1890 Generate sorted output. Note that using this option makes it much harder
1891 for the translator to understand each message's context.
1893 <DT><SAMP>&lsquo;-F&rsquo;</SAMP>
1894 <DD>
1895 <DT><SAMP>&lsquo;--sort-by-file&rsquo;</SAMP>
1896 <DD>
1897 <A NAME="IDX803"></A>
1898 <A NAME="IDX804"></A>
1899 Sort output by file location.
1901 <DT><SAMP>&lsquo;--omit-header&rsquo;</SAMP>
1902 <DD>
1903 <A NAME="IDX805"></A>
1904 Don't write header with <SAMP>&lsquo;msgid ""&rsquo;</SAMP> entry.
1906 </DL>
1910 <H3><A NAME="SEC125" HREF="gettext_toc.html#TOC125">9.6.6 Informative output</A></H3>
1912 <DL COMPACT>
1914 <DT><SAMP>&lsquo;-h&rsquo;</SAMP>
1915 <DD>
1916 <DT><SAMP>&lsquo;--help&rsquo;</SAMP>
1917 <DD>
1918 <A NAME="IDX806"></A>
1919 <A NAME="IDX807"></A>
1920 Display this help and exit.
1922 <DT><SAMP>&lsquo;-V&rsquo;</SAMP>
1923 <DD>
1924 <DT><SAMP>&lsquo;--version&rsquo;</SAMP>
1925 <DD>
1926 <A NAME="IDX808"></A>
1927 <A NAME="IDX809"></A>
1928 Output version information and exit.
1930 </DL>
1934 <H2><A NAME="SEC126" HREF="gettext_toc.html#TOC126">9.7 Invoking the <CODE>msgcmp</CODE> Program</A></H2>
1937 <A NAME="IDX810"></A>
1938 <A NAME="IDX811"></A>
1940 <PRE>
1941 msgcmp [<VAR>option</VAR>] <VAR>def</VAR>.po <VAR>ref</VAR>.pot
1942 </PRE>
1945 <A NAME="IDX812"></A>
1946 The <CODE>msgcmp</CODE> program compares two Uniforum style .po files to check that
1947 both contain the same set of msgid strings. The <VAR>def</VAR>.po file is an
1948 existing PO file with the translations. The <VAR>ref</VAR>.pot file is the last
1949 created PO file, or a PO Template file (generally created by <CODE>xgettext</CODE>).
1950 This is useful for checking that you have translated each and every message
1951 in your program. Where an exact match cannot be found, fuzzy matching is
1952 used to produce better diagnostics.
1954 </P>
1957 <H3><A NAME="SEC127" HREF="gettext_toc.html#TOC127">9.7.1 Input file location</A></H3>
1959 <DL COMPACT>
1961 <DT><SAMP>&lsquo;<VAR>def</VAR>.po&rsquo;</SAMP>
1962 <DD>
1963 Translations.
1965 <DT><SAMP>&lsquo;<VAR>ref</VAR>.pot&rsquo;</SAMP>
1966 <DD>
1967 References to the sources.
1969 <DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
1970 <DD>
1971 <DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
1972 <DD>
1973 <A NAME="IDX813"></A>
1974 <A NAME="IDX814"></A>
1975 Add <VAR>directory</VAR> to the list of directories. Source files are
1976 searched relative to this list of directories.
1978 </DL>
1982 <H3><A NAME="SEC128" HREF="gettext_toc.html#TOC128">9.7.2 Operation modifiers</A></H3>
1984 <DL COMPACT>
1986 <DT><SAMP>&lsquo;-m&rsquo;</SAMP>
1987 <DD>
1988 <DT><SAMP>&lsquo;--multi-domain&rsquo;</SAMP>
1989 <DD>
1990 <A NAME="IDX815"></A>
1991 <A NAME="IDX816"></A>
1992 Apply <VAR>ref</VAR>.pot to each of the domains in <VAR>def</VAR>.po.
1994 <DT><SAMP>&lsquo;-N&rsquo;</SAMP>
1995 <DD>
1996 <DT><SAMP>&lsquo;--no-fuzzy-matching&rsquo;</SAMP>
1997 <DD>
1998 <A NAME="IDX817"></A>
1999 <A NAME="IDX818"></A>
2000 Do not use fuzzy matching when an exact match is not found. This may speed
2001 up the operation considerably.
2003 <DT><SAMP>&lsquo;--use-fuzzy&rsquo;</SAMP>
2004 <DD>
2005 <A NAME="IDX819"></A>
2006 Consider fuzzy messages in the <VAR>def</VAR>.po file like translated messages.
2007 Note that using this option is usually wrong, because fuzzy messages are
2008 exactly those which have not been validated by a human translator.
2010 <DT><SAMP>&lsquo;--use-untranslated&rsquo;</SAMP>
2011 <DD>
2012 <A NAME="IDX820"></A>
2013 Consider untranslated messages in the <VAR>def</VAR>.po file like translated
2014 messages. Note that using this option is usually wrong.
2016 </DL>
2020 <H3><A NAME="SEC129" HREF="gettext_toc.html#TOC129">9.7.3 Input file syntax</A></H3>
2022 <DL COMPACT>
2024 <DT><SAMP>&lsquo;-P&rsquo;</SAMP>
2025 <DD>
2026 <DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
2027 <DD>
2028 <A NAME="IDX821"></A>
2029 <A NAME="IDX822"></A>
2030 Assume the input files are Java ResourceBundles in Java <CODE>.properties</CODE>
2031 syntax, not in PO file syntax.
2033 <DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
2034 <DD>
2035 <A NAME="IDX823"></A>
2036 Assume the input files are NeXTstep/GNUstep localized resource files in
2037 <CODE>.strings</CODE> syntax, not in PO file syntax.
2039 </DL>
2043 <H3><A NAME="SEC130" HREF="gettext_toc.html#TOC130">9.7.4 Informative output</A></H3>
2045 <DL COMPACT>
2047 <DT><SAMP>&lsquo;-h&rsquo;</SAMP>
2048 <DD>
2049 <DT><SAMP>&lsquo;--help&rsquo;</SAMP>
2050 <DD>
2051 <A NAME="IDX824"></A>
2052 <A NAME="IDX825"></A>
2053 Display this help and exit.
2055 <DT><SAMP>&lsquo;-V&rsquo;</SAMP>
2056 <DD>
2057 <DT><SAMP>&lsquo;--version&rsquo;</SAMP>
2058 <DD>
2059 <A NAME="IDX826"></A>
2060 <A NAME="IDX827"></A>
2061 Output version information and exit.
2063 </DL>
2067 <H2><A NAME="SEC131" HREF="gettext_toc.html#TOC131">9.8 Invoking the <CODE>msgattrib</CODE> Program</A></H2>
2070 <A NAME="IDX828"></A>
2071 <A NAME="IDX829"></A>
2073 <PRE>
2074 msgattrib [<VAR>option</VAR>] [<VAR>inputfile</VAR>]
2075 </PRE>
2078 <A NAME="IDX830"></A>
2079 <A NAME="IDX831"></A>
2080 The <CODE>msgattrib</CODE> program filters the messages of a translation catalog
2081 according to their attributes, and manipulates the attributes.
2083 </P>
2086 <H3><A NAME="SEC132" HREF="gettext_toc.html#TOC132">9.8.1 Input file location</A></H3>
2088 <DL COMPACT>
2090 <DT><SAMP>&lsquo;<VAR>inputfile</VAR>&rsquo;</SAMP>
2091 <DD>
2092 Input PO file.
2094 <DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
2095 <DD>
2096 <DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
2097 <DD>
2098 <A NAME="IDX832"></A>
2099 <A NAME="IDX833"></A>
2100 Add <VAR>directory</VAR> to the list of directories. Source files are
2101 searched relative to this list of directories. The resulting <TT>&lsquo;.po&rsquo;</TT>
2102 file will be written relative to the current directory, though.
2104 </DL>
2107 If no <VAR>inputfile</VAR> is given or if it is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
2109 </P>
2112 <H3><A NAME="SEC133" HREF="gettext_toc.html#TOC133">9.8.2 Output file location</A></H3>
2114 <DL COMPACT>
2116 <DT><SAMP>&lsquo;-o <VAR>file</VAR>&rsquo;</SAMP>
2117 <DD>
2118 <DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
2119 <DD>
2120 <A NAME="IDX834"></A>
2121 <A NAME="IDX835"></A>
2122 Write output to specified file.
2124 </DL>
2127 The results are written to standard output if no output file is specified
2128 or if it is <SAMP>&lsquo;-&rsquo;</SAMP>.
2130 </P>
2133 <H3><A NAME="SEC134" HREF="gettext_toc.html#TOC134">9.8.3 Message selection</A></H3>
2135 <DL COMPACT>
2137 <DT><SAMP>&lsquo;--translated&rsquo;</SAMP>
2138 <DD>
2139 <A NAME="IDX836"></A>
2140 Keep translated messages, remove untranslated messages.
2142 <DT><SAMP>&lsquo;--untranslated&rsquo;</SAMP>
2143 <DD>
2144 <A NAME="IDX837"></A>
2145 Keep untranslated messages, remove translated messages.
2147 <DT><SAMP>&lsquo;--no-fuzzy&rsquo;</SAMP>
2148 <DD>
2149 <A NAME="IDX838"></A>
2150 Remove
2151 ‘fuzzy’
2152 marked messages.
2154 <DT><SAMP>&lsquo;--only-fuzzy&rsquo;</SAMP>
2155 <DD>
2156 <A NAME="IDX839"></A>
2157 Keep
2158 ‘fuzzy’
2159 marked messages, remove all other messages.
2161 <DT><SAMP>&lsquo;--no-obsolete&rsquo;</SAMP>
2162 <DD>
2163 <A NAME="IDX840"></A>
2164 Remove obsolete #~ messages.
2166 <DT><SAMP>&lsquo;--only-obsolete&rsquo;</SAMP>
2167 <DD>
2168 <A NAME="IDX841"></A>
2169 Keep obsolete #~ messages, remove all other messages.
2171 </DL>
2175 <H3><A NAME="SEC135" HREF="gettext_toc.html#TOC135">9.8.4 Attribute manipulation</A></H3>
2178 <A NAME="IDX842"></A>
2179 Attributes are modified after the message selection/removal has been
2180 performed. If the <SAMP>&lsquo;--only-file&rsquo;</SAMP> or <SAMP>&lsquo;--ignore-file&rsquo;</SAMP> option is
2181 specified, the attribute modification is applied only to those messages
2182 that are listed in the <VAR>only-file</VAR> and not listed in the
2183 <VAR>ignore-file</VAR>.
2185 </P>
2186 <DL COMPACT>
2188 <DT><SAMP>&lsquo;--set-fuzzy&rsquo;</SAMP>
2189 <DD>
2190 <A NAME="IDX843"></A>
2191 Set all messages
2192 ‘fuzzy’.
2194 <DT><SAMP>&lsquo;--clear-fuzzy&rsquo;</SAMP>
2195 <DD>
2196 <A NAME="IDX844"></A>
2197 Set all messages
2198 non-‘fuzzy’.
2200 <DT><SAMP>&lsquo;--set-obsolete&rsquo;</SAMP>
2201 <DD>
2202 <A NAME="IDX845"></A>
2203 Set all messages obsolete.
2205 <DT><SAMP>&lsquo;--clear-obsolete&rsquo;</SAMP>
2206 <DD>
2207 <A NAME="IDX846"></A>
2208 Set all messages non-obsolete.
2210 <DT><SAMP>&lsquo;--clear-previous&rsquo;</SAMP>
2211 <DD>
2212 <A NAME="IDX847"></A>
2213 Remove the “previous msgid” (<SAMP>&lsquo;#|&rsquo;</SAMP>) comments from all messages.
2215 <DT><SAMP>&lsquo;--only-file=<VAR>file</VAR>&rsquo;</SAMP>
2216 <DD>
2217 <A NAME="IDX848"></A>
2218 Limit the attribute changes to entries that are listed in <VAR>file</VAR>.
2219 <VAR>file</VAR> should be a PO or POT file.
2221 <DT><SAMP>&lsquo;--ignore-file=<VAR>file</VAR>&rsquo;</SAMP>
2222 <DD>
2223 <A NAME="IDX849"></A>
2224 Limit the attribute changes to entries that are not listed in <VAR>file</VAR>.
2225 <VAR>file</VAR> should be a PO or POT file.
2227 <DT><SAMP>&lsquo;--fuzzy&rsquo;</SAMP>
2228 <DD>
2229 <A NAME="IDX850"></A>
2230 Synonym for <SAMP>&lsquo;--only-fuzzy --clear-fuzzy&rsquo;</SAMP>: It keeps only the fuzzy
2231 messages and removes their
2232 ‘fuzzy’
2233 mark.
2235 <DT><SAMP>&lsquo;--obsolete&rsquo;</SAMP>
2236 <DD>
2237 <A NAME="IDX851"></A>
2238 Synonym for <SAMP>&lsquo;--only-obsolete --clear-obsolete&rsquo;</SAMP>: It keeps only the
2239 obsolete messages and makes them non-obsolete.
2241 </DL>
2245 <H3><A NAME="SEC136" HREF="gettext_toc.html#TOC136">9.8.5 Input file syntax</A></H3>
2247 <DL COMPACT>
2249 <DT><SAMP>&lsquo;-P&rsquo;</SAMP>
2250 <DD>
2251 <DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
2252 <DD>
2253 <A NAME="IDX852"></A>
2254 <A NAME="IDX853"></A>
2255 Assume the input file is a Java ResourceBundle in Java <CODE>.properties</CODE>
2256 syntax, not in PO file syntax.
2258 <DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
2259 <DD>
2260 <A NAME="IDX854"></A>
2261 Assume the input file is a NeXTstep/GNUstep localized resource file in
2262 <CODE>.strings</CODE> syntax, not in PO file syntax.
2264 </DL>
2268 <H3><A NAME="SEC137" HREF="gettext_toc.html#TOC137">9.8.6 Output details</A></H3>
2270 <DL COMPACT>
2272 <DT><SAMP>&lsquo;--color&rsquo;</SAMP>
2273 <DD>
2274 <DT><SAMP>&lsquo;--color=<VAR>when</VAR>&rsquo;</SAMP>
2275 <DD>
2276 <A NAME="IDX855"></A>
2277 Specify whether or when to use colors and other text attributes.
2278 See section <A HREF="gettext_9.html#SEC150">9.11.1 The <CODE>--color</CODE> option</A> for details.
2280 <DT><SAMP>&lsquo;--style=<VAR>style_file</VAR>&rsquo;</SAMP>
2281 <DD>
2282 <A NAME="IDX856"></A>
2283 Specify the CSS style rule file to use for <CODE>--color</CODE>.
2284 See section <A HREF="gettext_9.html#SEC152">9.11.3 The <CODE>--style</CODE> option</A> for details.
2286 <DT><SAMP>&lsquo;--force-po&rsquo;</SAMP>
2287 <DD>
2288 <A NAME="IDX857"></A>
2289 Always write an output file even if it contains no message.
2291 <DT><SAMP>&lsquo;-i&rsquo;</SAMP>
2292 <DD>
2293 <DT><SAMP>&lsquo;--indent&rsquo;</SAMP>
2294 <DD>
2295 <A NAME="IDX858"></A>
2296 <A NAME="IDX859"></A>
2297 Write the .po file using indented style.
2299 <DT><SAMP>&lsquo;--no-location&rsquo;</SAMP>
2300 <DD>
2301 <A NAME="IDX860"></A>
2302 Do not write <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines.
2304 <DT><SAMP>&lsquo;-n&rsquo;</SAMP>
2305 <DD>
2306 <DT><SAMP>&lsquo;--add-location&rsquo;</SAMP>
2307 <DD>
2308 <A NAME="IDX861"></A>
2309 <A NAME="IDX862"></A>
2310 Generate <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines (default).
2312 <DT><SAMP>&lsquo;--strict&rsquo;</SAMP>
2313 <DD>
2314 <A NAME="IDX863"></A>
2315 Write out a strict Uniforum conforming PO file. Note that this
2316 Uniforum format should be avoided because it doesn't support the
2317 GNU extensions.
2319 <DT><SAMP>&lsquo;-p&rsquo;</SAMP>
2320 <DD>
2321 <DT><SAMP>&lsquo;--properties-output&rsquo;</SAMP>
2322 <DD>
2323 <A NAME="IDX864"></A>
2324 <A NAME="IDX865"></A>
2325 Write out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax. Note
2326 that this file format doesn't support plural forms and silently drops
2327 obsolete messages.
2329 <DT><SAMP>&lsquo;--stringtable-output&rsquo;</SAMP>
2330 <DD>
2331 <A NAME="IDX866"></A>
2332 Write out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
2333 Note that this file format doesn't support plural forms.
2335 <DT><SAMP>&lsquo;-w <VAR>number</VAR>&rsquo;</SAMP>
2336 <DD>
2337 <DT><SAMP>&lsquo;--width=<VAR>number</VAR>&rsquo;</SAMP>
2338 <DD>
2339 <A NAME="IDX867"></A>
2340 <A NAME="IDX868"></A>
2341 Set the output page width. Long strings in the output files will be
2342 split across multiple lines in order to ensure that each line's width
2343 (= number of screen columns) is less or equal to the given <VAR>number</VAR>.
2345 <DT><SAMP>&lsquo;--no-wrap&rsquo;</SAMP>
2346 <DD>
2347 <A NAME="IDX869"></A>
2348 Do not break long message lines. Message lines whose width exceeds the
2349 output page width will not be split into several lines. Only file reference
2350 lines which are wider than the output page width will be split.
2352 <DT><SAMP>&lsquo;-s&rsquo;</SAMP>
2353 <DD>
2354 <DT><SAMP>&lsquo;--sort-output&rsquo;</SAMP>
2355 <DD>
2356 <A NAME="IDX870"></A>
2357 <A NAME="IDX871"></A>
2358 Generate sorted output. Note that using this option makes it much harder
2359 for the translator to understand each message's context.
2361 <DT><SAMP>&lsquo;-F&rsquo;</SAMP>
2362 <DD>
2363 <DT><SAMP>&lsquo;--sort-by-file&rsquo;</SAMP>
2364 <DD>
2365 <A NAME="IDX872"></A>
2366 <A NAME="IDX873"></A>
2367 Sort output by file location.
2369 </DL>
2373 <H3><A NAME="SEC138" HREF="gettext_toc.html#TOC138">9.8.7 Informative output</A></H3>
2375 <DL COMPACT>
2377 <DT><SAMP>&lsquo;-h&rsquo;</SAMP>
2378 <DD>
2379 <DT><SAMP>&lsquo;--help&rsquo;</SAMP>
2380 <DD>
2381 <A NAME="IDX874"></A>
2382 <A NAME="IDX875"></A>
2383 Display this help and exit.
2385 <DT><SAMP>&lsquo;-V&rsquo;</SAMP>
2386 <DD>
2387 <DT><SAMP>&lsquo;--version&rsquo;</SAMP>
2388 <DD>
2389 <A NAME="IDX876"></A>
2390 <A NAME="IDX877"></A>
2391 Output version information and exit.
2393 </DL>
2397 <H2><A NAME="SEC139" HREF="gettext_toc.html#TOC139">9.9 Invoking the <CODE>msgen</CODE> Program</A></H2>
2400 <A NAME="IDX878"></A>
2401 <A NAME="IDX879"></A>
2403 <PRE>
2404 msgen [<VAR>option</VAR>] <VAR>inputfile</VAR>
2405 </PRE>
2408 <A NAME="IDX880"></A>
2409 The <CODE>msgen</CODE> program creates an English translation catalog. The
2410 input file is the last created English PO file, or a PO Template file
2411 (generally created by xgettext). Untranslated entries are assigned a
2412 translation that is identical to the msgid.
2414 </P>
2416 Note: <SAMP>&lsquo;msginit --no-translator --locale=en&rsquo;</SAMP> performs a very similar
2417 task. The main difference is that <CODE>msginit</CODE> cares specially about
2418 the header entry, whereas <CODE>msgen</CODE> doesn't.
2420 </P>
2423 <H3><A NAME="SEC140" HREF="gettext_toc.html#TOC140">9.9.1 Input file location</A></H3>
2425 <DL COMPACT>
2427 <DT><SAMP>&lsquo;<VAR>inputfile</VAR>&rsquo;</SAMP>
2428 <DD>
2429 Input PO or POT file.
2431 <DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
2432 <DD>
2433 <DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
2434 <DD>
2435 <A NAME="IDX881"></A>
2436 <A NAME="IDX882"></A>
2437 Add <VAR>directory</VAR> to the list of directories. Source files are
2438 searched relative to this list of directories. The resulting <TT>&lsquo;.po&rsquo;</TT>
2439 file will be written relative to the current directory, though.
2441 </DL>
2444 If <VAR>inputfile</VAR> is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
2446 </P>
2449 <H3><A NAME="SEC141" HREF="gettext_toc.html#TOC141">9.9.2 Output file location</A></H3>
2451 <DL COMPACT>
2453 <DT><SAMP>&lsquo;-o <VAR>file</VAR>&rsquo;</SAMP>
2454 <DD>
2455 <DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
2456 <DD>
2457 <A NAME="IDX883"></A>
2458 <A NAME="IDX884"></A>
2459 Write output to specified file.
2461 </DL>
2464 The results are written to standard output if no output file is specified
2465 or if it is <SAMP>&lsquo;-&rsquo;</SAMP>.
2467 </P>
2470 <H3><A NAME="SEC142" HREF="gettext_toc.html#TOC142">9.9.3 Input file syntax</A></H3>
2472 <DL COMPACT>
2474 <DT><SAMP>&lsquo;-P&rsquo;</SAMP>
2475 <DD>
2476 <DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
2477 <DD>
2478 <A NAME="IDX885"></A>
2479 <A NAME="IDX886"></A>
2480 Assume the input file is a Java ResourceBundle in Java <CODE>.properties</CODE>
2481 syntax, not in PO file syntax.
2483 <DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
2484 <DD>
2485 <A NAME="IDX887"></A>
2486 Assume the input file is a NeXTstep/GNUstep localized resource file in
2487 <CODE>.strings</CODE> syntax, not in PO file syntax.
2489 </DL>
2493 <H3><A NAME="SEC143" HREF="gettext_toc.html#TOC143">9.9.4 Output details</A></H3>
2495 <DL COMPACT>
2497 <DT><SAMP>&lsquo;--lang=<VAR>catalogname</VAR>&rsquo;</SAMP>
2498 <DD>
2499 <A NAME="IDX888"></A>
2500 Specify the <SAMP>&lsquo;Language&rsquo;</SAMP> field to be used in the header entry. See
2501 section <A HREF="gettext_6.html#SEC44">6.2 Filling in the Header Entry</A> for the meaning of this field. Note: The
2502 <SAMP>&lsquo;Language-Team&rsquo;</SAMP> and <SAMP>&lsquo;Plural-Forms&rsquo;</SAMP> fields are not set by this
2503 option.
2505 <DT><SAMP>&lsquo;--color&rsquo;</SAMP>
2506 <DD>
2507 <DT><SAMP>&lsquo;--color=<VAR>when</VAR>&rsquo;</SAMP>
2508 <DD>
2509 <A NAME="IDX889"></A>
2510 Specify whether or when to use colors and other text attributes.
2511 See section <A HREF="gettext_9.html#SEC150">9.11.1 The <CODE>--color</CODE> option</A> for details.
2513 <DT><SAMP>&lsquo;--style=<VAR>style_file</VAR>&rsquo;</SAMP>
2514 <DD>
2515 <A NAME="IDX890"></A>
2516 Specify the CSS style rule file to use for <CODE>--color</CODE>.
2517 See section <A HREF="gettext_9.html#SEC152">9.11.3 The <CODE>--style</CODE> option</A> for details.
2519 <DT><SAMP>&lsquo;--force-po&rsquo;</SAMP>
2520 <DD>
2521 <A NAME="IDX891"></A>
2522 Always write an output file even if it contains no message.
2524 <DT><SAMP>&lsquo;-i&rsquo;</SAMP>
2525 <DD>
2526 <DT><SAMP>&lsquo;--indent&rsquo;</SAMP>
2527 <DD>
2528 <A NAME="IDX892"></A>
2529 <A NAME="IDX893"></A>
2530 Write the .po file using indented style.
2532 <DT><SAMP>&lsquo;--no-location&rsquo;</SAMP>
2533 <DD>
2534 <A NAME="IDX894"></A>
2535 Do not write <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines.
2537 <DT><SAMP>&lsquo;--add-location&rsquo;</SAMP>
2538 <DD>
2539 <A NAME="IDX895"></A>
2540 Generate <SAMP>&lsquo;#: <VAR>filename</VAR>:<VAR>line</VAR>&rsquo;</SAMP> lines (default).
2542 <DT><SAMP>&lsquo;--strict&rsquo;</SAMP>
2543 <DD>
2544 <A NAME="IDX896"></A>
2545 Write out a strict Uniforum conforming PO file. Note that this
2546 Uniforum format should be avoided because it doesn't support the
2547 GNU extensions.
2549 <DT><SAMP>&lsquo;-p&rsquo;</SAMP>
2550 <DD>
2551 <DT><SAMP>&lsquo;--properties-output&rsquo;</SAMP>
2552 <DD>
2553 <A NAME="IDX897"></A>
2554 <A NAME="IDX898"></A>
2555 Write out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax. Note
2556 that this file format doesn't support plural forms and silently drops
2557 obsolete messages.
2559 <DT><SAMP>&lsquo;--stringtable-output&rsquo;</SAMP>
2560 <DD>
2561 <A NAME="IDX899"></A>
2562 Write out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
2563 Note that this file format doesn't support plural forms.
2565 <DT><SAMP>&lsquo;-w <VAR>number</VAR>&rsquo;</SAMP>
2566 <DD>
2567 <DT><SAMP>&lsquo;--width=<VAR>number</VAR>&rsquo;</SAMP>
2568 <DD>
2569 <A NAME="IDX900"></A>
2570 <A NAME="IDX901"></A>
2571 Set the output page width. Long strings in the output files will be
2572 split across multiple lines in order to ensure that each line's width
2573 (= number of screen columns) is less or equal to the given <VAR>number</VAR>.
2575 <DT><SAMP>&lsquo;--no-wrap&rsquo;</SAMP>
2576 <DD>
2577 <A NAME="IDX902"></A>
2578 Do not break long message lines. Message lines whose width exceeds the
2579 output page width will not be split into several lines. Only file reference
2580 lines which are wider than the output page width will be split.
2582 <DT><SAMP>&lsquo;-s&rsquo;</SAMP>
2583 <DD>
2584 <DT><SAMP>&lsquo;--sort-output&rsquo;</SAMP>
2585 <DD>
2586 <A NAME="IDX903"></A>
2587 <A NAME="IDX904"></A>
2588 Generate sorted output. Note that using this option makes it much harder
2589 for the translator to understand each message's context.
2591 <DT><SAMP>&lsquo;-F&rsquo;</SAMP>
2592 <DD>
2593 <DT><SAMP>&lsquo;--sort-by-file&rsquo;</SAMP>
2594 <DD>
2595 <A NAME="IDX905"></A>
2596 <A NAME="IDX906"></A>
2597 Sort output by file location.
2599 </DL>
2603 <H3><A NAME="SEC144" HREF="gettext_toc.html#TOC144">9.9.5 Informative output</A></H3>
2605 <DL COMPACT>
2607 <DT><SAMP>&lsquo;-h&rsquo;</SAMP>
2608 <DD>
2609 <DT><SAMP>&lsquo;--help&rsquo;</SAMP>
2610 <DD>
2611 <A NAME="IDX907"></A>
2612 <A NAME="IDX908"></A>
2613 Display this help and exit.
2615 <DT><SAMP>&lsquo;-V&rsquo;</SAMP>
2616 <DD>
2617 <DT><SAMP>&lsquo;--version&rsquo;</SAMP>
2618 <DD>
2619 <A NAME="IDX909"></A>
2620 <A NAME="IDX910"></A>
2621 Output version information and exit.
2623 </DL>
2627 <H2><A NAME="SEC145" HREF="gettext_toc.html#TOC145">9.10 Invoking the <CODE>msgexec</CODE> Program</A></H2>
2630 <A NAME="IDX911"></A>
2631 <A NAME="IDX912"></A>
2633 <PRE>
2634 msgexec [<VAR>option</VAR>] <VAR>command</VAR> [<VAR>command-option</VAR>]
2635 </PRE>
2638 <A NAME="IDX913"></A>
2639 The <CODE>msgexec</CODE> program applies a command to all translations of a
2640 translation catalog.
2641 The <VAR>command</VAR> can be any program that reads a translation from standard
2642 input. It is invoked once for each translation. Its output becomes
2643 msgexec's output. <CODE>msgexec</CODE>'s return code is the maximum return code
2644 across all invocations.
2646 </P>
2648 <A NAME="IDX914"></A>
2649 A special builtin command called <SAMP>&lsquo;0&rsquo;</SAMP> outputs the translation, followed
2650 by a null byte. The output of <SAMP>&lsquo;msgexec 0&rsquo;</SAMP> is suitable as input for
2651 <SAMP>&lsquo;xargs -0&rsquo;</SAMP>.
2653 </P>
2655 <A NAME="IDX915"></A>
2656 <A NAME="IDX916"></A>
2657 <A NAME="IDX917"></A>
2658 During each <VAR>command</VAR> invocation, the environment variable
2659 <CODE>MSGEXEC_MSGID</CODE> is bound to the message's msgid, and the environment
2660 variable <CODE>MSGEXEC_LOCATION</CODE> is bound to the location in the PO file
2661 of the message. If the message has a context, the environment variable
2662 <CODE>MSGEXEC_MSGCTXT</CODE> is bound to the message's msgctxt, otherwise it is
2663 unbound.
2665 </P>
2667 <A NAME="IDX918"></A>
2668 Note: It is your responsibility to ensure that the <VAR>command</VAR> can cope
2669 with input encoded in the translation catalog's encoding. If the
2670 <VAR>command</VAR> wants input in a particular encoding, you can in a first step
2671 convert the translation catalog to that encoding using the <SAMP>&lsquo;msgconv&rsquo;</SAMP>
2672 program, before invoking <SAMP>&lsquo;msgexec&rsquo;</SAMP>. If the <VAR>command</VAR> wants input
2673 in the locale's encoding, but you want to avoid the locale's encoding, then
2674 you can first convert the translation catalog to UTF-8 using the
2675 <SAMP>&lsquo;msgconv&rsquo;</SAMP> program and then make <SAMP>&lsquo;msgexec&rsquo;</SAMP> work in an UTF-8
2676 locale, by using the <CODE>LC_ALL</CODE> environment variable.
2678 </P>
2681 <H3><A NAME="SEC146" HREF="gettext_toc.html#TOC146">9.10.1 Input file location</A></H3>
2683 <DL COMPACT>
2685 <DT><SAMP>&lsquo;-i <VAR>inputfile</VAR>&rsquo;</SAMP>
2686 <DD>
2687 <DT><SAMP>&lsquo;--input=<VAR>inputfile</VAR>&rsquo;</SAMP>
2688 <DD>
2689 <A NAME="IDX919"></A>
2690 <A NAME="IDX920"></A>
2691 Input PO file.
2693 <DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
2694 <DD>
2695 <DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
2696 <DD>
2697 <A NAME="IDX921"></A>
2698 <A NAME="IDX922"></A>
2699 Add <VAR>directory</VAR> to the list of directories. Source files are
2700 searched relative to this list of directories. The resulting <TT>&lsquo;.po&rsquo;</TT>
2701 file will be written relative to the current directory, though.
2703 </DL>
2706 If no <VAR>inputfile</VAR> is given or if it is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
2708 </P>
2711 <H3><A NAME="SEC147" HREF="gettext_toc.html#TOC147">9.10.2 Input file syntax</A></H3>
2713 <DL COMPACT>
2715 <DT><SAMP>&lsquo;-P&rsquo;</SAMP>
2716 <DD>
2717 <DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
2718 <DD>
2719 <A NAME="IDX923"></A>
2720 <A NAME="IDX924"></A>
2721 Assume the input file is a Java ResourceBundle in Java <CODE>.properties</CODE>
2722 syntax, not in PO file syntax.
2724 <DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
2725 <DD>
2726 <A NAME="IDX925"></A>
2727 Assume the input file is a NeXTstep/GNUstep localized resource file in
2728 <CODE>.strings</CODE> syntax, not in PO file syntax.
2730 </DL>
2734 <H3><A NAME="SEC148" HREF="gettext_toc.html#TOC148">9.10.3 Informative output</A></H3>
2736 <DL COMPACT>
2738 <DT><SAMP>&lsquo;-h&rsquo;</SAMP>
2739 <DD>
2740 <DT><SAMP>&lsquo;--help&rsquo;</SAMP>
2741 <DD>
2742 <A NAME="IDX926"></A>
2743 <A NAME="IDX927"></A>
2744 Display this help and exit.
2746 <DT><SAMP>&lsquo;-V&rsquo;</SAMP>
2747 <DD>
2748 <DT><SAMP>&lsquo;--version&rsquo;</SAMP>
2749 <DD>
2750 <A NAME="IDX928"></A>
2751 <A NAME="IDX929"></A>
2752 Output version information and exit.
2754 </DL>
2758 <H2><A NAME="SEC149" HREF="gettext_toc.html#TOC149">9.11 Highlighting parts of PO files</A></H2>
2761 Translators are usually only interested in seeing the untranslated and
2762 fuzzy messages of a PO file. Also, when a message is set fuzzy because
2763 the msgid changed, they want to see the differences between the previous
2764 msgid and the current one (especially if the msgid is long and only few
2765 words in it have changed). Finally, it's always welcome to highlight the
2766 different sections of a message in a PO file (comments, msgid, msgstr, etc.).
2768 </P>
2770 Such highlighting is possible through the <CODE>msgcat</CODE> options
2771 <SAMP>&lsquo;--color&rsquo;</SAMP> and <SAMP>&lsquo;--style&rsquo;</SAMP>.
2773 </P>
2777 <H3><A NAME="SEC150" HREF="gettext_toc.html#TOC150">9.11.1 The <CODE>--color</CODE> option</A></H3>
2780 <A NAME="IDX930"></A>
2781 The <SAMP>&lsquo;--color=<VAR>when</VAR>&rsquo;</SAMP> option specifies under which conditions
2782 colorized output should be generated. The <VAR>when</VAR> part can be one of
2783 the following:
2785 </P>
2786 <DL COMPACT>
2788 <DT><CODE>always</CODE>
2789 <DD>
2790 <DT><CODE>yes</CODE>
2791 <DD>
2792 The output will be colorized.
2794 <DT><CODE>never</CODE>
2795 <DD>
2796 <DT><CODE>no</CODE>
2797 <DD>
2798 The output will not be colorized.
2800 <DT><CODE>auto</CODE>
2801 <DD>
2802 <DT><CODE>tty</CODE>
2803 <DD>
2804 The output will be colorized if the output device is a tty, i.e. when the
2805 output goes directly to a text screen or terminal emulator window.
2807 <DT><CODE>html</CODE>
2808 <DD>
2809 The output will be colorized and be in HTML format.
2810 </DL>
2813 <SAMP>&lsquo;--color&rsquo;</SAMP> is equivalent to <SAMP>&lsquo;--color=yes&rsquo;</SAMP>. The default is
2814 <SAMP>&lsquo;--color=auto&rsquo;</SAMP>.
2816 </P>
2818 Thus, a command like <SAMP>&lsquo;msgcat vi.po&rsquo;</SAMP> will produce colorized output
2819 when called by itself in a command window. Whereas in a pipe, such as
2820 <SAMP>&lsquo;msgcat vi.po | less -R&rsquo;</SAMP>, it will not produce colorized output. To
2821 get colorized output in this situation nevertheless, use the command
2822 <SAMP>&lsquo;msgcat --color vi.po | less -R&rsquo;</SAMP>.
2824 </P>
2826 The <SAMP>&lsquo;--color=html&rsquo;</SAMP> option will produce output that can be viewed in
2827 a browser. This can be useful, for example, for Indic languages,
2828 because the renderic of Indic scripts in browser is usually better than
2829 in terminal emulators.
2831 </P>
2833 Note that the output produced with the <CODE>--color</CODE> option is <EM>not</EM>
2834 a valid PO file in itself. It contains additional terminal-specific escape
2835 sequences or HTML tags. A PO file reader will give a syntax error when
2836 confronted with such content. Except for the <SAMP>&lsquo;--color=html&rsquo;</SAMP> case,
2837 you therefore normally don't need to save output produced with the
2838 <CODE>--color</CODE> option in a file.
2840 </P>
2843 <H3><A NAME="SEC151" HREF="gettext_toc.html#TOC151">9.11.2 The environment variable <CODE>TERM</CODE></A></H3>
2846 <A NAME="IDX931"></A>
2847 The environment variable <CODE>TERM</CODE> contains a identifier for the text
2848 window's capabilities. You can get a detailed list of these cababilities
2849 by using the <SAMP>&lsquo;infocmp&rsquo;</SAMP> command, using <SAMP>&lsquo;man 5 terminfo&rsquo;</SAMP> as a
2850 reference.
2852 </P>
2854 When producing text with embedded color directives, <CODE>msgcat</CODE> looks
2855 at the <CODE>TERM</CODE> variable. Text windows today typically support at least
2856 8 colors. Often, however, the text window supports 16 or more colors,
2857 even though the <CODE>TERM</CODE> variable is set to a identifier denoting only
2858 8 supported colors. It can be worth setting the <CODE>TERM</CODE> variable to
2859 a different value in these cases:
2861 </P>
2862 <DL COMPACT>
2864 <DT><CODE>xterm</CODE>
2865 <DD>
2866 <CODE>xterm</CODE> is in most cases built with support for 16 colors. It can also
2867 be built with support for 88 or 256 colors (but not both). You can try to
2868 set <CODE>TERM</CODE> to either <CODE>xterm-16color</CODE>, <CODE>xterm-88color</CODE>, or
2869 <CODE>xterm-256color</CODE>.
2871 <DT><CODE>rxvt</CODE>
2872 <DD>
2873 <CODE>rxvt</CODE> is often built with support for 16 colors. You can try to set
2874 <CODE>TERM</CODE> to <CODE>rxvt-16color</CODE>.
2876 <DT><CODE>konsole</CODE>
2877 <DD>
2878 <CODE>konsole</CODE> too is often built with support for 16 colors. You can try to
2879 set <CODE>TERM</CODE> to <CODE>konsole-16color</CODE> or <CODE>xterm-16color</CODE>.
2880 </DL>
2883 After setting <CODE>TERM</CODE>, you can verify it by invoking
2884 <SAMP>&lsquo;msgcat --color=test&rsquo;</SAMP> and seeing whether the output looks like a
2885 reasonable color map.
2887 </P>
2890 <H3><A NAME="SEC152" HREF="gettext_toc.html#TOC152">9.11.3 The <CODE>--style</CODE> option</A></H3>
2893 <A NAME="IDX932"></A>
2894 The <SAMP>&lsquo;--style=<VAR>style_file</VAR>&rsquo;</SAMP> option specifies the style file to use
2895 when colorizing. It has an effect only when the <CODE>--color</CODE> option is
2896 effective.
2898 </P>
2900 <A NAME="IDX933"></A>
2901 If the <CODE>--style</CODE> option is not specified, the environment variable
2902 <CODE>PO_STYLE</CODE> is considered. It is meant to point to the user's
2903 preferred style for PO files.
2905 </P>
2907 The default style file is <TT>&lsquo;$prefix/share/gettext/styles/po-default.css&rsquo;</TT>,
2908 where <CODE>$prefix</CODE> is the installation location.
2910 </P>
2912 A few style files are predefined:
2913 <DL COMPACT>
2915 <DT><TT>&lsquo;po-vim.css&rsquo;</TT>
2916 <DD>
2917 This style imitates the look used by vim 7.
2919 <DT><TT>&lsquo;po-emacs-x.css&rsquo;</TT>
2920 <DD>
2921 This style imitates the look used by GNU Emacs 21 and 22 in an X11 window.
2923 <DT><TT>&lsquo;po-emacs-xterm.css&rsquo;</TT>
2924 <DD>
2925 <DT><TT>&lsquo;po-emacs-xterm16.css&rsquo;</TT>
2926 <DD>
2927 <DT><TT>&lsquo;po-emacs-xterm256.css&rsquo;</TT>
2928 <DD>
2929 This style imitates the look used by GNU Emacs 22 in a terminal of type
2930 <SAMP>&lsquo;xterm&rsquo;</SAMP> (8 colors) or <SAMP>&lsquo;xterm-16color&rsquo;</SAMP> (16 colors) or
2931 <SAMP>&lsquo;xterm-256color&rsquo;</SAMP> (256 colors), respectively.
2932 </DL>
2935 You can use these styles without specifying a directory. They are actually
2936 located in <TT>&lsquo;$prefix/share/gettext/styles/&rsquo;</TT>, where <CODE>$prefix</CODE> is the
2937 installation location.
2939 </P>
2941 You can also design your own styles. This is described in the next section.
2943 </P>
2947 <H3><A NAME="SEC153" HREF="gettext_toc.html#TOC153">9.11.4 Style rules for PO files</A></H3>
2950 The same style file can be used for styling of a PO file, for terminal
2951 output and for HTML output. It is written in CSS (Cascading Style Sheet)
2952 syntax. See <A HREF="http://www.w3.org/TR/css2/cover.html">http://www.w3.org/TR/css2/cover.html</A> for a formal
2953 definition of CSS. Many HTML authoring tutorials also contain explanations
2954 of CSS.
2956 </P>
2958 In the case of HTML output, the style file is embedded in the HTML output.
2959 In the case of text output, the style file is interpreted by the
2960 <CODE>msgcat</CODE> program. This means, in particular, that when
2961 <CODE>@import</CODE> is used with relative file names, the file names are
2963 </P>
2965 <UL>
2966 <LI>
2968 relative to the resulting HTML file, in the case of HTML output,
2970 <LI>
2972 relative to the style sheet containing the <CODE>@import</CODE>, in the case of
2973 text output. (Actually, <CODE>@import</CODE>s are not yet supported in this case,
2974 due to a limitation in <CODE>libcroco</CODE>.)
2975 </UL>
2978 CSS rules are built up from selectors and declarations. The declarations
2979 specify graphical properties; the selectors specify specify when they apply.
2981 </P>
2983 In PO files, the following simple selectors (based on "CSS classes", see
2984 the CSS2 spec, section 5.8.3) are supported.
2986 </P>
2988 <UL>
2989 <LI>
2991 Selectors that apply to entire messages:
2993 <DL COMPACT>
2995 <DT><CODE>.header</CODE>
2996 <DD>
2997 This matches the header entry of a PO file.
2999 <DT><CODE>.translated</CODE>
3000 <DD>
3001 This matches a translated message.
3003 <DT><CODE>.untranslated</CODE>
3004 <DD>
3005 This matches an untranslated message (i.e. a message with empty translation).
3007 <DT><CODE>.fuzzy</CODE>
3008 <DD>
3009 This matches a fuzzy message (i.e. a message which has a translation that
3010 needs review by the translator).
3012 <DT><CODE>.obsolete</CODE>
3013 <DD>
3014 This matches an obsolete message (i.e. a message that was translated but is
3015 not needed by the current POT file any more).
3016 </DL>
3018 <LI>
3020 Selectors that apply to parts of a message in PO syntax. Recall the general
3021 structure of a message in PO syntax:
3024 <PRE>
3025 <VAR>white-space</VAR>
3026 # <VAR>translator-comments</VAR>
3027 #. <VAR>extracted-comments</VAR>
3028 #: <VAR>reference</VAR>...
3029 #, <VAR>flag</VAR>...
3030 #| msgid <VAR>previous-untranslated-string</VAR>
3031 msgid <VAR>untranslated-string</VAR>
3032 msgstr <VAR>translated-string</VAR>
3033 </PRE>
3035 <DL COMPACT>
3037 <DT><CODE>.comment</CODE>
3038 <DD>
3039 This matches all comments (translator comments, extracted comments,
3040 source file reference comments, flag comments, previous message comments,
3041 as well as the entire obsolete messages).
3043 <DT><CODE>.translator-comment</CODE>
3044 <DD>
3045 This matches the translator comments.
3047 <DT><CODE>.extracted-comment</CODE>
3048 <DD>
3049 This matches the extracted comments, i.e. the comments placed by the
3050 programmer at the attention of the translator.
3052 <DT><CODE>.reference-comment</CODE>
3053 <DD>
3054 This matches the source file reference comments (entire lines).
3056 <DT><CODE>.reference</CODE>
3057 <DD>
3058 This matches the individual source file references inside the source file
3059 reference comment lines.
3061 <DT><CODE>.flag-comment</CODE>
3062 <DD>
3063 This matches the flag comment lines (entire lines).
3065 <DT><CODE>.flag</CODE>
3066 <DD>
3067 This matches the individual flags inside flag comment lines.
3069 <DT><CODE>.fuzzy-flag</CODE>
3070 <DD>
3071 This matches the `fuzzy' flag inside flag comment lines.
3073 <DT><CODE>.previous-comment</CODE>
3074 <DD>
3075 This matches the comments containing the previous untranslated string (entire
3076 lines).
3078 <DT><CODE>.previous</CODE>
3079 <DD>
3080 This matches the previous untranslated string including the string delimiters,
3081 the associated keywords (<CODE>msgid</CODE> etc.) and the spaces between them.
3083 <DT><CODE>.msgid</CODE>
3084 <DD>
3085 This matches the untranslated string including the string delimiters,
3086 the associated keywords (<CODE>msgid</CODE> etc.) and the spaces between them.
3088 <DT><CODE>.msgstr</CODE>
3089 <DD>
3090 This matches the translated string including the string delimiters,
3091 the associated keywords (<CODE>msgstr</CODE> etc.) and the spaces between them.
3093 <DT><CODE>.keyword</CODE>
3094 <DD>
3095 This matches the keywords (<CODE>msgid</CODE>, <CODE>msgstr</CODE>, etc.).
3097 <DT><CODE>.string</CODE>
3098 <DD>
3099 This matches strings, including the string delimiters (double quotes).
3100 </DL>
3102 <LI>
3104 Selectors that apply to parts of strings:
3106 <DL COMPACT>
3108 <DT><CODE>.text</CODE>
3109 <DD>
3110 This matches the entire contents of a string (excluding the string delimiters,
3111 i.e. the double quotes).
3113 <DT><CODE>.escape-sequence</CODE>
3114 <DD>
3115 This matches an escape sequence (starting with a backslash).
3117 <DT><CODE>.format-directive</CODE>
3118 <DD>
3119 This matches a format string directive (starting with a <SAMP>&lsquo;%&rsquo;</SAMP> sign in the
3120 case of most programming languages, with a <SAMP>&lsquo;{&rsquo;</SAMP> in the case of
3121 <CODE>java-format</CODE> and <CODE>csharp-format</CODE>, with a <SAMP>&lsquo;~&rsquo;</SAMP> in the case of
3122 <CODE>lisp-format</CODE> and <CODE>scheme-format</CODE>, or with <SAMP>&lsquo;$&rsquo;</SAMP> in the case of
3123 <CODE>sh-format</CODE>).
3125 <DT><CODE>.invalid-format-directive</CODE>
3126 <DD>
3127 This matches an invalid format string directive.
3129 <DT><CODE>.added</CODE>
3130 <DD>
3131 In an untranslated string, this matches a part of the string that was not
3132 present in the previous untranslated string. (Not yet implemented in this
3133 release.)
3135 <DT><CODE>.changed</CODE>
3136 <DD>
3137 In an untranslated string or in a previous untranslated string, this matches
3138 a part of the string that is changed or replaced. (Not yet implemented in
3139 this release.)
3141 <DT><CODE>.removed</CODE>
3142 <DD>
3143 In a previous untranslated string, this matches a part of the string that
3144 is not present in the current untranslated string. (Not yet implemented in
3145 this release.)
3146 </DL>
3147 </UL>
3150 These selectors can be combined to hierarchical selectors. For example,
3152 </P>
3154 <PRE>
3155 .msgstr .invalid-format-directive { color: red; }
3156 </PRE>
3159 will highlight the invalid format directives in the translated strings.
3161 </P>
3163 In text mode, pseudo-classes (CSS2 spec, section 5.11) and pseudo-elements
3164 (CSS2 spec, section 5.12) are not supported.
3166 </P>
3168 The declarations in HTML mode are not limited; any graphical attribute
3169 supported by the browsers can be used.
3171 </P>
3173 The declarations in text mode are limited to the following properties. Other
3174 properties will be silently ignored.
3176 </P>
3177 <DL COMPACT>
3179 <DT><CODE>color</CODE> (CSS2 spec, section 14.1)
3180 <DD>
3181 <DT><CODE>background-color</CODE> (CSS2 spec, section 14.2.1)
3182 <DD>
3183 These properties is supported. Colors will be adjusted to match the terminal's
3184 capabilities. Note that many terminals support only 8 colors.
3186 <DT><CODE>font-weight</CODE> (CSS2 spec, section 15.2.3)
3187 <DD>
3188 This property is supported, but most terminals can only render two different
3189 weights: <CODE>normal</CODE> and <CODE>bold</CODE>. Values &#62;= 600 are rendered as
3190 <CODE>bold</CODE>.
3192 <DT><CODE>font-style</CODE> (CSS2 spec, section 15.2.3)
3193 <DD>
3194 This property is supported. The values <CODE>italic</CODE> and <CODE>oblique</CODE> are
3195 rendered the same way.
3197 <DT><CODE>text-decoration</CODE> (CSS2 spec, section 16.3.1)
3198 <DD>
3199 This property is supported, limited to the values <CODE>none</CODE> and
3200 <CODE>underline</CODE>.
3201 </DL>
3205 <H3><A NAME="SEC154" HREF="gettext_toc.html#TOC154">9.11.5 Customizing <CODE>less</CODE> for viewing PO files</A></H3>
3208 The <SAMP>&lsquo;less&rsquo;</SAMP> program is a popular text file browser for use in a text
3209 screen or terminal emulator. It also supports text with embedded escape
3210 sequences for colors and text decorations.
3212 </P>
3214 You can use <CODE>less</CODE> to view a PO file like this (assuming an UTF-8
3215 environment):
3217 </P>
3219 <PRE>
3220 msgcat --to-code=UTF-8 --color xyz.po | less -R
3221 </PRE>
3224 You can simplify this to this simple command:
3226 </P>
3228 <PRE>
3229 less xyz.po
3230 </PRE>
3233 after these three preparations:
3235 </P>
3237 <OL>
3238 <LI>
3240 Add the options <SAMP>&lsquo;-R&rsquo;</SAMP> and <SAMP>&lsquo;-f&rsquo;</SAMP> to the <CODE>LESS</CODE> environment
3241 variable. In sh shells:
3243 <PRE>
3244 $ LESS="$LESS -R -f"
3245 $ export LESS
3246 </PRE>
3248 <LI>
3250 If your system does not already have the <TT>&lsquo;lessopen.sh&rsquo;</TT> and
3251 <TT>&lsquo;lessclose.sh&rsquo;</TT> scripts, create them and set the <CODE>LESSOPEN</CODE> and
3252 <CODE>LESSCLOSE</CODE> environment variables, as indicated in the manual page
3253 (<SAMP>&lsquo;man less&rsquo;</SAMP>).
3255 <LI>
3257 Add to <TT>&lsquo;lessopen.sh&rsquo;</TT> a piece of script that recognizes PO files
3258 through their file extension and invokes <CODE>msgcat</CODE> on them, producing
3259 a temporary file. Like this:
3262 <PRE>
3263 case "$1" in
3264 *.po)
3265 tmpfile=`mktemp "${TMPDIR-/tmp}/less.XXXXXX"`
3266 msgcat --to-code=UTF-8 --color "$1" &#62; "$tmpfile"
3267 echo "$tmpfile"
3268 exit 0
3270 esac
3271 </PRE>
3273 </OL>
3277 <H2><A NAME="SEC155" HREF="gettext_toc.html#TOC155">9.12 Writing your own programs that process PO files</A></H2>
3280 For the tasks for which a combination of <SAMP>&lsquo;msgattrib&rsquo;</SAMP>, <SAMP>&lsquo;msgcat&rsquo;</SAMP> etc.
3281 is not sufficient, a set of C functions is provided in a library, to make it
3282 possible to process PO files in your own programs. When you use this library,
3283 you don't need to write routines to parse the PO file; instead, you retrieve
3284 a pointer in memory to each of messages contained in the PO file. Functions
3285 for writing PO files are not provided at this time.
3287 </P>
3289 The functions are declared in the header file <SAMP>&lsquo;&#60;gettext-po.h&#62;&rsquo;</SAMP>, and are
3290 defined in a library called <SAMP>&lsquo;libgettextpo&rsquo;</SAMP>.
3292 </P>
3294 <DL>
3295 <DT><U>Data Type:</U> <B>po_file_t</B>
3296 <DD><A NAME="IDX934"></A>
3297 This is a pointer type that refers to the contents of a PO file, after it has
3298 been read into memory.
3299 </DL>
3301 </P>
3303 <DL>
3304 <DT><U>Data Type:</U> <B>po_message_iterator_t</B>
3305 <DD><A NAME="IDX935"></A>
3306 This is a pointer type that refers to an iterator that produces a sequence of
3307 messages.
3308 </DL>
3310 </P>
3312 <DL>
3313 <DT><U>Data Type:</U> <B>po_message_t</B>
3314 <DD><A NAME="IDX936"></A>
3315 This is a pointer type that refers to a message of a PO file, including its
3316 translation.
3317 </DL>
3319 </P>
3321 <DL>
3322 <DT><U>Function:</U> po_file_t <B>po_file_read</B> <I>(const char *<VAR>filename</VAR>)</I>
3323 <DD><A NAME="IDX937"></A>
3324 The <CODE>po_file_read</CODE> function reads a PO file into memory. The file name
3325 is given as argument. The return value is a handle to the PO file's contents,
3326 valid until <CODE>po_file_free</CODE> is called on it. In case of error, the return
3327 value is <CODE>NULL</CODE>, and <CODE>errno</CODE> is set.
3328 </DL>
3330 </P>
3332 <DL>
3333 <DT><U>Function:</U> void <B>po_file_free</B> <I>(po_file_t <VAR>file</VAR>)</I>
3334 <DD><A NAME="IDX938"></A>
3335 The <CODE>po_file_free</CODE> function frees a PO file's contents from memory,
3336 including all messages that are only implicitly accessible through iterators.
3337 </DL>
3339 </P>
3341 <DL>
3342 <DT><U>Function:</U> const char * const * <B>po_file_domains</B> <I>(po_file_t <VAR>file</VAR>)</I>
3343 <DD><A NAME="IDX939"></A>
3344 The <CODE>po_file_domains</CODE> function returns the domains for which the given
3345 PO file has messages. The return value is a <CODE>NULL</CODE> terminated array
3346 which is valid as long as the <VAR>file</VAR> handle is valid. For PO files which
3347 contain no <SAMP>&lsquo;domain&rsquo;</SAMP> directive, the return value contains only one domain,
3348 namely the default domain <CODE>"messages"</CODE>.
3349 </DL>
3351 </P>
3353 <DL>
3354 <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>
3355 <DD><A NAME="IDX940"></A>
3356 The <CODE>po_message_iterator</CODE> returns an iterator that will produce the
3357 messages of <VAR>file</VAR> that belong to the given <VAR>domain</VAR>. If <VAR>domain</VAR>
3358 is <CODE>NULL</CODE>, the default domain is used instead. To list the messages,
3359 use the function <CODE>po_next_message</CODE> repeatedly.
3360 </DL>
3362 </P>
3364 <DL>
3365 <DT><U>Function:</U> void <B>po_message_iterator_free</B> <I>(po_message_iterator_t <VAR>iterator</VAR>)</I>
3366 <DD><A NAME="IDX941"></A>
3367 The <CODE>po_message_iterator_free</CODE> function frees an iterator previously
3368 allocated through the <CODE>po_message_iterator</CODE> function.
3369 </DL>
3371 </P>
3373 <DL>
3374 <DT><U>Function:</U> po_message_t <B>po_next_message</B> <I>(po_message_iterator_t <VAR>iterator</VAR>)</I>
3375 <DD><A NAME="IDX942"></A>
3376 The <CODE>po_next_message</CODE> function returns the next message from
3377 <VAR>iterator</VAR> and advances the iterator. It returns <CODE>NULL</CODE> when the
3378 iterator has reached the end of its message list.
3379 </DL>
3381 </P>
3383 The following functions returns details of a <CODE>po_message_t</CODE>. Recall
3384 that the results are valid as long as the <VAR>file</VAR> handle is valid.
3386 </P>
3388 <DL>
3389 <DT><U>Function:</U> const char * <B>po_message_msgid</B> <I>(po_message_t <VAR>message</VAR>)</I>
3390 <DD><A NAME="IDX943"></A>
3391 The <CODE>po_message_msgid</CODE> function returns the <CODE>msgid</CODE> (untranslated
3392 English string) of a message. This is guaranteed to be non-<CODE>NULL</CODE>.
3393 </DL>
3395 </P>
3397 <DL>
3398 <DT><U>Function:</U> const char * <B>po_message_msgid_plural</B> <I>(po_message_t <VAR>message</VAR>)</I>
3399 <DD><A NAME="IDX944"></A>
3400 The <CODE>po_message_msgid_plural</CODE> function returns the <CODE>msgid_plural</CODE>
3401 (untranslated English plural string) of a message with plurals, or <CODE>NULL</CODE>
3402 for a message without plural.
3403 </DL>
3405 </P>
3407 <DL>
3408 <DT><U>Function:</U> const char * <B>po_message_msgstr</B> <I>(po_message_t <VAR>message</VAR>)</I>
3409 <DD><A NAME="IDX945"></A>
3410 The <CODE>po_message_msgstr</CODE> function returns the <CODE>msgstr</CODE> (translation)
3411 of a message. For an untranslated message, the return value is an empty
3412 string.
3413 </DL>
3415 </P>
3417 <DL>
3418 <DT><U>Function:</U> const char * <B>po_message_msgstr_plural</B> <I>(po_message_t <VAR>message</VAR>, int <VAR>index</VAR>)</I>
3419 <DD><A NAME="IDX946"></A>
3420 The <CODE>po_message_msgstr_plural</CODE> function returns the
3421 <CODE>msgstr[<VAR>index</VAR>]</CODE> of a message with plurals, or <CODE>NULL</CODE> when
3422 the <VAR>index</VAR> is out of range or for a message without plural.
3423 </DL>
3425 </P>
3427 Here is an example code how these functions can be used.
3429 </P>
3431 <PRE>
3432 const char *filename = ...;
3433 po_file_t file = po_file_read (filename);
3435 if (file == NULL)
3436 error (EXIT_FAILURE, errno, "couldn't open the PO file %s", filename);
3438 const char * const *domains = po_file_domains (file);
3439 const char * const *domainp;
3441 for (domainp = domains; *domainp; domainp++)
3443 const char *domain = *domainp;
3444 po_message_iterator_t iterator = po_message_iterator (file, domain);
3446 for (;;)
3448 po_message_t *message = po_next_message (iterator);
3450 if (message == NULL)
3451 break;
3453 const char *msgid = po_message_msgid (message);
3454 const char *msgstr = po_message_msgstr (message);
3459 po_message_iterator_free (iterator);
3462 po_file_free (file);
3463 </PRE>
3465 <P><HR><P>
3466 Go 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>.
3467 </BODY>
3468 </HTML>