| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> |
| <html> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <head> |
| <title>GNU gettext utilities: 9. Manipulating PO Files</title> |
|
|
| <meta name="description" content="GNU gettext utilities: 9. Manipulating PO Files"> |
| <meta name="keywords" content="GNU gettext utilities: 9. Manipulating PO Files"> |
| <meta name="resource-type" content="document"> |
| <meta name="distribution" content="global"> |
| <meta name="Generator" content="texi2html 1.78a"> |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| <style type="text/css"> |
| <!-- |
| a.summary-letter {text-decoration: none} |
| pre.display {font-family: serif} |
| pre.format {font-family: serif} |
| pre.menu-comment {font-family: serif} |
| pre.menu-preformatted {font-family: serif} |
| pre.smalldisplay {font-family: serif; font-size: smaller} |
| pre.smallexample {font-size: smaller} |
| pre.smallformat {font-family: serif; font-size: smaller} |
| pre.smalllisp {font-size: smaller} |
| span.roman {font-family:serif; font-weight:normal;} |
| span.sansserif {font-family:sans-serif; font-weight:normal;} |
| ul.toc {list-style: none} |
| --> |
| </style> |
|
|
|
|
| </head> |
|
|
| <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> |
|
|
| <table cellpadding="1" cellspacing="1" border="0"> |
| <tr><td valign="middle" align="left">[<a href="gettext_8.html#SEC71" title="Beginning of this chapter or previous chapter"> << </a>]</td> |
| <td valign="middle" align="left">[<a href="gettext_10.html#SEC188" title="Next chapter"> >> </a>]</td> |
| <td valign="middle" align="left"> </td> |
| <td valign="middle" align="left"> </td> |
| <td valign="middle" align="left"> </td> |
| <td valign="middle" align="left"> </td> |
| <td valign="middle" align="left"> </td> |
| <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Top" title="Cover (top) of document">Top</a>]</td> |
| <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td> |
| <td valign="middle" align="left">[<a href="gettext_21.html#SEC410" title="Index">Index</a>]</td> |
| <td valign="middle" align="left">[<a href="gettext_abt.html#SEC_About" title="About (help)"> ? </a>]</td> |
| </tr></table> |
|
|
| <hr size="2"> |
| <a name="Manipulating"></a> |
| <a name="SEC100"></a> |
| <h1 class="chapter"> <a href="gettext_toc.html#TOC96">9. Manipulating PO Files</a> </h1> |
|
|
| <p>Sometimes it is necessary to manipulate PO files in a way that is better |
| performed automatically than by hand. GNU <code>gettext</code> includes a |
| complete set of tools for this purpose. |
| </p> |
| <a name="IDX522"></a> |
| <a name="IDX523"></a> |
| <p>When merging two packages into a single package, the resulting POT file |
| will be the concatenation of the two packages' POT files. Thus the |
| maintainer must concatenate the two existing package translations into |
| a single translation catalog, for each language. This is best performed |
| using ‘<samp>msgcat</samp>’. It is then the translators' duty to deal with any |
| possible conflicts that arose during the merge. |
| </p> |
| <a name="IDX524"></a> |
| <p>When a translator takes over the translation job from another translator, |
| but she uses a different character encoding in her locale, she will |
| convert the catalog to her character encoding. This is best done through |
| the ‘<samp>msgconv</samp>’ program. |
| </p> |
| <p>When a maintainer takes a source file with tagged messages from another |
| package, he should also take the existing translations for this source |
| file (and not let the translators do the same job twice). One way to do |
| this is through ‘<samp>msggrep</samp>’, another is to create a POT file for |
| that source file and use ‘<samp>msgmerge</samp>’. |
| </p> |
| <a name="IDX525"></a> |
| <a name="IDX526"></a> |
| <p>When a translator wants to adjust some translation catalog for a special |
| dialect or orthography — for example, German as written in Switzerland |
| versus German as written in Germany — she needs to apply some text |
| processing to every message in the catalog. The tool for doing this is |
| ‘<samp>msgfilter</samp>’. |
| </p> |
| <p>Another use of <code>msgfilter</code> is to produce approximately the POT file for |
| which a given PO file was made. This can be done through a filter command |
| like ‘<samp>msgfilter sed -e d | sed -e '/^# /d'</samp>’. Note that the original |
| POT file may have had different comments and different plural message counts, |
| that's why it's better to use the original POT file if available. |
| </p> |
| <a name="IDX527"></a> |
| <p>When a translator wants to check her translations, for example according |
| to orthography rules or using a non-interactive spell checker, she can do |
| so using the ‘<samp>msgexec</samp>’ program. |
| </p> |
| <a name="IDX528"></a> |
| <p>When third party tools create PO or POT files, sometimes duplicates cannot |
| be avoided. But the GNU <code>gettext</code> tools give an error when they |
| encounter duplicate msgids in the same file and in the same domain. |
| To merge duplicates, the ‘<samp>msguniq</samp>’ program can be used. |
| </p> |
| <p>‘<samp>msgcomm</samp>’ is a more general tool for keeping or throwing away |
| duplicates, occurring in different files. |
| </p> |
| <p>‘<samp>msgcmp</samp>’ can be used to check whether a translation catalog is |
| completely translated. |
| </p> |
| <a name="IDX529"></a> |
| <p>‘<samp>msgattrib</samp>’ can be used to select and extract only the fuzzy |
| or untranslated messages of a translation catalog. |
| </p> |
| <p>‘<samp>msgen</samp>’ is useful as a first step for preparing English translation |
| catalogs. It copies each message's msgid to its msgstr. |
| </p> |
| <p>Finally, for those applications where all these various programs are not |
| sufficient, a library ‘<samp>libgettextpo</samp>’ is provided that can be used to |
| write other specialized programs that process PO files. |
| </p> |
|
|
|
|
| <a name="msgcat-Invocation"></a> |
| <a name="SEC101"></a> |
| <h2 class="section"> <a href="gettext_toc.html#TOC97">9.1 Invoking the <code>msgcat</code> Program</a> </h2> |
|
|
|
|
| <table><tr><td> </td><td><pre class="example">msgcat [<var>option</var>] [<var>inputfile</var>]... |
| </pre></td></tr></table> |
|
|
| <a name="IDX530"></a> |
| <a name="IDX531"></a> |
| <p>The <code>msgcat</code> program concatenates and merges the specified PO files. |
| It finds messages which are common to two or more of the specified PO files. |
| By using the <code>--more-than</code> option, greater commonality may be requested |
| before messages are printed. Conversely, the <code>--less-than</code> option may be |
| used to specify less commonality before messages are printed (i.e. |
| ‘<samp>--less-than=2</samp>’ will only print the unique messages). Translations, |
| comments, extracted comments, and file positions will be cumulated, except that |
| if <code>--use-first</code> is specified, they will be taken from the first PO file |
| to define them. |
| </p> |
| <p>To concatenate POT files, better use <code>xgettext</code>, not <code>msgcat</code>, |
| because <code>msgcat</code> would choke on the undefined charsets in the specified |
| POT files. |
| </p> |
|
|
| <a name="SEC102"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC98">9.1.1 Input file location</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp><var>inputfile</var> …</samp>’</dt> |
| <dd><p>Input files. |
| </p> |
| </dd> |
| <dt> ‘<samp>-f <var>file</var></samp>’</dt> |
| <dt> ‘<samp>--files-from=<var>file</var></samp>’</dt> |
| <dd><a name="IDX532"></a> |
| <a name="IDX533"></a> |
| <p>Read the names of the input files from <var>file</var> instead of getting |
| them from the command line. |
| </p> |
| </dd> |
| <dt> ‘<samp>-D <var>directory</var></samp>’</dt> |
| <dt> ‘<samp>--directory=<var>directory</var></samp>’</dt> |
| <dd><a name="IDX534"></a> |
| <a name="IDX535"></a> |
| <p>Add <var>directory</var> to the list of directories. Source files are |
| searched relative to this list of directories. The resulting ‘<tt>.po</tt>’ |
| file will be written relative to the current directory, though. |
| </p> |
| </dd> |
| </dl> |
|
|
| <p>If <var>inputfile</var> is ‘<samp>-</samp>’, standard input is read. |
| </p> |
|
|
| <a name="SEC103"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC99">9.1.2 Output file location</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-o <var>file</var></samp>’</dt> |
| <dt> ‘<samp>--output-file=<var>file</var></samp>’</dt> |
| <dd><a name="IDX536"></a> |
| <a name="IDX537"></a> |
| <p>Write output to specified file. |
| </p> |
| </dd> |
| </dl> |
|
|
| <a name="IDX538"></a> |
| <p>The results are written to standard output if no output file is specified |
| or if it is ‘<samp>-</samp>’. |
| </p> |
|
|
| <a name="SEC104"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC100">9.1.3 Message selection</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-< <var>number</var></samp>’</dt> |
| <dt> ‘<samp>--less-than=<var>number</var></samp>’</dt> |
| <dd><a name="IDX539"></a> |
| <a name="IDX540"></a> |
| <p>Print messages with less than <var>number</var> definitions, defaults to infinite |
| if not set. |
| </p> |
| </dd> |
| <dt> ‘<samp>-> <var>number</var></samp>’</dt> |
| <dt> ‘<samp>--more-than=<var>number</var></samp>’</dt> |
| <dd><a name="IDX541"></a> |
| <a name="IDX542"></a> |
| <p>Print messages with more than <var>number</var> definitions, defaults to 0 if not |
| set. |
| </p> |
| </dd> |
| <dt> ‘<samp>-u</samp>’</dt> |
| <dt> ‘<samp>--unique</samp>’</dt> |
| <dd><a name="IDX543"></a> |
| <a name="IDX544"></a> |
| <p>Shorthand for ‘<samp>--less-than=2</samp>’. Requests that only unique messages be |
| printed. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC105"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC101">9.1.4 Input file syntax</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-P</samp>’</dt> |
| <dt> ‘<samp>--properties-input</samp>’</dt> |
| <dd><a name="IDX545"></a> |
| <a name="IDX546"></a> |
| <p>Assume the input files are Java ResourceBundles in Java <code>.properties</code> |
| syntax, not in PO file syntax. |
| </p> |
| </dd> |
| <dt> ‘<samp>--stringtable-input</samp>’</dt> |
| <dd><a name="IDX547"></a> |
| <p>Assume the input files are NeXTstep/GNUstep localized resource files in |
| <code>.strings</code> syntax, not in PO file syntax. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC106"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC102">9.1.5 Output details</a> </h3> |
|
|
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-t</samp>’</dt> |
| <dt> ‘<samp>--to-code=<var>name</var></samp>’</dt> |
| <dd><a name="IDX548"></a> |
| <a name="IDX549"></a> |
| <p>Specify encoding for output. |
| </p> |
| </dd> |
| <dt> ‘<samp>--use-first</samp>’</dt> |
| <dd><a name="IDX550"></a> |
| <p>Use first available translation for each message. Don't merge several |
| translations into one. |
| </p> |
| </dd> |
| <dt> ‘<samp>--lang=<var>catalogname</var></samp>’</dt> |
| <dd><a name="IDX551"></a> |
| <p>Specify the ‘<samp>Language</samp>’ field to be used in the header entry. See |
| <a href="gettext_6.html#SEC60">Filling in the Header Entry</a> for the meaning of this field. Note: The |
| ‘<samp>Language-Team</samp>’ and ‘<samp>Plural-Forms</samp>’ fields are left unchanged. |
| </p> |
| </dd> |
| <dt> ‘<samp>--color</samp>’</dt> |
| <dt> ‘<samp>--color=<var>when</var></samp>’</dt> |
| <dd><a name="IDX552"></a> |
| <p>Specify whether or when to use colors and other text attributes. |
| See <a href="#SEC171">The <code>--color</code> option</a> for details. |
| </p> |
| </dd> |
| <dt> ‘<samp>--style=<var>style_file</var></samp>’</dt> |
| <dd><a name="IDX553"></a> |
| <p>Specify the CSS style rule file to use for <code>--color</code>. |
| See <a href="#SEC173">The <code>--style</code> option</a> for details. |
| </p> |
| </dd> |
| <dt> ‘<samp>--force-po</samp>’</dt> |
| <dd><a name="IDX554"></a> |
| <p>Always write an output file even if it contains no message. |
| </p> |
| </dd> |
| <dt> ‘<samp>-i</samp>’</dt> |
| <dt> ‘<samp>--indent</samp>’</dt> |
| <dd><a name="IDX555"></a> |
| <a name="IDX556"></a> |
| <p>Write the .po file using indented style. |
| </p> |
| </dd> |
| <dt> ‘<samp>--no-location</samp>’</dt> |
| <dd><a name="IDX557"></a> |
| <p>Do not write ‘<samp>#: <var>filename</var>:<var>line</var></samp>’ lines. |
| </p> |
| </dd> |
| <dt> ‘<samp>-n</samp>’</dt> |
| <dt> ‘<samp>--add-location=<var>type</var></samp>’</dt> |
| <dd><a name="IDX558"></a> |
| <a name="IDX559"></a> |
| <p>Generate ‘<samp>#: <var>filename</var>:<var>line</var></samp>’ lines (default). |
| </p> |
| <p>The optional <var>type</var> can be either ‘<samp>full</samp>’, ‘<samp>file</samp>’, or |
| ‘<samp>never</samp>’. If it is not given or ‘<samp>full</samp>’, it generates the |
| lines with both file name and line number. If it is ‘<samp>file</samp>’, the |
| line number part is omitted. If it is ‘<samp>never</samp>’, it completely |
| suppresses the lines (same as <code>--no-location</code>). |
| </p> |
| </dd> |
| <dt> ‘<samp>--strict</samp>’</dt> |
| <dd><a name="IDX560"></a> |
| <p>Write out a strict Uniforum conforming PO file. Note that this |
| Uniforum format should be avoided because it doesn't support the |
| GNU extensions. |
| </p> |
| </dd> |
| <dt> ‘<samp>-p</samp>’</dt> |
| <dt> ‘<samp>--properties-output</samp>’</dt> |
| <dd><a name="IDX561"></a> |
| <a name="IDX562"></a> |
| <p>Write out a Java ResourceBundle in Java <code>.properties</code> syntax. Note |
| that this file format doesn't support plural forms and silently drops |
| obsolete messages. |
| </p> |
| </dd> |
| <dt> ‘<samp>--stringtable-output</samp>’</dt> |
| <dd><a name="IDX563"></a> |
| <p>Write out a NeXTstep/GNUstep localized resource file in <code>.strings</code> syntax. |
| Note that this file format doesn't support plural forms. |
| </p> |
| </dd> |
| <dt> ‘<samp>-w <var>number</var></samp>’</dt> |
| <dt> ‘<samp>--width=<var>number</var></samp>’</dt> |
| <dd><a name="IDX564"></a> |
| <a name="IDX565"></a> |
| <p>Set the output page width. Long strings in the output files will be |
| split across multiple lines in order to ensure that each line's width |
| (= number of screen columns) is less or equal to the given <var>number</var>. |
| </p> |
| </dd> |
| <dt> ‘<samp>--no-wrap</samp>’</dt> |
| <dd><a name="IDX566"></a> |
| <p>Do not break long message lines. Message lines whose width exceeds the |
| output page width will not be split into several lines. Only file reference |
| lines which are wider than the output page width will be split. |
| </p> |
| </dd> |
| <dt> ‘<samp>-s</samp>’</dt> |
| <dt> ‘<samp>--sort-output</samp>’</dt> |
| <dd><a name="IDX567"></a> |
| <a name="IDX568"></a> |
| <a name="IDX569"></a> |
| <p>Generate sorted output. Note that using this option makes it much harder |
| for the translator to understand each message's context. |
| </p> |
| </dd> |
| <dt> ‘<samp>-F</samp>’</dt> |
| <dt> ‘<samp>--sort-by-file</samp>’</dt> |
| <dd><a name="IDX570"></a> |
| <a name="IDX571"></a> |
| <p>Sort output by file location. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC107"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC103">9.1.6 Informative output</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-h</samp>’</dt> |
| <dt> ‘<samp>--help</samp>’</dt> |
| <dd><a name="IDX572"></a> |
| <a name="IDX573"></a> |
| <p>Display this help and exit. |
| </p> |
| </dd> |
| <dt> ‘<samp>-V</samp>’</dt> |
| <dt> ‘<samp>--version</samp>’</dt> |
| <dd><a name="IDX574"></a> |
| <a name="IDX575"></a> |
| <p>Output version information and exit. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="msgconv-Invocation"></a> |
| <a name="SEC108"></a> |
| <h2 class="section"> <a href="gettext_toc.html#TOC104">9.2 Invoking the <code>msgconv</code> Program</a> </h2> |
|
|
|
|
| <table><tr><td> </td><td><pre class="example">msgconv [<var>option</var>] [<var>inputfile</var>] |
| </pre></td></tr></table> |
|
|
| <a name="IDX576"></a> |
| <p>The <code>msgconv</code> program converts a translation catalog to a different |
| character encoding. |
| </p> |
|
|
| <a name="SEC109"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC105">9.2.1 Input file location</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp><var>inputfile</var></samp>’</dt> |
| <dd><p>Input PO file. |
| </p> |
| </dd> |
| <dt> ‘<samp>-D <var>directory</var></samp>’</dt> |
| <dt> ‘<samp>--directory=<var>directory</var></samp>’</dt> |
| <dd><a name="IDX577"></a> |
| <a name="IDX578"></a> |
| <p>Add <var>directory</var> to the list of directories. Source files are |
| searched relative to this list of directories. The resulting ‘<tt>.po</tt>’ |
| file will be written relative to the current directory, though. |
| </p> |
| </dd> |
| </dl> |
|
|
| <p>If no <var>inputfile</var> is given or if it is ‘<samp>-</samp>’, standard input is read. |
| </p> |
|
|
| <a name="SEC110"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC106">9.2.2 Output file location</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-o <var>file</var></samp>’</dt> |
| <dt> ‘<samp>--output-file=<var>file</var></samp>’</dt> |
| <dd><a name="IDX579"></a> |
| <a name="IDX580"></a> |
| <p>Write output to specified file. |
| </p> |
| </dd> |
| </dl> |
|
|
| <p>The results are written to standard output if no output file is specified |
| or if it is ‘<samp>-</samp>’. |
| </p> |
|
|
| <a name="SEC111"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC107">9.2.3 Conversion target</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-t</samp>’</dt> |
| <dt> ‘<samp>--to-code=<var>name</var></samp>’</dt> |
| <dd><a name="IDX581"></a> |
| <a name="IDX582"></a> |
| <p>Specify encoding for output. |
| </p> |
| </dd> |
| </dl> |
|
|
| <p>The default encoding is the current locale's encoding. |
| </p> |
|
|
| <a name="SEC112"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC108">9.2.4 Input file syntax</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-P</samp>’</dt> |
| <dt> ‘<samp>--properties-input</samp>’</dt> |
| <dd><a name="IDX583"></a> |
| <a name="IDX584"></a> |
| <p>Assume the input file is a Java ResourceBundle in Java <code>.properties</code> |
| syntax, not in PO file syntax. |
| </p> |
| </dd> |
| <dt> ‘<samp>--stringtable-input</samp>’</dt> |
| <dd><a name="IDX585"></a> |
| <p>Assume the input file is a NeXTstep/GNUstep localized resource file in |
| <code>.strings</code> syntax, not in PO file syntax. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC113"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC109">9.2.5 Output details</a> </h3> |
|
|
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>--color</samp>’</dt> |
| <dt> ‘<samp>--color=<var>when</var></samp>’</dt> |
| <dd><a name="IDX586"></a> |
| <p>Specify whether or when to use colors and other text attributes. |
| See <a href="#SEC171">The <code>--color</code> option</a> for details. |
| </p> |
| </dd> |
| <dt> ‘<samp>--style=<var>style_file</var></samp>’</dt> |
| <dd><a name="IDX587"></a> |
| <p>Specify the CSS style rule file to use for <code>--color</code>. |
| See <a href="#SEC173">The <code>--style</code> option</a> for details. |
| </p> |
| </dd> |
| <dt> ‘<samp>--force-po</samp>’</dt> |
| <dd><a name="IDX588"></a> |
| <p>Always write an output file even if it contains no message. |
| </p> |
| </dd> |
| <dt> ‘<samp>-i</samp>’</dt> |
| <dt> ‘<samp>--indent</samp>’</dt> |
| <dd><a name="IDX589"></a> |
| <a name="IDX590"></a> |
| <p>Write the .po file using indented style. |
| </p> |
| </dd> |
| <dt> ‘<samp>--no-location</samp>’</dt> |
| <dd><a name="IDX591"></a> |
| <p>Do not write ‘<samp>#: <var>filename</var>:<var>line</var></samp>’ lines. |
| </p> |
| </dd> |
| <dt> ‘<samp>-n</samp>’</dt> |
| <dt> ‘<samp>--add-location=<var>type</var></samp>’</dt> |
| <dd><a name="IDX592"></a> |
| <p>Generate ‘<samp>#: <var>filename</var>:<var>line</var></samp>’ lines (default). |
| </p> |
| <p>The optional <var>type</var> can be either ‘<samp>full</samp>’, ‘<samp>file</samp>’, or |
| ‘<samp>never</samp>’. If it is not given or ‘<samp>full</samp>’, it generates the |
| lines with both file name and line number. If it is ‘<samp>file</samp>’, the |
| line number part is omitted. If it is ‘<samp>never</samp>’, it completely |
| suppresses the lines (same as <code>--no-location</code>). |
| </p> |
| </dd> |
| <dt> ‘<samp>--strict</samp>’</dt> |
| <dd><a name="IDX593"></a> |
| <p>Write out a strict Uniforum conforming PO file. Note that this |
| Uniforum format should be avoided because it doesn't support the |
| GNU extensions. |
| </p> |
| </dd> |
| <dt> ‘<samp>-p</samp>’</dt> |
| <dt> ‘<samp>--properties-output</samp>’</dt> |
| <dd><a name="IDX594"></a> |
| <a name="IDX595"></a> |
| <p>Write out a Java ResourceBundle in Java <code>.properties</code> syntax. Note |
| that this file format doesn't support plural forms and silently drops |
| obsolete messages. |
| </p> |
| </dd> |
| <dt> ‘<samp>--stringtable-output</samp>’</dt> |
| <dd><a name="IDX596"></a> |
| <p>Write out a NeXTstep/GNUstep localized resource file in <code>.strings</code> syntax. |
| Note that this file format doesn't support plural forms. |
| </p> |
| </dd> |
| <dt> ‘<samp>-w <var>number</var></samp>’</dt> |
| <dt> ‘<samp>--width=<var>number</var></samp>’</dt> |
| <dd><a name="IDX597"></a> |
| <a name="IDX598"></a> |
| <p>Set the output page width. Long strings in the output files will be |
| split across multiple lines in order to ensure that each line's width |
| (= number of screen columns) is less or equal to the given <var>number</var>. |
| </p> |
| </dd> |
| <dt> ‘<samp>--no-wrap</samp>’</dt> |
| <dd><a name="IDX599"></a> |
| <p>Do not break long message lines. Message lines whose width exceeds the |
| output page width will not be split into several lines. Only file reference |
| lines which are wider than the output page width will be split. |
| </p> |
| </dd> |
| <dt> ‘<samp>-s</samp>’</dt> |
| <dt> ‘<samp>--sort-output</samp>’</dt> |
| <dd><a name="IDX600"></a> |
| <a name="IDX601"></a> |
| <p>Generate sorted output. Note that using this option makes it much harder |
| for the translator to understand each message's context. |
| </p> |
| </dd> |
| <dt> ‘<samp>-F</samp>’</dt> |
| <dt> ‘<samp>--sort-by-file</samp>’</dt> |
| <dd><a name="IDX602"></a> |
| <a name="IDX603"></a> |
| <p>Sort output by file location. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC114"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC110">9.2.6 Informative output</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-h</samp>’</dt> |
| <dt> ‘<samp>--help</samp>’</dt> |
| <dd><a name="IDX604"></a> |
| <a name="IDX605"></a> |
| <p>Display this help and exit. |
| </p> |
| </dd> |
| <dt> ‘<samp>-V</samp>’</dt> |
| <dt> ‘<samp>--version</samp>’</dt> |
| <dd><a name="IDX606"></a> |
| <a name="IDX607"></a> |
| <p>Output version information and exit. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="msggrep-Invocation"></a> |
| <a name="SEC115"></a> |
| <h2 class="section"> <a href="gettext_toc.html#TOC111">9.3 Invoking the <code>msggrep</code> Program</a> </h2> |
|
|
|
|
| <table><tr><td> </td><td><pre class="example">msggrep [<var>option</var>] [<var>inputfile</var>] |
| </pre></td></tr></table> |
|
|
| <a name="IDX608"></a> |
| <p>The <code>msggrep</code> program extracts all messages of a translation catalog |
| that match a given pattern or belong to some given source files. |
| </p> |
|
|
| <a name="SEC116"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC112">9.3.1 Input file location</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp><var>inputfile</var></samp>’</dt> |
| <dd><p>Input PO file. |
| </p> |
| </dd> |
| <dt> ‘<samp>-D <var>directory</var></samp>’</dt> |
| <dt> ‘<samp>--directory=<var>directory</var></samp>’</dt> |
| <dd><a name="IDX609"></a> |
| <a name="IDX610"></a> |
| <p>Add <var>directory</var> to the list of directories. Source files are |
| searched relative to this list of directories. The resulting ‘<tt>.po</tt>’ |
| file will be written relative to the current directory, though. |
| </p> |
| </dd> |
| </dl> |
|
|
| <p>If no <var>inputfile</var> is given or if it is ‘<samp>-</samp>’, standard input is read. |
| </p> |
|
|
| <a name="SEC117"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC113">9.3.2 Output file location</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-o <var>file</var></samp>’</dt> |
| <dt> ‘<samp>--output-file=<var>file</var></samp>’</dt> |
| <dd><a name="IDX611"></a> |
| <a name="IDX612"></a> |
| <p>Write output to specified file. |
| </p> |
| </dd> |
| </dl> |
|
|
| <p>The results are written to standard output if no output file is specified |
| or if it is ‘<samp>-</samp>’. |
| </p> |
|
|
| <a name="SEC118"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC114">9.3.3 Message selection</a> </h3> |
|
|
| <table><tr><td> </td><td><pre class="example"> [-N <var>sourcefile</var>]... [-M <var>domainname</var>]... |
| [-J <var>msgctxt-pattern</var>] [-K <var>msgid-pattern</var>] [-T <var>msgstr-pattern</var>] |
| [-C <var>comment-pattern</var>] |
| </pre></td></tr></table> |
|
|
| <p>A message is selected if |
| </p><ul> |
| <li> it comes from one of the specified source files, |
| </li><li> or if it comes from one of the specified domains, |
| </li><li> or if ‘<samp>-J</samp>’ is given and its context (msgctxt) matches |
| <var>msgctxt-pattern</var>, |
| </li><li> or if ‘<samp>-K</samp>’ is given and its key (msgid or msgid_plural) matches |
| <var>msgid-pattern</var>, |
| </li><li> or if ‘<samp>-T</samp>’ is given and its translation (msgstr) matches |
| <var>msgstr-pattern</var>, |
| </li><li> or if ‘<samp>-C</samp>’ is given and the translator's comment matches |
| <var>comment-pattern</var>. |
| </li></ul> |
|
|
| <p>When more than one selection criterion is specified, the set of selected |
| messages is the union of the selected messages of each criterion. |
| </p> |
| <p><var>msgctxt-pattern</var> or <var>msgid-pattern</var> or <var>msgstr-pattern</var> syntax: |
| </p><table><tr><td> </td><td><pre class="example"> [-E | -F] [-e <var>pattern</var> | -f <var>file</var>]... |
| </pre></td></tr></table> |
| <p><var>pattern</var>s are basic regular expressions by default, or extended regular |
| expressions if -E is given, or fixed strings if -F is given. |
| </p> |
| <dl compact="compact"> |
| <dt> ‘<samp>-N <var>sourcefile</var></samp>’</dt> |
| <dt> ‘<samp>--location=<var>sourcefile</var></samp>’</dt> |
| <dd><a name="IDX613"></a> |
| <a name="IDX614"></a> |
| <p>Select messages extracted from <var>sourcefile</var>. <var>sourcefile</var> can be |
| either a literal file name or a wildcard pattern. |
| </p> |
| </dd> |
| <dt> ‘<samp>-M <var>domainname</var></samp>’</dt> |
| <dt> ‘<samp>--domain=<var>domainname</var></samp>’</dt> |
| <dd><a name="IDX615"></a> |
| <a name="IDX616"></a> |
| <p>Select messages belonging to domain <var>domainname</var>. |
| </p> |
| </dd> |
| <dt> ‘<samp>-J</samp>’</dt> |
| <dt> ‘<samp>--msgctxt</samp>’</dt> |
| <dd><a name="IDX617"></a> |
| <a name="IDX618"></a> |
| <p>Start of patterns for the msgctxt. |
| </p> |
| </dd> |
| <dt> ‘<samp>-K</samp>’</dt> |
| <dt> ‘<samp>--msgid</samp>’</dt> |
| <dd><a name="IDX619"></a> |
| <a name="IDX620"></a> |
| <p>Start of patterns for the msgid. |
| </p> |
| </dd> |
| <dt> ‘<samp>-T</samp>’</dt> |
| <dt> ‘<samp>--msgstr</samp>’</dt> |
| <dd><a name="IDX621"></a> |
| <a name="IDX622"></a> |
| <p>Start of patterns for the msgstr. |
| </p> |
| </dd> |
| <dt> ‘<samp>-C</samp>’</dt> |
| <dt> ‘<samp>--comment</samp>’</dt> |
| <dd><a name="IDX623"></a> |
| <a name="IDX624"></a> |
| <p>Start of patterns for the translator's comment. |
| </p> |
| </dd> |
| <dt> ‘<samp>-X</samp>’</dt> |
| <dt> ‘<samp>--extracted-comment</samp>’</dt> |
| <dd><a name="IDX625"></a> |
| <a name="IDX626"></a> |
| <p>Start of patterns for the extracted comments. |
| </p> |
| </dd> |
| <dt> ‘<samp>-E</samp>’</dt> |
| <dt> ‘<samp>--extended-regexp</samp>’</dt> |
| <dd><a name="IDX627"></a> |
| <a name="IDX628"></a> |
| <p>Specify that <var>pattern</var> is an extended regular expression. |
| </p> |
| </dd> |
| <dt> ‘<samp>-F</samp>’</dt> |
| <dt> ‘<samp>--fixed-strings</samp>’</dt> |
| <dd><a name="IDX629"></a> |
| <a name="IDX630"></a> |
| <p>Specify that <var>pattern</var> is a set of newline-separated strings. |
| </p> |
| </dd> |
| <dt> ‘<samp>-e <var>pattern</var></samp>’</dt> |
| <dt> ‘<samp>--regexp=<var>pattern</var></samp>’</dt> |
| <dd><a name="IDX631"></a> |
| <a name="IDX632"></a> |
| <p>Use <var>pattern</var> as a regular expression. |
| </p> |
| </dd> |
| <dt> ‘<samp>-f <var>file</var></samp>’</dt> |
| <dt> ‘<samp>--file=<var>file</var></samp>’</dt> |
| <dd><a name="IDX633"></a> |
| <a name="IDX634"></a> |
| <p>Obtain <var>pattern</var> from <var>file</var>. |
| </p> |
| </dd> |
| <dt> ‘<samp>-i</samp>’</dt> |
| <dt> ‘<samp>--ignore-case</samp>’</dt> |
| <dd><a name="IDX635"></a> |
| <a name="IDX636"></a> |
| <p>Ignore case distinctions. |
| </p> |
| </dd> |
| <dt> ‘<samp>-v</samp>’</dt> |
| <dt> ‘<samp>--invert-match</samp>’</dt> |
| <dd><a name="IDX637"></a> |
| <a name="IDX638"></a> |
| <p>Output only the messages that do not match any selection criterion, instead |
| of the messages that match a selection criterion. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC119"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC115">9.3.4 Input file syntax</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-P</samp>’</dt> |
| <dt> ‘<samp>--properties-input</samp>’</dt> |
| <dd><a name="IDX639"></a> |
| <a name="IDX640"></a> |
| <p>Assume the input file is a Java ResourceBundle in Java <code>.properties</code> |
| syntax, not in PO file syntax. |
| </p> |
| </dd> |
| <dt> ‘<samp>--stringtable-input</samp>’</dt> |
| <dd><a name="IDX641"></a> |
| <p>Assume the input file is a NeXTstep/GNUstep localized resource file in |
| <code>.strings</code> syntax, not in PO file syntax. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC120"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC116">9.3.5 Output details</a> </h3> |
|
|
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>--color</samp>’</dt> |
| <dt> ‘<samp>--color=<var>when</var></samp>’</dt> |
| <dd><a name="IDX642"></a> |
| <p>Specify whether or when to use colors and other text attributes. |
| See <a href="#SEC171">The <code>--color</code> option</a> for details. |
| </p> |
| </dd> |
| <dt> ‘<samp>--style=<var>style_file</var></samp>’</dt> |
| <dd><a name="IDX643"></a> |
| <p>Specify the CSS style rule file to use for <code>--color</code>. |
| See <a href="#SEC173">The <code>--style</code> option</a> for details. |
| </p> |
| </dd> |
| <dt> ‘<samp>--force-po</samp>’</dt> |
| <dd><a name="IDX644"></a> |
| <p>Always write an output file even if it contains no message. |
| </p> |
| </dd> |
| <dt> ‘<samp>--indent</samp>’</dt> |
| <dd><a name="IDX645"></a> |
| <p>Write the .po file using indented style. |
| </p> |
| </dd> |
| <dt> ‘<samp>--no-location</samp>’</dt> |
| <dd><a name="IDX646"></a> |
| <p>Do not write ‘<samp>#: <var>filename</var>:<var>line</var></samp>’ lines. |
| </p> |
| </dd> |
| <dt> ‘<samp>-n</samp>’</dt> |
| <dt> ‘<samp>--add-location=<var>type</var></samp>’</dt> |
| <dd><a name="IDX647"></a> |
| <p>Generate ‘<samp>#: <var>filename</var>:<var>line</var></samp>’ lines (default). |
| </p> |
| <p>The optional <var>type</var> can be either ‘<samp>full</samp>’, ‘<samp>file</samp>’, or |
| ‘<samp>never</samp>’. If it is not given or ‘<samp>full</samp>’, it generates the |
| lines with both file name and line number. If it is ‘<samp>file</samp>’, the |
| line number part is omitted. If it is ‘<samp>never</samp>’, it completely |
| suppresses the lines (same as <code>--no-location</code>). |
| </p> |
| </dd> |
| <dt> ‘<samp>--strict</samp>’</dt> |
| <dd><a name="IDX648"></a> |
| <p>Write out a strict Uniforum conforming PO file. Note that this |
| Uniforum format should be avoided because it doesn't support the |
| GNU extensions. |
| </p> |
| </dd> |
| <dt> ‘<samp>-p</samp>’</dt> |
| <dt> ‘<samp>--properties-output</samp>’</dt> |
| <dd><a name="IDX649"></a> |
| <a name="IDX650"></a> |
| <p>Write out a Java ResourceBundle in Java <code>.properties</code> syntax. Note |
| that this file format doesn't support plural forms and silently drops |
| obsolete messages. |
| </p> |
| </dd> |
| <dt> ‘<samp>--stringtable-output</samp>’</dt> |
| <dd><a name="IDX651"></a> |
| <p>Write out a NeXTstep/GNUstep localized resource file in <code>.strings</code> syntax. |
| Note that this file format doesn't support plural forms. |
| </p> |
| </dd> |
| <dt> ‘<samp>-w <var>number</var></samp>’</dt> |
| <dt> ‘<samp>--width=<var>number</var></samp>’</dt> |
| <dd><a name="IDX652"></a> |
| <a name="IDX653"></a> |
| <p>Set the output page width. Long strings in the output files will be |
| split across multiple lines in order to ensure that each line's width |
| (= number of screen columns) is less or equal to the given <var>number</var>. |
| </p> |
| </dd> |
| <dt> ‘<samp>--no-wrap</samp>’</dt> |
| <dd><a name="IDX654"></a> |
| <p>Do not break long message lines. Message lines whose width exceeds the |
| output page width will not be split into several lines. Only file reference |
| lines which are wider than the output page width will be split. |
| </p> |
| </dd> |
| <dt> ‘<samp>--sort-output</samp>’</dt> |
| <dd><a name="IDX655"></a> |
| <p>Generate sorted output. Note that using this option makes it much harder |
| for the translator to understand each message's context. |
| </p> |
| </dd> |
| <dt> ‘<samp>--sort-by-file</samp>’</dt> |
| <dd><a name="IDX656"></a> |
| <p>Sort output by file location. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC121"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC117">9.3.6 Informative output</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-h</samp>’</dt> |
| <dt> ‘<samp>--help</samp>’</dt> |
| <dd><a name="IDX657"></a> |
| <a name="IDX658"></a> |
| <p>Display this help and exit. |
| </p> |
| </dd> |
| <dt> ‘<samp>-V</samp>’</dt> |
| <dt> ‘<samp>--version</samp>’</dt> |
| <dd><a name="IDX659"></a> |
| <a name="IDX660"></a> |
| <p>Output version information and exit. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC122"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC118">9.3.7 Examples</a> </h3> |
|
|
| <p>To extract the messages that come from the source files |
| <code>gnulib-lib/error.c</code> and <code>gnulib-lib/getopt.c</code>: |
| </p> |
| <table><tr><td> </td><td><pre class="smallexample">msggrep -N gnulib-lib/error.c -N gnulib-lib/getopt.c input.po |
| </pre></td></tr></table> |
|
|
| <p>To extract the messages that contain the string “Please specify” in the |
| original string: |
| </p> |
| <table><tr><td> </td><td><pre class="smallexample">msggrep --msgid -F -e 'Please specify' input.po |
| </pre></td></tr></table> |
|
|
| <p>To extract the messages that have a context specifier of either “Menu>File” |
| or “Menu>Edit” or a submenu of them: |
| </p> |
| <table><tr><td> </td><td><pre class="smallexample">msggrep --msgctxt -E -e '^Menu>(File|Edit)' input.po |
| </pre></td></tr></table> |
|
|
| <p>To extract the messages whose translation contains one of the strings in the |
| file <code>wordlist.txt</code>: |
| </p> |
| <table><tr><td> </td><td><pre class="smallexample">msggrep --msgstr -F -f wordlist.txt input.po |
| </pre></td></tr></table> |
|
|
|
|
| <a name="msgfilter-Invocation"></a> |
| <a name="SEC123"></a> |
| <h2 class="section"> <a href="gettext_toc.html#TOC119">9.4 Invoking the <code>msgfilter</code> Program</a> </h2> |
|
|
|
|
| <table><tr><td> </td><td><pre class="example">msgfilter [<var>option</var>] <var>filter</var> [<var>filter-option</var>] |
| </pre></td></tr></table> |
|
|
| <a name="IDX661"></a> |
| <p>The <code>msgfilter</code> program applies a filter to all translations of a |
| translation catalog. |
| </p> |
| <a name="IDX662"></a> |
| <a name="IDX663"></a> |
| <a name="IDX664"></a> |
| <a name="IDX665"></a> |
| <a name="IDX666"></a> |
| <a name="IDX667"></a> |
| <a name="IDX668"></a> |
| <a name="IDX669"></a> |
| <p>During each <var>filter</var> invocation, the environment variable |
| <code>MSGFILTER_MSGID</code> is bound to the message's msgid, and the environment |
| variable <code>MSGFILTER_LOCATION</code> is bound to the location in the PO file |
| of the message. If the message has a context, the environment variable |
| <code>MSGFILTER_MSGCTXT</code> is bound to the message's msgctxt, otherwise it is |
| unbound. If the message has a plural form, environment variable |
| <code>MSGFILTER_MSGID_PLURAL</code> is bound to the message's msgid_plural and |
| <code>MSGFILTER_PLURAL_FORM</code> is bound to the order number of the plural |
| actually processed (starting with 0), otherwise both are unbound. |
| If the message has a previous msgid (added by <code>msgmerge</code>), |
| environment variable <code>MSGFILTER_PREV_MSGCTXT</code> is bound to the |
| message's previous msgctxt, <code>MSGFILTER_PREV_MSGID</code> is bound to |
| the previous msgid, and <code>MSGFILTER_PREV_MSGID_PLURAL</code> is bound to |
| the previous msgid_plural. |
| </p> |
|
|
| <a name="SEC124"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC120">9.4.1 Input file location</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-i <var>inputfile</var></samp>’</dt> |
| <dt> ‘<samp>--input=<var>inputfile</var></samp>’</dt> |
| <dd><a name="IDX670"></a> |
| <a name="IDX671"></a> |
| <p>Input PO file. |
| </p> |
| </dd> |
| <dt> ‘<samp>-D <var>directory</var></samp>’</dt> |
| <dt> ‘<samp>--directory=<var>directory</var></samp>’</dt> |
| <dd><a name="IDX672"></a> |
| <a name="IDX673"></a> |
| <p>Add <var>directory</var> to the list of directories. Source files are |
| searched relative to this list of directories. The resulting ‘<tt>.po</tt>’ |
| file will be written relative to the current directory, though. |
| </p> |
| </dd> |
| </dl> |
|
|
| <p>If no <var>inputfile</var> is given or if it is ‘<samp>-</samp>’, standard input is read. |
| </p> |
|
|
| <a name="SEC125"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC121">9.4.2 Output file location</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-o <var>file</var></samp>’</dt> |
| <dt> ‘<samp>--output-file=<var>file</var></samp>’</dt> |
| <dd><a name="IDX674"></a> |
| <a name="IDX675"></a> |
| <p>Write output to specified file. |
| </p> |
| </dd> |
| </dl> |
|
|
| <p>The results are written to standard output if no output file is specified |
| or if it is ‘<samp>-</samp>’. |
| </p> |
|
|
| <a name="SEC126"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC122">9.4.3 The filter</a> </h3> |
|
|
| <p>The <var>filter</var> can be any program that reads a translation from standard |
| input and writes a modified translation to standard output. A frequently |
| used filter is ‘<samp>sed</samp>’. A few particular built-in filters are also |
| recognized. |
| </p> |
| <dl compact="compact"> |
| <dt> ‘<samp>--newline</samp>’</dt> |
| <dd><a name="IDX676"></a> |
| <p>Add newline at the end of each input line and also strip the ending |
| newline from the output line. |
| </p> |
| </dd> |
| </dl> |
|
|
| <a name="IDX677"></a> |
| <p>Note: If the filter is not a built-in filter, you have to care about encodings: |
| It is your responsibility to ensure that the <var>filter</var> can cope |
| with input encoded in the translation catalog's encoding. If the |
| <var>filter</var> wants input in a particular encoding, you can in a first step |
| convert the translation catalog to that encoding using the ‘<samp>msgconv</samp>’ |
| program, before invoking ‘<samp>msgfilter</samp>’. If the <var>filter</var> wants input |
| in the locale's encoding, but you want to avoid the locale's encoding, then |
| you can first convert the translation catalog to UTF-8 using the |
| ‘<samp>msgconv</samp>’ program and then make ‘<samp>msgfilter</samp>’ work in an UTF-8 |
| locale, by using the <code>LC_ALL</code> environment variable. |
| </p> |
| <a name="IDX678"></a> |
| <p>Note: Most translations in a translation catalog don't end with a |
| newline character. For this reason, unless the <code>--newline</code> |
| option is used, it is important that the <var>filter</var> recognizes its |
| last input line even if it ends without a newline, and that it doesn't |
| add an undesired trailing newline at the end. The ‘<samp>sed</samp>’ program on |
| some platforms is known to ignore the last line of input if it is not |
| terminated with a newline. You can use GNU <code>sed</code> instead; it does |
| not have this limitation. |
| </p> |
|
|
| <a name="SEC127"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC123">9.4.4 Useful <var>filter-option</var>s when the <var>filter</var> is ‘<samp>sed</samp>’</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-e <var>script</var></samp>’</dt> |
| <dt> ‘<samp>--expression=<var>script</var></samp>’</dt> |
| <dd><a name="IDX679"></a> |
| <a name="IDX680"></a> |
| <p>Add <var>script</var> to the commands to be executed. |
| </p> |
| </dd> |
| <dt> ‘<samp>-f <var>scriptfile</var></samp>’</dt> |
| <dt> ‘<samp>--file=<var>scriptfile</var></samp>’</dt> |
| <dd><a name="IDX681"></a> |
| <a name="IDX682"></a> |
| <p>Add the contents of <var>scriptfile</var> to the commands to be executed. |
| </p> |
| </dd> |
| <dt> ‘<samp>-n</samp>’</dt> |
| <dt> ‘<samp>--quiet</samp>’</dt> |
| <dt> ‘<samp>--silent</samp>’</dt> |
| <dd><a name="IDX683"></a> |
| <a name="IDX684"></a> |
| <a name="IDX685"></a> |
| <p>Suppress automatic printing of pattern space. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC128"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC124">9.4.5 Built-in <var>filter</var>s</a> </h3> |
|
|
| <p>The filter ‘<samp>recode-sr-latin</samp>’ is recognized as a built-in filter. |
| The command ‘<samp>recode-sr-latin</samp>’ converts Serbian text, written in the |
| Cyrillic script, to the Latin script. |
| The command ‘<samp>msgfilter recode-sr-latin</samp>’ applies this conversion to the |
| translations of a PO file. Thus, it can be used to convert an ‘<tt>sr.po</tt>’ |
| file to an ‘<tt>sr@latin.po</tt>’ file. |
| </p> |
| <a name="IDX686"></a> |
| <p>The filter ‘<samp>quot</samp>’ is recognized as a built-in filter. |
| The command ‘<samp>msgfilter quot</samp>’ converts any quotations surrounded |
| by a pair of ‘<samp>"</samp>’, ‘<samp>'</samp>’, and ‘<samp>`</samp>’. |
| </p> |
| <a name="IDX687"></a> |
| <p>The filter ‘<samp>boldquot</samp>’ is recognized as a built-in filter. |
| The command ‘<samp>msgfilter boldquot</samp>’ converts any quotations |
| surrounded by a pair of ‘<samp>"</samp>’, ‘<samp>'</samp>’, and ‘<samp>`</samp>’, also adding the |
| VT100 escape sequences to the text to decorate it as bold. |
| </p> |
| <p>The use of built-in filters is not sensitive to the current locale's encoding. |
| Moreover, when used with a built-in filter, ‘<samp>msgfilter</samp>’ can automatically |
| convert the message catalog to the UTF-8 encoding when needed. |
| </p> |
|
|
| <a name="SEC129"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC125">9.4.6 Input file syntax</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-P</samp>’</dt> |
| <dt> ‘<samp>--properties-input</samp>’</dt> |
| <dd><a name="IDX688"></a> |
| <a name="IDX689"></a> |
| <p>Assume the input file is a Java ResourceBundle in Java <code>.properties</code> |
| syntax, not in PO file syntax. |
| </p> |
| </dd> |
| <dt> ‘<samp>--stringtable-input</samp>’</dt> |
| <dd><a name="IDX690"></a> |
| <p>Assume the input file is a NeXTstep/GNUstep localized resource file in |
| <code>.strings</code> syntax, not in PO file syntax. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC130"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC126">9.4.7 Output details</a> </h3> |
|
|
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>--color</samp>’</dt> |
| <dt> ‘<samp>--color=<var>when</var></samp>’</dt> |
| <dd><a name="IDX691"></a> |
| <p>Specify whether or when to use colors and other text attributes. |
| See <a href="#SEC171">The <code>--color</code> option</a> for details. |
| </p> |
| </dd> |
| <dt> ‘<samp>--style=<var>style_file</var></samp>’</dt> |
| <dd><a name="IDX692"></a> |
| <p>Specify the CSS style rule file to use for <code>--color</code>. |
| See <a href="#SEC173">The <code>--style</code> option</a> for details. |
| </p> |
| </dd> |
| <dt> ‘<samp>--force-po</samp>’</dt> |
| <dd><a name="IDX693"></a> |
| <p>Always write an output file even if it contains no message. |
| </p> |
| </dd> |
| <dt> ‘<samp>--indent</samp>’</dt> |
| <dd><a name="IDX694"></a> |
| <p>Write the .po file using indented style. |
| </p> |
| </dd> |
| <dt> ‘<samp>--keep-header</samp>’</dt> |
| <dd><a name="IDX695"></a> |
| <p>Keep the header entry, i.e. the message with ‘<samp>msgid ""</samp>’, unmodified, |
| instead of filtering it. By default, the header entry is subject to |
| filtering like any other message. |
| </p> |
| </dd> |
| <dt> ‘<samp>--no-location</samp>’</dt> |
| <dd><a name="IDX696"></a> |
| <p>Do not write ‘<samp>#: <var>filename</var>:<var>line</var></samp>’ lines. |
| </p> |
| </dd> |
| <dt> ‘<samp>-n</samp>’</dt> |
| <dt> ‘<samp>--add-location=<var>type</var></samp>’</dt> |
| <dd><a name="IDX697"></a> |
| <p>Generate ‘<samp>#: <var>filename</var>:<var>line</var></samp>’ lines (default). |
| </p> |
| <p>The optional <var>type</var> can be either ‘<samp>full</samp>’, ‘<samp>file</samp>’, or |
| ‘<samp>never</samp>’. If it is not given or ‘<samp>full</samp>’, it generates the |
| lines with both file name and line number. If it is ‘<samp>file</samp>’, the |
| line number part is omitted. If it is ‘<samp>never</samp>’, it completely |
| suppresses the lines (same as <code>--no-location</code>). |
| </p> |
| </dd> |
| <dt> ‘<samp>--strict</samp>’</dt> |
| <dd><a name="IDX698"></a> |
| <p>Write out a strict Uniforum conforming PO file. Note that this |
| Uniforum format should be avoided because it doesn't support the |
| GNU extensions. |
| </p> |
| </dd> |
| <dt> ‘<samp>-p</samp>’</dt> |
| <dt> ‘<samp>--properties-output</samp>’</dt> |
| <dd><a name="IDX699"></a> |
| <a name="IDX700"></a> |
| <p>Write out a Java ResourceBundle in Java <code>.properties</code> syntax. Note |
| that this file format doesn't support plural forms and silently drops |
| obsolete messages. |
| </p> |
| </dd> |
| <dt> ‘<samp>--stringtable-output</samp>’</dt> |
| <dd><a name="IDX701"></a> |
| <p>Write out a NeXTstep/GNUstep localized resource file in <code>.strings</code> syntax. |
| Note that this file format doesn't support plural forms. |
| </p> |
| </dd> |
| <dt> ‘<samp>-w <var>number</var></samp>’</dt> |
| <dt> ‘<samp>--width=<var>number</var></samp>’</dt> |
| <dd><a name="IDX702"></a> |
| <a name="IDX703"></a> |
| <p>Set the output page width. Long strings in the output files will be |
| split across multiple lines in order to ensure that each line's width |
| (= number of screen columns) is less or equal to the given <var>number</var>. |
| </p> |
| </dd> |
| <dt> ‘<samp>--no-wrap</samp>’</dt> |
| <dd><a name="IDX704"></a> |
| <p>Do not break long message lines. Message lines whose width exceeds the |
| output page width will not be split into several lines. Only file reference |
| lines which are wider than the output page width will be split. |
| </p> |
| </dd> |
| <dt> ‘<samp>-s</samp>’</dt> |
| <dt> ‘<samp>--sort-output</samp>’</dt> |
| <dd><a name="IDX705"></a> |
| <a name="IDX706"></a> |
| <p>Generate sorted output. Note that using this option makes it much harder |
| for the translator to understand each message's context. |
| </p> |
| </dd> |
| <dt> ‘<samp>-F</samp>’</dt> |
| <dt> ‘<samp>--sort-by-file</samp>’</dt> |
| <dd><a name="IDX707"></a> |
| <a name="IDX708"></a> |
| <p>Sort output by file location. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC131"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC127">9.4.8 Informative output</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-h</samp>’</dt> |
| <dt> ‘<samp>--help</samp>’</dt> |
| <dd><a name="IDX709"></a> |
| <a name="IDX710"></a> |
| <p>Display this help and exit. |
| </p> |
| </dd> |
| <dt> ‘<samp>-V</samp>’</dt> |
| <dt> ‘<samp>--version</samp>’</dt> |
| <dd><a name="IDX711"></a> |
| <a name="IDX712"></a> |
| <p>Output version information and exit. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC132"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC128">9.4.9 Examples</a> </h3> |
|
|
| <p>To convert German translations to Swiss orthography (in an UTF-8 locale): |
| </p> |
| <table><tr><td> </td><td><pre class="smallexample">msgconv -t UTF-8 de.po | msgfilter sed -e 's/ß/ss/g' |
| </pre></td></tr></table> |
|
|
| <p>To convert Serbian translations in Cyrillic script to Latin script: |
| </p> |
| <table><tr><td> </td><td><pre class="smallexample">msgfilter recode-sr-latin < sr.po |
| </pre></td></tr></table> |
|
|
|
|
| <a name="msguniq-Invocation"></a> |
| <a name="SEC133"></a> |
| <h2 class="section"> <a href="gettext_toc.html#TOC129">9.5 Invoking the <code>msguniq</code> Program</a> </h2> |
|
|
|
|
| <table><tr><td> </td><td><pre class="example">msguniq [<var>option</var>] [<var>inputfile</var>] |
| </pre></td></tr></table> |
|
|
| <a name="IDX713"></a> |
| <a name="IDX714"></a> |
| <p>The <code>msguniq</code> program unifies duplicate translations in a translation |
| catalog. It finds duplicate translations of the same message ID. Such |
| duplicates are invalid input for other programs like <code>msgfmt</code>, |
| <code>msgmerge</code> or <code>msgcat</code>. By default, duplicates are merged |
| together. When using the ‘<samp>--repeated</samp>’ option, only duplicates are |
| output, and all other messages are discarded. Comments and extracted |
| comments will be cumulated, except that if ‘<samp>--use-first</samp>’ is |
| specified, they will be taken from the first translation. File positions |
| will be cumulated. When using the ‘<samp>--unique</samp>’ option, duplicates are |
| discarded. |
| </p> |
|
|
| <a name="SEC134"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC130">9.5.1 Input file location</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp><var>inputfile</var></samp>’</dt> |
| <dd><p>Input PO file. |
| </p> |
| </dd> |
| <dt> ‘<samp>-D <var>directory</var></samp>’</dt> |
| <dt> ‘<samp>--directory=<var>directory</var></samp>’</dt> |
| <dd><a name="IDX715"></a> |
| <a name="IDX716"></a> |
| <p>Add <var>directory</var> to the list of directories. Source files are |
| searched relative to this list of directories. The resulting ‘<tt>.po</tt>’ |
| file will be written relative to the current directory, though. |
| </p> |
| </dd> |
| </dl> |
|
|
| <p>If no <var>inputfile</var> is given or if it is ‘<samp>-</samp>’, standard input is read. |
| </p> |
|
|
| <a name="SEC135"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC131">9.5.2 Output file location</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-o <var>file</var></samp>’</dt> |
| <dt> ‘<samp>--output-file=<var>file</var></samp>’</dt> |
| <dd><a name="IDX717"></a> |
| <a name="IDX718"></a> |
| <p>Write output to specified file. |
| </p> |
| </dd> |
| </dl> |
|
|
| <p>The results are written to standard output if no output file is specified |
| or if it is ‘<samp>-</samp>’. |
| </p> |
|
|
| <a name="SEC136"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC132">9.5.3 Message selection</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-d</samp>’</dt> |
| <dt> ‘<samp>--repeated</samp>’</dt> |
| <dd><a name="IDX719"></a> |
| <a name="IDX720"></a> |
| <p>Print only duplicates. |
| </p> |
| </dd> |
| <dt> ‘<samp>-u</samp>’</dt> |
| <dt> ‘<samp>--unique</samp>’</dt> |
| <dd><a name="IDX721"></a> |
| <a name="IDX722"></a> |
| <p>Print only unique messages, discard duplicates. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC137"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC133">9.5.4 Input file syntax</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-P</samp>’</dt> |
| <dt> ‘<samp>--properties-input</samp>’</dt> |
| <dd><a name="IDX723"></a> |
| <a name="IDX724"></a> |
| <p>Assume the input file is a Java ResourceBundle in Java <code>.properties</code> |
| syntax, not in PO file syntax. |
| </p> |
| </dd> |
| <dt> ‘<samp>--stringtable-input</samp>’</dt> |
| <dd><a name="IDX725"></a> |
| <p>Assume the input file is a NeXTstep/GNUstep localized resource file in |
| <code>.strings</code> syntax, not in PO file syntax. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC138"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC134">9.5.5 Output details</a> </h3> |
|
|
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-t</samp>’</dt> |
| <dt> ‘<samp>--to-code=<var>name</var></samp>’</dt> |
| <dd><a name="IDX726"></a> |
| <a name="IDX727"></a> |
| <p>Specify encoding for output. |
| </p> |
| </dd> |
| <dt> ‘<samp>--use-first</samp>’</dt> |
| <dd><a name="IDX728"></a> |
| <p>Use first available translation for each message. Don't merge several |
| translations into one. |
| </p> |
| </dd> |
| <dt> ‘<samp>--color</samp>’</dt> |
| <dt> ‘<samp>--color=<var>when</var></samp>’</dt> |
| <dd><a name="IDX729"></a> |
| <p>Specify whether or when to use colors and other text attributes. |
| See <a href="#SEC171">The <code>--color</code> option</a> for details. |
| </p> |
| </dd> |
| <dt> ‘<samp>--style=<var>style_file</var></samp>’</dt> |
| <dd><a name="IDX730"></a> |
| <p>Specify the CSS style rule file to use for <code>--color</code>. |
| See <a href="#SEC173">The <code>--style</code> option</a> for details. |
| </p> |
| </dd> |
| <dt> ‘<samp>--force-po</samp>’</dt> |
| <dd><a name="IDX731"></a> |
| <p>Always write an output file even if it contains no message. |
| </p> |
| </dd> |
| <dt> ‘<samp>-i</samp>’</dt> |
| <dt> ‘<samp>--indent</samp>’</dt> |
| <dd><a name="IDX732"></a> |
| <a name="IDX733"></a> |
| <p>Write the .po file using indented style. |
| </p> |
| </dd> |
| <dt> ‘<samp>--no-location</samp>’</dt> |
| <dd><a name="IDX734"></a> |
| <p>Do not write ‘<samp>#: <var>filename</var>:<var>line</var></samp>’ lines. |
| </p> |
| </dd> |
| <dt> ‘<samp>-n</samp>’</dt> |
| <dt> ‘<samp>--add-location=<var>type</var></samp>’</dt> |
| <dd><a name="IDX735"></a> |
| <a name="IDX736"></a> |
| <p>Generate ‘<samp>#: <var>filename</var>:<var>line</var></samp>’ lines (default). |
| </p> |
| <p>The optional <var>type</var> can be either ‘<samp>full</samp>’, ‘<samp>file</samp>’, or |
| ‘<samp>never</samp>’. If it is not given or ‘<samp>full</samp>’, it generates the |
| lines with both file name and line number. If it is ‘<samp>file</samp>’, the |
| line number part is omitted. If it is ‘<samp>never</samp>’, it completely |
| suppresses the lines (same as <code>--no-location</code>). |
| </p> |
| </dd> |
| <dt> ‘<samp>--strict</samp>’</dt> |
| <dd><a name="IDX737"></a> |
| <p>Write out a strict Uniforum conforming PO file. Note that this |
| Uniforum format should be avoided because it doesn't support the |
| GNU extensions. |
| </p> |
| </dd> |
| <dt> ‘<samp>-p</samp>’</dt> |
| <dt> ‘<samp>--properties-output</samp>’</dt> |
| <dd><a name="IDX738"></a> |
| <a name="IDX739"></a> |
| <p>Write out a Java ResourceBundle in Java <code>.properties</code> syntax. Note |
| that this file format doesn't support plural forms and silently drops |
| obsolete messages. |
| </p> |
| </dd> |
| <dt> ‘<samp>--stringtable-output</samp>’</dt> |
| <dd><a name="IDX740"></a> |
| <p>Write out a NeXTstep/GNUstep localized resource file in <code>.strings</code> syntax. |
| Note that this file format doesn't support plural forms. |
| </p> |
| </dd> |
| <dt> ‘<samp>-w <var>number</var></samp>’</dt> |
| <dt> ‘<samp>--width=<var>number</var></samp>’</dt> |
| <dd><a name="IDX741"></a> |
| <a name="IDX742"></a> |
| <p>Set the output page width. Long strings in the output files will be |
| split across multiple lines in order to ensure that each line's width |
| (= number of screen columns) is less or equal to the given <var>number</var>. |
| </p> |
| </dd> |
| <dt> ‘<samp>--no-wrap</samp>’</dt> |
| <dd><a name="IDX743"></a> |
| <p>Do not break long message lines. Message lines whose width exceeds the |
| output page width will not be split into several lines. Only file reference |
| lines which are wider than the output page width will be split. |
| </p> |
| </dd> |
| <dt> ‘<samp>-s</samp>’</dt> |
| <dt> ‘<samp>--sort-output</samp>’</dt> |
| <dd><a name="IDX744"></a> |
| <a name="IDX745"></a> |
| <p>Generate sorted output. Note that using this option makes it much harder |
| for the translator to understand each message's context. |
| </p> |
| </dd> |
| <dt> ‘<samp>-F</samp>’</dt> |
| <dt> ‘<samp>--sort-by-file</samp>’</dt> |
| <dd><a name="IDX746"></a> |
| <a name="IDX747"></a> |
| <p>Sort output by file location. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC139"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC135">9.5.6 Informative output</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-h</samp>’</dt> |
| <dt> ‘<samp>--help</samp>’</dt> |
| <dd><a name="IDX748"></a> |
| <a name="IDX749"></a> |
| <p>Display this help and exit. |
| </p> |
| </dd> |
| <dt> ‘<samp>-V</samp>’</dt> |
| <dt> ‘<samp>--version</samp>’</dt> |
| <dd><a name="IDX750"></a> |
| <a name="IDX751"></a> |
| <p>Output version information and exit. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="msgcomm-Invocation"></a> |
| <a name="SEC140"></a> |
| <h2 class="section"> <a href="gettext_toc.html#TOC136">9.6 Invoking the <code>msgcomm</code> Program</a> </h2> |
|
|
|
|
| <table><tr><td> </td><td><pre class="example">msgcomm [<var>option</var>] [<var>inputfile</var>]... |
| </pre></td></tr></table> |
|
|
| <a name="IDX752"></a> |
| <p>The <code>msgcomm</code> program finds messages which are common to two or more |
| of the specified PO files. |
| By using the <code>--more-than</code> option, greater commonality may be requested |
| before messages are printed. Conversely, the <code>--less-than</code> option may be |
| used to specify less commonality before messages are printed (i.e. |
| ‘<samp>--less-than=2</samp>’ will only print the unique messages). Translations, |
| comments and extracted comments will be preserved, but only from the first |
| PO file to define them. File positions from all PO files will be |
| cumulated. |
| </p> |
|
|
| <a name="SEC141"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC137">9.6.1 Input file location</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp><var>inputfile</var> …</samp>’</dt> |
| <dd><p>Input files. |
| </p> |
| </dd> |
| <dt> ‘<samp>-f <var>file</var></samp>’</dt> |
| <dt> ‘<samp>--files-from=<var>file</var></samp>’</dt> |
| <dd><a name="IDX753"></a> |
| <a name="IDX754"></a> |
| <p>Read the names of the input files from <var>file</var> instead of getting |
| them from the command line. |
| </p> |
| </dd> |
| <dt> ‘<samp>-D <var>directory</var></samp>’</dt> |
| <dt> ‘<samp>--directory=<var>directory</var></samp>’</dt> |
| <dd><a name="IDX755"></a> |
| <a name="IDX756"></a> |
| <p>Add <var>directory</var> to the list of directories. Source files are |
| searched relative to this list of directories. The resulting ‘<tt>.po</tt>’ |
| file will be written relative to the current directory, though. |
| </p> |
| </dd> |
| </dl> |
|
|
| <p>If <var>inputfile</var> is ‘<samp>-</samp>’, standard input is read. |
| </p> |
|
|
| <a name="SEC142"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC138">9.6.2 Output file location</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-o <var>file</var></samp>’</dt> |
| <dt> ‘<samp>--output-file=<var>file</var></samp>’</dt> |
| <dd><a name="IDX757"></a> |
| <a name="IDX758"></a> |
| <p>Write output to specified file. |
| </p> |
| </dd> |
| </dl> |
|
|
| <p>The results are written to standard output if no output file is specified |
| or if it is ‘<samp>-</samp>’. |
| </p> |
|
|
| <a name="SEC143"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC139">9.6.3 Message selection</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-< <var>number</var></samp>’</dt> |
| <dt> ‘<samp>--less-than=<var>number</var></samp>’</dt> |
| <dd><a name="IDX759"></a> |
| <a name="IDX760"></a> |
| <p>Print messages with less than <var>number</var> definitions, defaults to infinite |
| if not set. |
| </p> |
| </dd> |
| <dt> ‘<samp>-> <var>number</var></samp>’</dt> |
| <dt> ‘<samp>--more-than=<var>number</var></samp>’</dt> |
| <dd><a name="IDX761"></a> |
| <a name="IDX762"></a> |
| <p>Print messages with more than <var>number</var> definitions, defaults to 1 if not |
| set. |
| </p> |
| </dd> |
| <dt> ‘<samp>-u</samp>’</dt> |
| <dt> ‘<samp>--unique</samp>’</dt> |
| <dd><a name="IDX763"></a> |
| <a name="IDX764"></a> |
| <p>Shorthand for ‘<samp>--less-than=2</samp>’. Requests that only unique messages be |
| printed. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC144"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC140">9.6.4 Input file syntax</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-P</samp>’</dt> |
| <dt> ‘<samp>--properties-input</samp>’</dt> |
| <dd><a name="IDX765"></a> |
| <a name="IDX766"></a> |
| <p>Assume the input files are Java ResourceBundles in Java <code>.properties</code> |
| syntax, not in PO file syntax. |
| </p> |
| </dd> |
| <dt> ‘<samp>--stringtable-input</samp>’</dt> |
| <dd><a name="IDX767"></a> |
| <p>Assume the input files are NeXTstep/GNUstep localized resource files in |
| <code>.strings</code> syntax, not in PO file syntax. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC145"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC141">9.6.5 Output details</a> </h3> |
|
|
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>--color</samp>’</dt> |
| <dt> ‘<samp>--color=<var>when</var></samp>’</dt> |
| <dd><a name="IDX768"></a> |
| <p>Specify whether or when to use colors and other text attributes. |
| See <a href="#SEC171">The <code>--color</code> option</a> for details. |
| </p> |
| </dd> |
| <dt> ‘<samp>--style=<var>style_file</var></samp>’</dt> |
| <dd><a name="IDX769"></a> |
| <p>Specify the CSS style rule file to use for <code>--color</code>. |
| See <a href="#SEC173">The <code>--style</code> option</a> for details. |
| </p> |
| </dd> |
| <dt> ‘<samp>--force-po</samp>’</dt> |
| <dd><a name="IDX770"></a> |
| <p>Always write an output file even if it contains no message. |
| </p> |
| </dd> |
| <dt> ‘<samp>-i</samp>’</dt> |
| <dt> ‘<samp>--indent</samp>’</dt> |
| <dd><a name="IDX771"></a> |
| <a name="IDX772"></a> |
| <p>Write the .po file using indented style. |
| </p> |
| </dd> |
| <dt> ‘<samp>--no-location</samp>’</dt> |
| <dd><a name="IDX773"></a> |
| <p>Do not write ‘<samp>#: <var>filename</var>:<var>line</var></samp>’ lines. |
| </p> |
| </dd> |
| <dt> ‘<samp>-n</samp>’</dt> |
| <dt> ‘<samp>--add-location=<var>type</var></samp>’</dt> |
| <dd><a name="IDX774"></a> |
| <a name="IDX775"></a> |
| <p>Generate ‘<samp>#: <var>filename</var>:<var>line</var></samp>’ lines (default). |
| </p> |
| <p>The optional <var>type</var> can be either ‘<samp>full</samp>’, ‘<samp>file</samp>’, or |
| ‘<samp>never</samp>’. If it is not given or ‘<samp>full</samp>’, it generates the |
| lines with both file name and line number. If it is ‘<samp>file</samp>’, the |
| line number part is omitted. If it is ‘<samp>never</samp>’, it completely |
| suppresses the lines (same as <code>--no-location</code>). |
| </p> |
| </dd> |
| <dt> ‘<samp>--strict</samp>’</dt> |
| <dd><a name="IDX776"></a> |
| <p>Write out a strict Uniforum conforming PO file. Note that this |
| Uniforum format should be avoided because it doesn't support the |
| GNU extensions. |
| </p> |
| </dd> |
| <dt> ‘<samp>-p</samp>’</dt> |
| <dt> ‘<samp>--properties-output</samp>’</dt> |
| <dd><a name="IDX777"></a> |
| <a name="IDX778"></a> |
| <p>Write out a Java ResourceBundle in Java <code>.properties</code> syntax. Note |
| that this file format doesn't support plural forms and silently drops |
| obsolete messages. |
| </p> |
| </dd> |
| <dt> ‘<samp>--stringtable-output</samp>’</dt> |
| <dd><a name="IDX779"></a> |
| <p>Write out a NeXTstep/GNUstep localized resource file in <code>.strings</code> syntax. |
| Note that this file format doesn't support plural forms. |
| </p> |
| </dd> |
| <dt> ‘<samp>-w <var>number</var></samp>’</dt> |
| <dt> ‘<samp>--width=<var>number</var></samp>’</dt> |
| <dd><a name="IDX780"></a> |
| <a name="IDX781"></a> |
| <p>Set the output page width. Long strings in the output files will be |
| split across multiple lines in order to ensure that each line's width |
| (= number of screen columns) is less or equal to the given <var>number</var>. |
| </p> |
| </dd> |
| <dt> ‘<samp>--no-wrap</samp>’</dt> |
| <dd><a name="IDX782"></a> |
| <p>Do not break long message lines. Message lines whose width exceeds the |
| output page width will not be split into several lines. Only file reference |
| lines which are wider than the output page width will be split. |
| </p> |
| </dd> |
| <dt> ‘<samp>-s</samp>’</dt> |
| <dt> ‘<samp>--sort-output</samp>’</dt> |
| <dd><a name="IDX783"></a> |
| <a name="IDX784"></a> |
| <p>Generate sorted output. Note that using this option makes it much harder |
| for the translator to understand each message's context. |
| </p> |
| </dd> |
| <dt> ‘<samp>-F</samp>’</dt> |
| <dt> ‘<samp>--sort-by-file</samp>’</dt> |
| <dd><a name="IDX785"></a> |
| <a name="IDX786"></a> |
| <p>Sort output by file location. |
| </p> |
| </dd> |
| <dt> ‘<samp>--omit-header</samp>’</dt> |
| <dd><a name="IDX787"></a> |
| <p>Don't write header with ‘<samp>msgid ""</samp>’ entry. |
| Note: Using this option may lead to an error in subsequent operations |
| if the output contains non-ASCII characters. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC146"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC142">9.6.6 Informative output</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-h</samp>’</dt> |
| <dt> ‘<samp>--help</samp>’</dt> |
| <dd><a name="IDX788"></a> |
| <a name="IDX789"></a> |
| <p>Display this help and exit. |
| </p> |
| </dd> |
| <dt> ‘<samp>-V</samp>’</dt> |
| <dt> ‘<samp>--version</samp>’</dt> |
| <dd><a name="IDX790"></a> |
| <a name="IDX791"></a> |
| <p>Output version information and exit. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="msgcmp-Invocation"></a> |
| <a name="SEC147"></a> |
| <h2 class="section"> <a href="gettext_toc.html#TOC143">9.7 Invoking the <code>msgcmp</code> Program</a> </h2> |
|
|
|
|
| <table><tr><td> </td><td><pre class="example">msgcmp [<var>option</var>] <var>def</var>.po <var>ref</var>.pot |
| </pre></td></tr></table> |
|
|
| <a name="IDX792"></a> |
| <p>The <code>msgcmp</code> program compares two Uniforum style .po files to check that |
| both contain the same set of msgid strings. The <var>def</var>.po file is an |
| existing PO file with the translations. The <var>ref</var>.pot file is the last |
| created PO file, or a PO Template file (generally created by <code>xgettext</code>). |
| This is useful for checking that you have translated each and every message |
| in your program. Where an exact match cannot be found, fuzzy matching is |
| used to produce better diagnostics. |
| </p> |
|
|
| <a name="SEC148"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC144">9.7.1 Input file location</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp><var>def</var>.po</samp>’</dt> |
| <dd><p>Translations. |
| </p> |
| </dd> |
| <dt> ‘<samp><var>ref</var>.pot</samp>’</dt> |
| <dd><p>References to the sources. |
| </p> |
| </dd> |
| <dt> ‘<samp>-D <var>directory</var></samp>’</dt> |
| <dt> ‘<samp>--directory=<var>directory</var></samp>’</dt> |
| <dd><a name="IDX793"></a> |
| <a name="IDX794"></a> |
| <p>Add <var>directory</var> to the list of directories. Source files are |
| searched relative to this list of directories. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC149"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC145">9.7.2 Operation modifiers</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-m</samp>’</dt> |
| <dt> ‘<samp>--multi-domain</samp>’</dt> |
| <dd><a name="IDX795"></a> |
| <a name="IDX796"></a> |
| <p>Apply <var>ref</var>.pot to each of the domains in <var>def</var>.po. |
| </p> |
| </dd> |
| <dt> ‘<samp>-N</samp>’</dt> |
| <dt> ‘<samp>--no-fuzzy-matching</samp>’</dt> |
| <dd><a name="IDX797"></a> |
| <a name="IDX798"></a> |
| <p>Do not use fuzzy matching when an exact match is not found. This may speed |
| up the operation considerably. |
| </p> |
| </dd> |
| <dt> ‘<samp>--use-fuzzy</samp>’</dt> |
| <dd><a name="IDX799"></a> |
| <p>Consider fuzzy messages in the <var>def</var>.po file like translated messages. |
| Note that using this option is usually wrong, because fuzzy messages are |
| exactly those which have not been validated by a human translator. |
| </p> |
| </dd> |
| <dt> ‘<samp>--use-untranslated</samp>’</dt> |
| <dd><a name="IDX800"></a> |
| <p>Consider untranslated messages in the <var>def</var>.po file like translated |
| messages. Note that using this option is usually wrong. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC150"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC146">9.7.3 Input file syntax</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-P</samp>’</dt> |
| <dt> ‘<samp>--properties-input</samp>’</dt> |
| <dd><a name="IDX801"></a> |
| <a name="IDX802"></a> |
| <p>Assume the input files are Java ResourceBundles in Java <code>.properties</code> |
| syntax, not in PO file syntax. |
| </p> |
| </dd> |
| <dt> ‘<samp>--stringtable-input</samp>’</dt> |
| <dd><a name="IDX803"></a> |
| <p>Assume the input files are NeXTstep/GNUstep localized resource files in |
| <code>.strings</code> syntax, not in PO file syntax. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC151"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC147">9.7.4 Informative output</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-h</samp>’</dt> |
| <dt> ‘<samp>--help</samp>’</dt> |
| <dd><a name="IDX804"></a> |
| <a name="IDX805"></a> |
| <p>Display this help and exit. |
| </p> |
| </dd> |
| <dt> ‘<samp>-V</samp>’</dt> |
| <dt> ‘<samp>--version</samp>’</dt> |
| <dd><a name="IDX806"></a> |
| <a name="IDX807"></a> |
| <p>Output version information and exit. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="msgattrib-Invocation"></a> |
| <a name="SEC152"></a> |
| <h2 class="section"> <a href="gettext_toc.html#TOC148">9.8 Invoking the <code>msgattrib</code> Program</a> </h2> |
|
|
|
|
| <table><tr><td> </td><td><pre class="example">msgattrib [<var>option</var>] [<var>inputfile</var>] |
| </pre></td></tr></table> |
|
|
| <a name="IDX808"></a> |
| <a name="IDX809"></a> |
| <p>The <code>msgattrib</code> program filters the messages of a translation catalog |
| according to their attributes, and manipulates the attributes. |
| </p> |
|
|
| <a name="SEC153"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC149">9.8.1 Input file location</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp><var>inputfile</var></samp>’</dt> |
| <dd><p>Input PO file. |
| </p> |
| </dd> |
| <dt> ‘<samp>-D <var>directory</var></samp>’</dt> |
| <dt> ‘<samp>--directory=<var>directory</var></samp>’</dt> |
| <dd><a name="IDX810"></a> |
| <a name="IDX811"></a> |
| <p>Add <var>directory</var> to the list of directories. Source files are |
| searched relative to this list of directories. The resulting ‘<tt>.po</tt>’ |
| file will be written relative to the current directory, though. |
| </p> |
| </dd> |
| </dl> |
|
|
| <p>If no <var>inputfile</var> is given or if it is ‘<samp>-</samp>’, standard input is read. |
| </p> |
|
|
| <a name="SEC154"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC150">9.8.2 Output file location</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-o <var>file</var></samp>’</dt> |
| <dt> ‘<samp>--output-file=<var>file</var></samp>’</dt> |
| <dd><a name="IDX812"></a> |
| <a name="IDX813"></a> |
| <p>Write output to specified file. |
| </p> |
| </dd> |
| </dl> |
|
|
| <p>The results are written to standard output if no output file is specified |
| or if it is ‘<samp>-</samp>’. |
| </p> |
|
|
| <a name="SEC155"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC151">9.8.3 Message selection</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>--translated</samp>’</dt> |
| <dd><a name="IDX814"></a> |
| <p>Keep translated messages, remove untranslated messages. |
| </p> |
| </dd> |
| <dt> ‘<samp>--untranslated</samp>’</dt> |
| <dd><a name="IDX815"></a> |
| <p>Keep untranslated messages, remove translated messages. |
| </p> |
| </dd> |
| <dt> ‘<samp>--no-fuzzy</samp>’</dt> |
| <dd><a name="IDX816"></a> |
| <p>Remove |
| ‘fuzzy’ |
| marked messages. |
| </p> |
| </dd> |
| <dt> ‘<samp>--only-fuzzy</samp>’</dt> |
| <dd><a name="IDX817"></a> |
| <p>Keep |
| ‘fuzzy’ |
| marked messages, remove all other messages. |
| </p> |
| </dd> |
| <dt> ‘<samp>--no-obsolete</samp>’</dt> |
| <dd><a name="IDX818"></a> |
| <p>Remove obsolete #~ messages. |
| </p> |
| </dd> |
| <dt> ‘<samp>--only-obsolete</samp>’</dt> |
| <dd><a name="IDX819"></a> |
| <p>Keep obsolete #~ messages, remove all other messages. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC156"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC152">9.8.4 Attribute manipulation</a> </h3> |
|
|
| <p>Attributes are modified after the message selection/removal has been |
| performed. If the ‘<samp>--only-file</samp>’ or ‘<samp>--ignore-file</samp>’ option is |
| specified, the attribute modification is applied only to those messages |
| that are listed in the <var>only-file</var> and not listed in the |
| <var>ignore-file</var>. |
| </p> |
| <dl compact="compact"> |
| <dt> ‘<samp>--set-fuzzy</samp>’</dt> |
| <dd><a name="IDX820"></a> |
| <p>Set all messages |
| ‘fuzzy’. |
| </p> |
| </dd> |
| <dt> ‘<samp>--clear-fuzzy</samp>’</dt> |
| <dd><a name="IDX821"></a> |
| <p>Set all messages |
| non-‘fuzzy’. |
| </p> |
| </dd> |
| <dt> ‘<samp>--set-obsolete</samp>’</dt> |
| <dd><a name="IDX822"></a> |
| <p>Set all messages obsolete. |
| </p> |
| </dd> |
| <dt> ‘<samp>--clear-obsolete</samp>’</dt> |
| <dd><a name="IDX823"></a> |
| <p>Set all messages non-obsolete. |
| </p> |
| </dd> |
| <dt> ‘<samp>--previous</samp>’</dt> |
| <dd><a name="IDX824"></a> |
| <p>When setting |
| ‘fuzzy’ |
| mark, keep “previous msgid” of translated messages. |
| </p> |
| </dd> |
| <dt> ‘<samp>--clear-previous</samp>’</dt> |
| <dd><a name="IDX825"></a> |
| <p>Remove the “previous msgid” (‘<samp>#|</samp>’) comments from all messages. |
| </p> |
| </dd> |
| <dt> ‘<samp>--empty</samp>’</dt> |
| <dd><a name="IDX826"></a> |
| <p>When removing |
| ‘fuzzy’ |
| mark, also set msgstr empty. |
| </p> |
| </dd> |
| <dt> ‘<samp>--only-file=<var>file</var></samp>’</dt> |
| <dd><a name="IDX827"></a> |
| <p>Limit the attribute changes to entries that are listed in <var>file</var>. |
| <var>file</var> should be a PO or POT file. |
| </p> |
| </dd> |
| <dt> ‘<samp>--ignore-file=<var>file</var></samp>’</dt> |
| <dd><a name="IDX828"></a> |
| <p>Limit the attribute changes to entries that are not listed in <var>file</var>. |
| <var>file</var> should be a PO or POT file. |
| </p> |
| </dd> |
| <dt> ‘<samp>--fuzzy</samp>’</dt> |
| <dd><a name="IDX829"></a> |
| <p>Synonym for ‘<samp>--only-fuzzy --clear-fuzzy</samp>’: It keeps only the fuzzy |
| messages and removes their |
| ‘fuzzy’ |
| mark. |
| </p> |
| </dd> |
| <dt> ‘<samp>--obsolete</samp>’</dt> |
| <dd><a name="IDX830"></a> |
| <p>Synonym for ‘<samp>--only-obsolete --clear-obsolete</samp>’: It keeps only the |
| obsolete messages and makes them non-obsolete. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC157"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC153">9.8.5 Input file syntax</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-P</samp>’</dt> |
| <dt> ‘<samp>--properties-input</samp>’</dt> |
| <dd><a name="IDX831"></a> |
| <a name="IDX832"></a> |
| <p>Assume the input file is a Java ResourceBundle in Java <code>.properties</code> |
| syntax, not in PO file syntax. |
| </p> |
| </dd> |
| <dt> ‘<samp>--stringtable-input</samp>’</dt> |
| <dd><a name="IDX833"></a> |
| <p>Assume the input file is a NeXTstep/GNUstep localized resource file in |
| <code>.strings</code> syntax, not in PO file syntax. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC158"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC154">9.8.6 Output details</a> </h3> |
|
|
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>--color</samp>’</dt> |
| <dt> ‘<samp>--color=<var>when</var></samp>’</dt> |
| <dd><a name="IDX834"></a> |
| <p>Specify whether or when to use colors and other text attributes. |
| See <a href="#SEC171">The <code>--color</code> option</a> for details. |
| </p> |
| </dd> |
| <dt> ‘<samp>--style=<var>style_file</var></samp>’</dt> |
| <dd><a name="IDX835"></a> |
| <p>Specify the CSS style rule file to use for <code>--color</code>. |
| See <a href="#SEC173">The <code>--style</code> option</a> for details. |
| </p> |
| </dd> |
| <dt> ‘<samp>--force-po</samp>’</dt> |
| <dd><a name="IDX836"></a> |
| <p>Always write an output file even if it contains no message. |
| </p> |
| </dd> |
| <dt> ‘<samp>-i</samp>’</dt> |
| <dt> ‘<samp>--indent</samp>’</dt> |
| <dd><a name="IDX837"></a> |
| <a name="IDX838"></a> |
| <p>Write the .po file using indented style. |
| </p> |
| </dd> |
| <dt> ‘<samp>--no-location</samp>’</dt> |
| <dd><a name="IDX839"></a> |
| <p>Do not write ‘<samp>#: <var>filename</var>:<var>line</var></samp>’ lines. |
| </p> |
| </dd> |
| <dt> ‘<samp>-n</samp>’</dt> |
| <dt> ‘<samp>--add-location=<var>type</var></samp>’</dt> |
| <dd><a name="IDX840"></a> |
| <a name="IDX841"></a> |
| <p>Generate ‘<samp>#: <var>filename</var>:<var>line</var></samp>’ lines (default). |
| </p> |
| <p>The optional <var>type</var> can be either ‘<samp>full</samp>’, ‘<samp>file</samp>’, or |
| ‘<samp>never</samp>’. If it is not given or ‘<samp>full</samp>’, it generates the |
| lines with both file name and line number. If it is ‘<samp>file</samp>’, the |
| line number part is omitted. If it is ‘<samp>never</samp>’, it completely |
| suppresses the lines (same as <code>--no-location</code>). |
| </p> |
| </dd> |
| <dt> ‘<samp>--strict</samp>’</dt> |
| <dd><a name="IDX842"></a> |
| <p>Write out a strict Uniforum conforming PO file. Note that this |
| Uniforum format should be avoided because it doesn't support the |
| GNU extensions. |
| </p> |
| </dd> |
| <dt> ‘<samp>-p</samp>’</dt> |
| <dt> ‘<samp>--properties-output</samp>’</dt> |
| <dd><a name="IDX843"></a> |
| <a name="IDX844"></a> |
| <p>Write out a Java ResourceBundle in Java <code>.properties</code> syntax. Note |
| that this file format doesn't support plural forms and silently drops |
| obsolete messages. |
| </p> |
| </dd> |
| <dt> ‘<samp>--stringtable-output</samp>’</dt> |
| <dd><a name="IDX845"></a> |
| <p>Write out a NeXTstep/GNUstep localized resource file in <code>.strings</code> syntax. |
| Note that this file format doesn't support plural forms. |
| </p> |
| </dd> |
| <dt> ‘<samp>-w <var>number</var></samp>’</dt> |
| <dt> ‘<samp>--width=<var>number</var></samp>’</dt> |
| <dd><a name="IDX846"></a> |
| <a name="IDX847"></a> |
| <p>Set the output page width. Long strings in the output files will be |
| split across multiple lines in order to ensure that each line's width |
| (= number of screen columns) is less or equal to the given <var>number</var>. |
| </p> |
| </dd> |
| <dt> ‘<samp>--no-wrap</samp>’</dt> |
| <dd><a name="IDX848"></a> |
| <p>Do not break long message lines. Message lines whose width exceeds the |
| output page width will not be split into several lines. Only file reference |
| lines which are wider than the output page width will be split. |
| </p> |
| </dd> |
| <dt> ‘<samp>-s</samp>’</dt> |
| <dt> ‘<samp>--sort-output</samp>’</dt> |
| <dd><a name="IDX849"></a> |
| <a name="IDX850"></a> |
| <p>Generate sorted output. Note that using this option makes it much harder |
| for the translator to understand each message's context. |
| </p> |
| </dd> |
| <dt> ‘<samp>-F</samp>’</dt> |
| <dt> ‘<samp>--sort-by-file</samp>’</dt> |
| <dd><a name="IDX851"></a> |
| <a name="IDX852"></a> |
| <p>Sort output by file location. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC159"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC155">9.8.7 Informative output</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-h</samp>’</dt> |
| <dt> ‘<samp>--help</samp>’</dt> |
| <dd><a name="IDX853"></a> |
| <a name="IDX854"></a> |
| <p>Display this help and exit. |
| </p> |
| </dd> |
| <dt> ‘<samp>-V</samp>’</dt> |
| <dt> ‘<samp>--version</samp>’</dt> |
| <dd><a name="IDX855"></a> |
| <a name="IDX856"></a> |
| <p>Output version information and exit. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="msgen-Invocation"></a> |
| <a name="SEC160"></a> |
| <h2 class="section"> <a href="gettext_toc.html#TOC156">9.9 Invoking the <code>msgen</code> Program</a> </h2> |
|
|
|
|
| <table><tr><td> </td><td><pre class="example">msgen [<var>option</var>] <var>inputfile</var> |
| </pre></td></tr></table> |
|
|
| <a name="IDX857"></a> |
| <p>The <code>msgen</code> program creates an English translation catalog. The |
| input file is the last created English PO file, or a PO Template file |
| (generally created by xgettext). Untranslated entries are assigned a |
| translation that is identical to the msgid. |
| </p> |
| <p>Note: ‘<samp>msginit --no-translator --locale=en</samp>’ performs a very similar |
| task. The main difference is that <code>msginit</code> cares specially about |
| the header entry, whereas <code>msgen</code> doesn't. |
| </p> |
|
|
| <a name="SEC161"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC157">9.9.1 Input file location</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp><var>inputfile</var></samp>’</dt> |
| <dd><p>Input PO or POT file. |
| </p> |
| </dd> |
| <dt> ‘<samp>-D <var>directory</var></samp>’</dt> |
| <dt> ‘<samp>--directory=<var>directory</var></samp>’</dt> |
| <dd><a name="IDX858"></a> |
| <a name="IDX859"></a> |
| <p>Add <var>directory</var> to the list of directories. Source files are |
| searched relative to this list of directories. The resulting ‘<tt>.po</tt>’ |
| file will be written relative to the current directory, though. |
| </p> |
| </dd> |
| </dl> |
|
|
| <p>If <var>inputfile</var> is ‘<samp>-</samp>’, standard input is read. |
| </p> |
|
|
| <a name="SEC162"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC158">9.9.2 Output file location</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-o <var>file</var></samp>’</dt> |
| <dt> ‘<samp>--output-file=<var>file</var></samp>’</dt> |
| <dd><a name="IDX860"></a> |
| <a name="IDX861"></a> |
| <p>Write output to specified file. |
| </p> |
| </dd> |
| </dl> |
|
|
| <p>The results are written to standard output if no output file is specified |
| or if it is ‘<samp>-</samp>’. |
| </p> |
|
|
| <a name="SEC163"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC159">9.9.3 Input file syntax</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-P</samp>’</dt> |
| <dt> ‘<samp>--properties-input</samp>’</dt> |
| <dd><a name="IDX862"></a> |
| <a name="IDX863"></a> |
| <p>Assume the input file is a Java ResourceBundle in Java <code>.properties</code> |
| syntax, not in PO file syntax. |
| </p> |
| </dd> |
| <dt> ‘<samp>--stringtable-input</samp>’</dt> |
| <dd><a name="IDX864"></a> |
| <p>Assume the input file is a NeXTstep/GNUstep localized resource file in |
| <code>.strings</code> syntax, not in PO file syntax. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC164"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC160">9.9.4 Output details</a> </h3> |
|
|
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>--lang=<var>catalogname</var></samp>’</dt> |
| <dd><a name="IDX865"></a> |
| <p>Specify the ‘<samp>Language</samp>’ field to be used in the header entry. See |
| <a href="gettext_6.html#SEC60">Filling in the Header Entry</a> for the meaning of this field. Note: The |
| ‘<samp>Language-Team</samp>’ and ‘<samp>Plural-Forms</samp>’ fields are not set by this |
| option. |
| </p> |
| </dd> |
| <dt> ‘<samp>--color</samp>’</dt> |
| <dt> ‘<samp>--color=<var>when</var></samp>’</dt> |
| <dd><a name="IDX866"></a> |
| <p>Specify whether or when to use colors and other text attributes. |
| See <a href="#SEC171">The <code>--color</code> option</a> for details. |
| </p> |
| </dd> |
| <dt> ‘<samp>--style=<var>style_file</var></samp>’</dt> |
| <dd><a name="IDX867"></a> |
| <p>Specify the CSS style rule file to use for <code>--color</code>. |
| See <a href="#SEC173">The <code>--style</code> option</a> for details. |
| </p> |
| </dd> |
| <dt> ‘<samp>--force-po</samp>’</dt> |
| <dd><a name="IDX868"></a> |
| <p>Always write an output file even if it contains no message. |
| </p> |
| </dd> |
| <dt> ‘<samp>-i</samp>’</dt> |
| <dt> ‘<samp>--indent</samp>’</dt> |
| <dd><a name="IDX869"></a> |
| <a name="IDX870"></a> |
| <p>Write the .po file using indented style. |
| </p> |
| </dd> |
| <dt> ‘<samp>--no-location</samp>’</dt> |
| <dd><a name="IDX871"></a> |
| <p>Do not write ‘<samp>#: <var>filename</var>:<var>line</var></samp>’ lines. |
| </p> |
| </dd> |
| <dt> ‘<samp>-n</samp>’</dt> |
| <dt> ‘<samp>--add-location=<var>type</var></samp>’</dt> |
| <dd><a name="IDX872"></a> |
| <p>Generate ‘<samp>#: <var>filename</var>:<var>line</var></samp>’ lines (default). |
| </p> |
| <p>The optional <var>type</var> can be either ‘<samp>full</samp>’, ‘<samp>file</samp>’, or |
| ‘<samp>never</samp>’. If it is not given or ‘<samp>full</samp>’, it generates the |
| lines with both file name and line number. If it is ‘<samp>file</samp>’, the |
| line number part is omitted. If it is ‘<samp>never</samp>’, it completely |
| suppresses the lines (same as <code>--no-location</code>). |
| </p> |
| </dd> |
| <dt> ‘<samp>--strict</samp>’</dt> |
| <dd><a name="IDX873"></a> |
| <p>Write out a strict Uniforum conforming PO file. Note that this |
| Uniforum format should be avoided because it doesn't support the |
| GNU extensions. |
| </p> |
| </dd> |
| <dt> ‘<samp>-p</samp>’</dt> |
| <dt> ‘<samp>--properties-output</samp>’</dt> |
| <dd><a name="IDX874"></a> |
| <a name="IDX875"></a> |
| <p>Write out a Java ResourceBundle in Java <code>.properties</code> syntax. Note |
| that this file format doesn't support plural forms and silently drops |
| obsolete messages. |
| </p> |
| </dd> |
| <dt> ‘<samp>--stringtable-output</samp>’</dt> |
| <dd><a name="IDX876"></a> |
| <p>Write out a NeXTstep/GNUstep localized resource file in <code>.strings</code> syntax. |
| Note that this file format doesn't support plural forms. |
| </p> |
| </dd> |
| <dt> ‘<samp>-w <var>number</var></samp>’</dt> |
| <dt> ‘<samp>--width=<var>number</var></samp>’</dt> |
| <dd><a name="IDX877"></a> |
| <a name="IDX878"></a> |
| <p>Set the output page width. Long strings in the output files will be |
| split across multiple lines in order to ensure that each line's width |
| (= number of screen columns) is less or equal to the given <var>number</var>. |
| </p> |
| </dd> |
| <dt> ‘<samp>--no-wrap</samp>’</dt> |
| <dd><a name="IDX879"></a> |
| <p>Do not break long message lines. Message lines whose width exceeds the |
| output page width will not be split into several lines. Only file reference |
| lines which are wider than the output page width will be split. |
| </p> |
| </dd> |
| <dt> ‘<samp>-s</samp>’</dt> |
| <dt> ‘<samp>--sort-output</samp>’</dt> |
| <dd><a name="IDX880"></a> |
| <a name="IDX881"></a> |
| <p>Generate sorted output. Note that using this option makes it much harder |
| for the translator to understand each message's context. |
| </p> |
| </dd> |
| <dt> ‘<samp>-F</samp>’</dt> |
| <dt> ‘<samp>--sort-by-file</samp>’</dt> |
| <dd><a name="IDX882"></a> |
| <a name="IDX883"></a> |
| <p>Sort output by file location. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC165"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC161">9.9.5 Informative output</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-h</samp>’</dt> |
| <dt> ‘<samp>--help</samp>’</dt> |
| <dd><a name="IDX884"></a> |
| <a name="IDX885"></a> |
| <p>Display this help and exit. |
| </p> |
| </dd> |
| <dt> ‘<samp>-V</samp>’</dt> |
| <dt> ‘<samp>--version</samp>’</dt> |
| <dd><a name="IDX886"></a> |
| <a name="IDX887"></a> |
| <p>Output version information and exit. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="msgexec-Invocation"></a> |
| <a name="SEC166"></a> |
| <h2 class="section"> <a href="gettext_toc.html#TOC162">9.10 Invoking the <code>msgexec</code> Program</a> </h2> |
|
|
|
|
| <table><tr><td> </td><td><pre class="example">msgexec [<var>option</var>] <var>command</var> [<var>command-option</var>] |
| </pre></td></tr></table> |
|
|
| <a name="IDX888"></a> |
| <p>The <code>msgexec</code> program applies a command to all translations of a |
| translation catalog. |
| The <var>command</var> can be any program that reads a translation from standard |
| input. It is invoked once for each translation. Its output becomes |
| msgexec's output. <code>msgexec</code>'s return code is the maximum return code |
| across all invocations. |
| </p> |
| <a name="IDX889"></a> |
| <p>A special builtin command called ‘<samp>0</samp>’ outputs the translation, followed |
| by a null byte. The output of ‘<samp>msgexec 0</samp>’ is suitable as input for |
| ‘<samp>xargs -0</samp>’. |
| </p> |
| <dl compact="compact"> |
| <dt> ‘<samp>--newline</samp>’</dt> |
| <dd><a name="IDX890"></a> |
| <p>Add newline at the end of each input line. |
| </p> |
| </dd> |
| </dl> |
|
|
| <a name="IDX891"></a> |
| <a name="IDX892"></a> |
| <a name="IDX893"></a> |
| <a name="IDX894"></a> |
| <a name="IDX895"></a> |
| <a name="IDX896"></a> |
| <a name="IDX897"></a> |
| <a name="IDX898"></a> |
| <p>During each <var>command</var> invocation, the environment variable |
| <code>MSGEXEC_MSGID</code> is bound to the message's msgid, and the environment |
| variable <code>MSGEXEC_LOCATION</code> is bound to the location in the PO file |
| of the message. If the message has a context, the environment variable |
| <code>MSGEXEC_MSGCTXT</code> is bound to the message's msgctxt, otherwise it is |
| unbound. If the message has a plural form, environment variable |
| <code>MSGEXEC_MSGID_PLURAL</code> is bound to the message's msgid_plural and |
| <code>MSGEXEC_PLURAL_FORM</code> is bound to the order number of the plural |
| actually processed (starting with 0), otherwise both are unbound. |
| If the message has a previous msgid (added by <code>msgmerge</code>), |
| environment variable <code>MSGEXEC_PREV_MSGCTXT</code> is bound to the |
| message's previous msgctxt, <code>MSGEXEC_PREV_MSGID</code> is bound to |
| the previous msgid, and <code>MSGEXEC_PREV_MSGID_PLURAL</code> is bound to |
| the previous msgid_plural. |
| </p> |
| <a name="IDX899"></a> |
| <p>Note: It is your responsibility to ensure that the <var>command</var> can cope |
| with input encoded in the translation catalog's encoding. If the |
| <var>command</var> wants input in a particular encoding, you can in a first step |
| convert the translation catalog to that encoding using the ‘<samp>msgconv</samp>’ |
| program, before invoking ‘<samp>msgexec</samp>’. If the <var>command</var> wants input |
| in the locale's encoding, but you want to avoid the locale's encoding, then |
| you can first convert the translation catalog to UTF-8 using the |
| ‘<samp>msgconv</samp>’ program and then make ‘<samp>msgexec</samp>’ work in an UTF-8 |
| locale, by using the <code>LC_ALL</code> environment variable. |
| </p> |
|
|
| <a name="SEC167"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC163">9.10.1 Input file location</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-i <var>inputfile</var></samp>’</dt> |
| <dt> ‘<samp>--input=<var>inputfile</var></samp>’</dt> |
| <dd><a name="IDX900"></a> |
| <a name="IDX901"></a> |
| <p>Input PO file. |
| </p> |
| </dd> |
| <dt> ‘<samp>-D <var>directory</var></samp>’</dt> |
| <dt> ‘<samp>--directory=<var>directory</var></samp>’</dt> |
| <dd><a name="IDX902"></a> |
| <a name="IDX903"></a> |
| <p>Add <var>directory</var> to the list of directories. Source files are |
| searched relative to this list of directories. The resulting ‘<tt>.po</tt>’ |
| file will be written relative to the current directory, though. |
| </p> |
| </dd> |
| </dl> |
|
|
| <p>If no <var>inputfile</var> is given or if it is ‘<samp>-</samp>’, standard input is read. |
| </p> |
|
|
| <a name="SEC168"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC164">9.10.2 Input file syntax</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-P</samp>’</dt> |
| <dt> ‘<samp>--properties-input</samp>’</dt> |
| <dd><a name="IDX904"></a> |
| <a name="IDX905"></a> |
| <p>Assume the input file is a Java ResourceBundle in Java <code>.properties</code> |
| syntax, not in PO file syntax. |
| </p> |
| </dd> |
| <dt> ‘<samp>--stringtable-input</samp>’</dt> |
| <dd><a name="IDX906"></a> |
| <p>Assume the input file is a NeXTstep/GNUstep localized resource file in |
| <code>.strings</code> syntax, not in PO file syntax. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="SEC169"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC165">9.10.3 Informative output</a> </h3> |
|
|
| <dl compact="compact"> |
| <dt> ‘<samp>-h</samp>’</dt> |
| <dt> ‘<samp>--help</samp>’</dt> |
| <dd><a name="IDX907"></a> |
| <a name="IDX908"></a> |
| <p>Display this help and exit. |
| </p> |
| </dd> |
| <dt> ‘<samp>-V</samp>’</dt> |
| <dt> ‘<samp>--version</samp>’</dt> |
| <dd><a name="IDX909"></a> |
| <a name="IDX910"></a> |
| <p>Output version information and exit. |
| </p> |
| </dd> |
| </dl> |
|
|
|
|
| <a name="Colorizing"></a> |
| <a name="SEC170"></a> |
| <h2 class="section"> <a href="gettext_toc.html#TOC166">9.11 Highlighting parts of PO files</a> </h2> |
|
|
| <p>Translators are usually only interested in seeing the untranslated and |
| fuzzy messages of a PO file. Also, when a message is set fuzzy because |
| the msgid changed, they want to see the differences between the previous |
| msgid and the current one (especially if the msgid is long and only few |
| words in it have changed). Finally, it's always welcome to highlight the |
| different sections of a message in a PO file (comments, msgid, msgstr, etc.). |
| </p> |
| <p>Such highlighting is possible through the options ‘<samp>--color</samp>’ and |
| ‘<samp>--style</samp>’. They are supported by all the programs that produce |
| a PO file on standard output, such as <code>msgcat</code>, <code>msgmerge</code>, |
| and <code>msgunfmt</code>. |
| </p> |
|
|
|
|
| <a name="The-_002d_002dcolor-option"></a> |
| <a name="SEC171"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC167">9.11.1 The <code>--color</code> option</a> </h3> |
|
|
| <p>The ‘<samp>--color=<var>when</var></samp>’ option specifies under which conditions |
| colorized output should be generated. The <var>when</var> part can be one of |
| the following: |
| </p> |
| <dl compact="compact"> |
| <dt> <code>always</code></dt> |
| <dt> <code>yes</code></dt> |
| <dd><p>The output will be colorized. |
| </p> |
| </dd> |
| <dt> <code>never</code></dt> |
| <dt> <code>no</code></dt> |
| <dd><p>The output will not be colorized. |
| </p> |
| </dd> |
| <dt> <code>auto</code></dt> |
| <dt> <code>tty</code></dt> |
| <dd><p>The output will be colorized if the output device is a tty, i.e. when the |
| output goes directly to a text screen or terminal emulator window. |
| </p> |
| </dd> |
| <dt> <code>html</code></dt> |
| <dd><p>The output will be colorized and be in HTML format. |
| </p> |
| </dd> |
| <dt> <code>test</code></dt> |
| <dd><p>This is a special value, understood only by the <code>msgcat</code> program. It |
| is explained in the next section (<a href="#SEC172">The environment variable <code>TERM</code></a>). |
| </p></dd> |
| </dl> |
|
|
| <p>‘<samp>--color</samp>’ is equivalent to ‘<samp>--color=yes</samp>’. The default is |
| ‘<samp>--color=auto</samp>’. |
| </p> |
| <p>Thus, a command like ‘<samp>msgcat vi.po</samp>’ will produce colorized output |
| when called by itself in a command window. Whereas in a pipe, such as |
| ‘<samp>msgcat vi.po | less -R</samp>’, it will not produce colorized output. To |
| get colorized output in this situation nevertheless, use the command |
| ‘<samp>msgcat --color vi.po | less -R</samp>’. |
| </p> |
| <p>The ‘<samp>--color=html</samp>’ option will produce output that can be viewed in |
| a browser. This can be useful, for example, for Indic languages, |
| because the renderic of Indic scripts in browsers is usually better than |
| in terminal emulators. |
| </p> |
| <p>Note that the output produced with the <code>--color</code> option is <em>not</em> |
| a valid PO file in itself. It contains additional terminal-specific escape |
| sequences or HTML tags. A PO file reader will give a syntax error when |
| confronted with such content. Except for the ‘<samp>--color=html</samp>’ case, |
| you therefore normally don't need to save output produced with the |
| <code>--color</code> option in a file. |
| </p> |
|
|
| <a name="The-TERM-variable"></a> |
| <a name="SEC172"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC168">9.11.2 The environment variable <code>TERM</code></a> </h3> |
|
|
| <p>The environment variable <code>TERM</code> contains a identifier for the text |
| window's capabilities. You can get a detailed list of these cababilities |
| by using the ‘<samp>infocmp</samp>’ command, using ‘<samp>man 5 terminfo</samp>’ as a |
| reference. |
| </p> |
| <p>When producing text with embedded color directives, <code>msgcat</code> looks |
| at the <code>TERM</code> variable. Text windows today typically support at least |
| 8 colors. Often, however, the text window supports 16 or more colors, |
| even though the <code>TERM</code> variable is set to a identifier denoting only |
| 8 supported colors. It can be worth setting the <code>TERM</code> variable to |
| a different value in these cases: |
| </p> |
| <dl compact="compact"> |
| <dt> <code>xterm</code></dt> |
| <dd><p><code>xterm</code> is in most cases built with support for 16 colors. It can also |
| be built with support for 88 or 256 colors (but not both). You can try to |
| set <code>TERM</code> to either <code>xterm-16color</code>, <code>xterm-88color</code>, or |
| <code>xterm-256color</code>. |
| </p> |
| </dd> |
| <dt> <code>rxvt</code></dt> |
| <dd><p><code>rxvt</code> is often built with support for 16 colors. You can try to set |
| <code>TERM</code> to <code>rxvt-16color</code>. |
| </p> |
| </dd> |
| <dt> <code>konsole</code></dt> |
| <dd><p><code>konsole</code> too is often built with support for 16 colors. You can try to |
| set <code>TERM</code> to <code>konsole-16color</code> or <code>xterm-16color</code>. |
| </p></dd> |
| </dl> |
|
|
| <p>After setting <code>TERM</code>, you can verify it by invoking |
| ‘<samp>msgcat --color=test</samp>’ and seeing whether the output looks like a |
| reasonable color map. |
| </p> |
|
|
| <a name="The-_002d_002dstyle-option"></a> |
| <a name="SEC173"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC169">9.11.3 The <code>--style</code> option</a> </h3> |
|
|
| <p>The ‘<samp>--style=<var>style_file</var></samp>’ option specifies the style file to use |
| when colorizing. It has an effect only when the <code>--color</code> option is |
| effective. |
| </p> |
| <a name="IDX911"></a> |
| <p>If the <code>--style</code> option is not specified, the environment variable |
| <code>PO_STYLE</code> is considered. It is meant to point to the user's |
| preferred style for PO files. |
| </p> |
| <p>The default style file is ‘<tt>$prefix/share/gettext/styles/po-default.css</tt>’, |
| where <code>$prefix</code> is the installation location. |
| </p> |
| <p>A few style files are predefined: |
| </p><dl compact="compact"> |
| <dt> ‘<tt>po-vim.css</tt>’</dt> |
| <dd><p>This style imitates the look used by vim 7. |
| </p> |
| </dd> |
| <dt> ‘<tt>po-emacs-x.css</tt>’</dt> |
| <dd><p>This style imitates the look used by GNU Emacs 21 and 22 in an X11 window. |
| </p> |
| </dd> |
| <dt> ‘<tt>po-emacs-xterm.css</tt>’</dt> |
| <dt> ‘<tt>po-emacs-xterm16.css</tt>’</dt> |
| <dt> ‘<tt>po-emacs-xterm256.css</tt>’</dt> |
| <dd><p>This style imitates the look used by GNU Emacs 22 in a terminal of type |
| ‘<samp>xterm</samp>’ (8 colors) or ‘<samp>xterm-16color</samp>’ (16 colors) or |
| ‘<samp>xterm-256color</samp>’ (256 colors), respectively. |
| </p></dd> |
| </dl> |
|
|
| <p>You can use these styles without specifying a directory. They are actually |
| located in ‘<tt>$prefix/share/gettext/styles/</tt>’, where <code>$prefix</code> is the |
| installation location. |
| </p> |
| <p>You can also design your own styles. This is described in the next section. |
| </p> |
|
|
|
|
| <a name="Style-rules"></a> |
| <a name="SEC174"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC170">9.11.4 Style rules for PO files</a> </h3> |
|
|
| <p>The same style file can be used for styling of a PO file, for terminal |
| output and for HTML output. It is written in CSS (Cascading Style Sheet) |
| syntax. See <a href="https://www.w3.org/TR/css2/cover.html">https://www.w3.org/TR/css2/cover.html</a> for a formal |
| definition of CSS. Many HTML authoring tutorials also contain explanations |
| of CSS. |
| </p> |
| <p>In the case of HTML output, the style file is embedded in the HTML output. |
| In the case of text output, the style file is interpreted by the |
| <code>msgcat</code> program. This means, in particular, that when |
| <code>@import</code> is used with relative file names, the file names are |
| </p> |
| <ul class="toc"> |
| <li>- |
| relative to the resulting HTML file, in the case of HTML output, |
|
|
| </li><li>- |
| relative to the style sheet containing the <code>@import</code>, in the case of |
| text output. (Actually, <code>@import</code>s are not yet supported in this case, |
| due to a limitation in <code>libcroco</code>.) |
| </li></ul> |
|
|
| <p>CSS rules are built up from selectors and declarations. The declarations |
| specify graphical properties; the selectors specify when they apply. |
| </p> |
| <p>In PO files, the following simple selectors (based on "CSS classes", see |
| the CSS2 spec, section 5.8.3) are supported. |
| </p> |
| <ul> |
| <li> |
| Selectors that apply to entire messages: |
|
|
| <dl compact="compact"> |
| <dt> <code>.header</code></dt> |
| <dd><p>This matches the header entry of a PO file. |
| </p> |
| </dd> |
| <dt> <code>.translated</code></dt> |
| <dd><p>This matches a translated message. |
| </p> |
| </dd> |
| <dt> <code>.untranslated</code></dt> |
| <dd><p>This matches an untranslated message (i.e. a message with empty translation). |
| </p> |
| </dd> |
| <dt> <code>.fuzzy</code></dt> |
| <dd><p>This matches a fuzzy message (i.e. a message which has a translation that |
| needs review by the translator). |
| </p> |
| </dd> |
| <dt> <code>.obsolete</code></dt> |
| <dd><p>This matches an obsolete message (i.e. a message that was translated but is |
| not needed by the current POT file any more). |
| </p></dd> |
| </dl> |
|
|
| </li><li> |
| Selectors that apply to parts of a message in PO syntax. Recall the general |
| structure of a message in PO syntax: |
|
|
| <table><tr><td> </td><td><pre class="example"><var>white-space</var> |
| # <var>translator-comments</var> |
| #. <var>extracted-comments</var> |
| #: <var>reference</var>… |
| #, <var>flag</var>… |
| #| msgid <var>previous-untranslated-string</var> |
| msgid <var>untranslated-string</var> |
| msgstr <var>translated-string</var> |
| </pre></td></tr></table> |
|
|
| <dl compact="compact"> |
| <dt> <code>.comment</code></dt> |
| <dd><p>This matches all comments (translator comments, extracted comments, |
| source file reference comments, flag comments, previous message comments, |
| as well as the entire obsolete messages). |
| </p> |
| </dd> |
| <dt> <code>.translator-comment</code></dt> |
| <dd><p>This matches the translator comments. |
| </p> |
| </dd> |
| <dt> <code>.extracted-comment</code></dt> |
| <dd><p>This matches the extracted comments, i.e. the comments placed by the |
| programmer at the attention of the translator. |
| </p> |
| </dd> |
| <dt> <code>.reference-comment</code></dt> |
| <dd><p>This matches the source file reference comments (entire lines). |
| </p> |
| </dd> |
| <dt> <code>.reference</code></dt> |
| <dd><p>This matches the individual source file references inside the source file |
| reference comment lines. |
| </p> |
| </dd> |
| <dt> <code>.flag-comment</code></dt> |
| <dd><p>This matches the flag comment lines (entire lines). |
| </p> |
| </dd> |
| <dt> <code>.flag</code></dt> |
| <dd><p>This matches the individual flags inside flag comment lines. |
| </p> |
| </dd> |
| <dt> <code>.fuzzy-flag</code></dt> |
| <dd><p>This matches the `fuzzy' flag inside flag comment lines. |
| </p> |
| </dd> |
| <dt> <code>.previous-comment</code></dt> |
| <dd><p>This matches the comments containing the previous untranslated string (entire |
| lines). |
| </p> |
| </dd> |
| <dt> <code>.previous</code></dt> |
| <dd><p>This matches the previous untranslated string including the string delimiters, |
| the associated keywords (<code>msgid</code> etc.) and the spaces between them. |
| </p> |
| </dd> |
| <dt> <code>.msgid</code></dt> |
| <dd><p>This matches the untranslated string including the string delimiters, |
| the associated keywords (<code>msgid</code> etc.) and the spaces between them. |
| </p> |
| </dd> |
| <dt> <code>.msgstr</code></dt> |
| <dd><p>This matches the translated string including the string delimiters, |
| the associated keywords (<code>msgstr</code> etc.) and the spaces between them. |
| </p> |
| </dd> |
| <dt> <code>.keyword</code></dt> |
| <dd><p>This matches the keywords (<code>msgid</code>, <code>msgstr</code>, etc.). |
| </p> |
| </dd> |
| <dt> <code>.string</code></dt> |
| <dd><p>This matches strings, including the string delimiters (double quotes). |
| </p></dd> |
| </dl> |
|
|
| </li><li> |
| Selectors that apply to parts of strings: |
|
|
| <dl compact="compact"> |
| <dt> <code>.text</code></dt> |
| <dd><p>This matches the entire contents of a string (excluding the string delimiters, |
| i.e. the double quotes). |
| </p> |
| </dd> |
| <dt> <code>.escape-sequence</code></dt> |
| <dd><p>This matches an escape sequence (starting with a backslash). |
| </p> |
| </dd> |
| <dt> <code>.format-directive</code></dt> |
| <dd><p>This matches a format string directive (starting with a ‘<samp>%</samp>’ sign in the |
| case of most programming languages, with a ‘<samp>{</samp>’ in the case of |
| <code>java-format</code> and <code>csharp-format</code>, with a ‘<samp>~</samp>’ in the case of |
| <code>lisp-format</code> and <code>scheme-format</code>, or with ‘<samp>$</samp>’ in the case of |
| <code>sh-format</code>). |
| </p> |
| </dd> |
| <dt> <code>.invalid-format-directive</code></dt> |
| <dd><p>This matches an invalid format string directive. |
| </p> |
| </dd> |
| <dt> <code>.added</code></dt> |
| <dd><p>In an untranslated string, this matches a part of the string that was not |
| present in the previous untranslated string. (Not yet implemented in this |
| release.) |
| </p> |
| </dd> |
| <dt> <code>.changed</code></dt> |
| <dd><p>In an untranslated string or in a previous untranslated string, this matches |
| a part of the string that is changed or replaced. (Not yet implemented in |
| this release.) |
| </p> |
| </dd> |
| <dt> <code>.removed</code></dt> |
| <dd><p>In a previous untranslated string, this matches a part of the string that |
| is not present in the current untranslated string. (Not yet implemented in |
| this release.) |
| </p></dd> |
| </dl> |
| </li></ul> |
|
|
| <p>These selectors can be combined to hierarchical selectors. For example, |
| </p> |
| <table><tr><td> </td><td><pre class="smallexample">.msgstr .invalid-format-directive { color: red; } |
| </pre></td></tr></table> |
|
|
| <p>will highlight the invalid format directives in the translated strings. |
| </p> |
| <p>In text mode, pseudo-classes (CSS2 spec, section 5.11) and pseudo-elements |
| (CSS2 spec, section 5.12) are not supported. |
| </p> |
| <p>The declarations in HTML mode are not limited; any graphical attribute |
| supported by the browsers can be used. |
| </p> |
| <p>The declarations in text mode are limited to the following properties. Other |
| properties will be silently ignored. |
| </p> |
| <dl compact="compact"> |
| <dt> <code>color</code> (CSS2 spec, section 14.1)</dt> |
| <dt> <code>background-color</code> (CSS2 spec, section 14.2.1)</dt> |
| <dd><p>These properties is supported. Colors will be adjusted to match the terminal's |
| capabilities. Note that many terminals support only 8 colors. |
| </p> |
| </dd> |
| <dt> <code>font-weight</code> (CSS2 spec, section 15.2.3)</dt> |
| <dd><p>This property is supported, but most terminals can only render two different |
| weights: <code>normal</code> and <code>bold</code>. Values >= 600 are rendered as |
| <code>bold</code>. |
| </p> |
| </dd> |
| <dt> <code>font-style</code> (CSS2 spec, section 15.2.3)</dt> |
| <dd><p>This property is supported. The values <code>italic</code> and <code>oblique</code> are |
| rendered the same way. |
| </p> |
| </dd> |
| <dt> <code>text-decoration</code> (CSS2 spec, section 16.3.1)</dt> |
| <dd><p>This property is supported, limited to the values <code>none</code> and |
| <code>underline</code>. |
| </p></dd> |
| </dl> |
|
|
|
|
| <a name="Customizing-less"></a> |
| <a name="SEC175"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC171">9.11.5 Customizing <code>less</code> for viewing PO files</a> </h3> |
|
|
| <p>The ‘<samp>less</samp>’ program is a popular text file browser for use in a text |
| screen or terminal emulator. It also supports text with embedded escape |
| sequences for colors and text decorations. |
| </p> |
| <p>You can use <code>less</code> to view a PO file like this (assuming an UTF-8 |
| environment): |
| </p> |
| <table><tr><td> </td><td><pre class="smallexample">msgcat --to-code=UTF-8 --color xyz.po | less -R |
| </pre></td></tr></table> |
|
|
| <p>You can simplify this to this simple command: |
| </p> |
| <table><tr><td> </td><td><pre class="smallexample">less xyz.po |
| </pre></td></tr></table> |
|
|
| <p>after these three preparations: |
| </p> |
| <ol> |
| <li> |
| Add the options ‘<samp>-R</samp>’ and ‘<samp>-f</samp>’ to the <code>LESS</code> environment |
| variable. In sh shells: |
| <table><tr><td> </td><td><pre class="smallexample">$ LESS="$LESS -R -f" |
| $ export LESS |
| </pre></td></tr></table> |
|
|
| </li><li> |
| If your system does not already have the ‘<tt>lessopen.sh</tt>’ and |
| ‘<tt>lessclose.sh</tt>’ scripts, create them and set the <code>LESSOPEN</code> and |
| <code>LESSCLOSE</code> environment variables, as indicated in the manual page |
| (‘<samp>man less</samp>’). |
|
|
| </li><li> |
| Add to ‘<tt>lessopen.sh</tt>’ a piece of script that recognizes PO files |
| through their file extension and invokes <code>msgcat</code> on them, producing |
| a temporary file. Like this: |
|
|
| <table><tr><td> </td><td><pre class="smallexample">case "$1" in |
| *.po) |
| tmpfile=`mktemp "${TMPDIR-/tmp}/less.XXXXXX"` |
| msgcat --to-code=UTF-8 --color "$1" > "$tmpfile" |
| echo "$tmpfile" |
| exit 0 |
| ;; |
| esac |
| </pre></td></tr></table> |
| </li></ol> |
|
|
|
|
| <a name="Other-tools"></a> |
| <a name="SEC176"></a> |
| <h2 class="section"> <a href="gettext_toc.html#TOC172">9.12 Other tools for manipulating PO files</a> </h2> |
|
|
| <a name="SEC177"></a> |
| <h3 class="subheading"> Pology </h3> |
|
|
| <p>The “Pology” package is a Free Software package for manipulating PO files. |
| It features, in particular: |
| </p> |
| <ul> |
| <li> |
| Examination and in-place modification of collections of PO files. |
| </li><li> |
| Format-aware diffing and patching of PO files. |
| </li><li> |
| Handling of version-control branches. |
| </li><li> |
| Fine-grained asynchronous review workflow. |
| </li><li> |
| Custom translation validation. |
| </li><li> |
| Language and project specific support. |
| </li></ul> |
|
|
| <p>Its home page is at <a href="http://pology.nedohodnik.net/">http://pology.nedohodnik.net/</a>. |
| </p> |
| <a name="SEC178"></a> |
| <h3 class="subheading"> Translate Toolkit </h3> |
|
|
| <p>The “Translate Toolkit” is a Free Software package. |
| It contains a set of programs to |
| convert between PO files and other file formats, |
| merge translations, |
| and perform various checks. |
| </p> |
| <p>Its home page is at <a href="https://toolkit.translatehouse.org/">https://toolkit.translatehouse.org/</a>. |
| The code is at <a href="https://github.com/translate/translate">https://github.com/translate/translate</a>. |
| </p> |
|
|
| <a name="libgettextpo"></a> |
| <a name="SEC179"></a> |
| <h2 class="section"> <a href="gettext_toc.html#TOC173">9.13 Writing your own programs that process PO files</a> </h2> |
|
|
| <p>For the tasks for which a combination of ‘<samp>msgattrib</samp>’, ‘<samp>msgcat</samp>’ etc. |
| is not sufficient, a set of C functions is provided in a library, to make it |
| possible to process PO files in your own programs. When you use this library, |
| you don't need to write routines to parse the PO file; instead, you retrieve |
| a pointer in memory to each of messages contained in the PO file. Functions |
| for writing those memory structures to a file after working with them are |
| provided too. |
| </p> |
| <p>The functions are declared in the header file ‘<samp><gettext-po.h></samp>’, and are |
| defined in a library called ‘<samp>libgettextpo</samp>’. |
| </p> |
| <p>The library is multithread-safe in the following sense: |
| Different threads can safely use the various functions simultaneously on |
| unrelated data objects. |
| For example, if several threads have created separate <code>po_file_t</code> objects, |
| each of them can safely work on its respective <code>po_file_t</code> object, |
| without caring about the other threads. |
| </p> |
|
|
| <p>The following example shows code how these functions can be used. Error |
| handling code is omitted, as its implementation is delegated to the user |
| provided functions. |
| </p> |
| <table><tr><td> </td><td><pre class="example">struct po_xerror_handler handler = |
| { |
| .xerror = …, |
| .xerror2 = … |
| }; |
| const char *filename = …; |
| /* Read the file into memory. */ |
| po_file_t file = po_file_read (filename, &handler); |
|
|
| { |
| const char * const *domains = po_file_domains (file); |
| const char * const *domainp; |
|
|
| /* Iterate the domains contained in the file. */ |
| for (domainp = domains; *domainp; domainp++) |
| { |
| po_message_t *message; |
| const char *domain = *domainp; |
| po_message_iterator_t iterator = po_message_iterator (file, domain); |
|
|
| /* Iterate each message inside the domain. */ |
| while ((message = po_next_message (iterator)) != NULL) |
| { |
| /* Read data from the message … */ |
| const char *msgid = po_message_msgid (message); |
| const char *msgstr = po_message_msgstr (message); |
|
|
| … |
|
|
| /* Modify its contents … */ |
| if (perform_some_tests (msgid, msgstr)) |
| po_message_set_fuzzy (message, 1); |
|
|
| … |
| } |
| /* Always release returned po_message_iterator_t. */ |
| po_message_iterator_free (iterator); |
| } |
|
|
| /* Write back the result. */ |
| po_file_t result = po_file_write (file, filename, &handler); |
| } |
|
|
| /* Always release the returned po_file_t. */ |
| po_file_free (file); |
| </pre></td></tr></table> |
|
|
|
|
| <a name="Error-Handling"></a> |
| <a name="SEC180"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC174">9.13.1 Error Handling</a> </h3> |
|
|
| <p>Error management is performed through callbacks provided by the user of |
| the library. They are provided through a parameter with the following |
| type: |
| </p> |
| <dl> |
| <dt><u>Data Type:</u> <b>struct</b><i> po_xerror_handler</i> |
| <a name="IDX912"></a> |
| </dt> |
| <dd><p>Its pointer is defined as <code>po_xerror_handler_t</code>. Contains |
| two fields, <code>xerror</code> and <code>xerror2</code>, with the following function |
| signatures. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>xerror</b><i> (int <var>severity</var>, po_message_t <var>message</var>, const char *<var>filename</var>, size_t <var>lineno</var>, size_t <var>column</var>, int <var>multiline_p</var>, const char *<var>message_text</var>)</i> |
| <a name="IDX913"></a> |
| </dt> |
| <dd><p>This function is called to signal a problem of the given <var>severity</var>. |
| It <em>must not return</em> if <var>severity</var> is |
| <code>PO_SEVERITY_FATAL_ERROR</code>. |
| </p> |
| <p><var>message_text</var> is the problem description. When <var>multiline_p</var> |
| is true, it can contain multiple lines of text, each terminated with a |
| newline, otherwise a single line. |
| </p> |
| <p><var>message</var> and/or <var>filename</var> and <var>lineno</var> indicate where the |
| problem occurred: |
| </p> |
| <ul> |
| <li> |
| If <var>filename</var> is <code>NULL</code>, <var>filename</var> and <var>lineno</var> and |
| <var>column</var> should be ignored. |
|
|
| </li><li> |
| If <var>lineno</var> is <code>(size_t)(-1)</code>, <var>lineno</var> and <var>column</var> |
| should be ignored. |
|
|
| </li><li> |
| If <var>column</var> is <code>(size_t)(-1)</code>, it should be ignored. |
| </li></ul> |
| </dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>xerror2</b><i> (int <var>severity</var>, po_message_t <var>message1</var>, const char *<var>filename1</var>, size_t <var>lineno1</var>, size_t <var>column1</var>, int <var>multiline_p1</var>, const char *<var>message_text1</var>, po_message_t <var>message2</var>, const char *<var>filename2</var>, size_t <var>lineno2</var>, size_t <var>column2</var>, int <var>multiline_p2</var>, const char *<var>message_text2</var>)</i> |
| <a name="IDX914"></a> |
| </dt> |
| <dd><p>This function is called to signal a problem of the given <var>severity</var> |
| that refers to two messages. It <em>must not return</em> if |
| <var>severity</var> is <code>PO_SEVERITY_FATAL_ERROR</code>. |
| </p> |
| <p>It is similar to two calls to xerror. If possible, an ellipsis can be |
| appended to <var>message_text1</var> and prepended to <var>message_text2</var>. |
| </p></dd></dl> |
|
|
|
|
| <a name="po_005ffile_005ft-API"></a> |
| <a name="SEC181"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC175">9.13.2 po_file_t API</a> </h3> |
|
|
| <dl> |
| <dt><u>Data Type:</u> <b>po_file_t</b> |
| <a name="IDX915"></a> |
| </dt> |
| <dd><p>This is a pointer type that refers to the contents of a PO file, after it has |
| been read into memory. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> po_file_t <b>po_file_create</b><i> ()</i> |
| <a name="IDX916"></a> |
| </dt> |
| <dd><p>The <code>po_file_create</code> function creates an empty PO file representation in |
| memory. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> po_file_t <b>po_file_read</b><i> (const char *<var>filename</var>, struct po_xerror_handler *<var>handler</var>)</i> |
| <a name="IDX917"></a> |
| </dt> |
| <dd><p>The <code>po_file_read</code> function reads a PO file into memory. The file name |
| is given as argument. The return value is a handle to the PO file's contents, |
| valid until <code>po_file_free</code> is called on it. In case of error, the |
| functions from <var>handler</var> are called to signal it. |
| </p> |
| <p>This function is exported as ‘<samp>po_file_read_v3</samp>’ at ABI level, but is |
| defined as <code>po_file_read</code> in C code after the inclusion of |
| ‘<samp><gettext-po.h></samp>’. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> po_file_t <b>po_file_write</b><i> (po_file_t <var>file</var>, const char *<var>filename</var>, struct po_xerror_handler *<var>handler</var>)</i> |
| <a name="IDX918"></a> |
| </dt> |
| <dd><p>The <code>po_file_write</code> function writes the contents of the memory |
| structure <var>file</var> the <var>filename</var> given. The return value is |
| <var>file</var> after a successful operation. In case of error, the |
| functions from <var>handler</var> are called to signal it. |
| </p> |
| <p>This function is exported as ‘<samp>po_file_write_v2</samp>’ at ABI level, but |
| is defined as <code>po_file_write</code> in C code after the inclusion of |
| ‘<samp><gettext-po.h></samp>’. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_file_free</b><i> (po_file_t <var>file</var>)</i> |
| <a name="IDX919"></a> |
| </dt> |
| <dd><p>The <code>po_file_free</code> function frees a PO file's contents from memory, |
| including all messages that are only implicitly accessible through iterators. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> const char * const * <b>po_file_domains</b><i> (po_file_t <var>file</var>)</i> |
| <a name="IDX920"></a> |
| </dt> |
| <dd><p>The <code>po_file_domains</code> function returns the domains for which the given |
| PO file has messages. The return value is a <code>NULL</code> terminated array |
| which is valid as long as the <var>file</var> handle is valid. For PO files which |
| contain no ‘<samp>domain</samp>’ directive, the return value contains only one domain, |
| namely the default domain <code>"messages"</code>. |
| </p></dd></dl> |
|
|
|
|
| <a name="po_005fmessage_005fiterator_005ft-API"></a> |
| <a name="SEC182"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC176">9.13.3 po_message_iterator_t API</a> </h3> |
|
|
| <dl> |
| <dt><u>Data Type:</u> <b>po_message_iterator_t</b> |
| <a name="IDX921"></a> |
| </dt> |
| <dd><p>This is a pointer type that refers to an iterator that produces a sequence of |
| messages. |
| </p></dd></dl> |
|
|
| <dl> |
| <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> |
| <a name="IDX922"></a> |
| </dt> |
| <dd><p>The <code>po_message_iterator</code> returns an iterator that will produce the |
| messages of <var>file</var> that belong to the given <var>domain</var>. If <var>domain</var> |
| is <code>NULL</code>, the default domain is used instead. To list the messages, |
| use the function <code>po_next_message</code> repeatedly. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_iterator_free</b><i> (po_message_iterator_t <var>iterator</var>)</i> |
| <a name="IDX923"></a> |
| </dt> |
| <dd><p>The <code>po_message_iterator_free</code> function frees an iterator previously |
| allocated through the <code>po_message_iterator</code> function. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> po_message_t <b>po_next_message</b><i> (po_message_iterator_t <var>iterator</var>)</i> |
| <a name="IDX924"></a> |
| </dt> |
| <dd><p>The <code>po_next_message</code> function returns the next message from |
| <var>iterator</var> and advances the iterator. It returns <code>NULL</code> when the |
| iterator has reached the end of its message list. |
| </p></dd></dl> |
|
|
|
|
| <a name="po_005fmessage_005ft-API"></a> |
| <a name="SEC183"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC177">9.13.4 po_message_t API</a> </h3> |
|
|
| <dl> |
| <dt><u>Data Type:</u> <b>po_message_t</b> |
| <a name="IDX925"></a> |
| </dt> |
| <dd><p>This is a pointer type that refers to a message of a PO file, including its |
| translation. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> po_message_t <b>po_message_create</b><i> (void)</i> |
| <a name="IDX926"></a> |
| </dt> |
| <dd><p>Returns a freshly constructed message. To finish initializing the |
| message, you must set the <code>msgid</code> and <code>msgstr</code>. It <em>must</em> be |
| inserted into a file to manage its memory, as there is no |
| <code>po_message_free</code> available to the user of the library. |
| </p></dd></dl> |
|
|
| <p>The following functions access details of a <code>po_message_t</code>. Recall |
| that the results are valid as long as the <var>file</var> handle is valid. |
| </p> |
| <dl> |
| <dt><u>Function:</u> const char * <b>po_message_msgctxt</b><i> (po_message_t <var>message</var>)</i> |
| <a name="IDX927"></a> |
| </dt> |
| <dd><p>The <code>po_message_msgctxt</code> function returns the <code>msgctxt</code>, the |
| context of <var>message</var>. Returns <code>NULL</code> for a message not restricted |
| to a context. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_set_msgctxt</b><i> (po_message_t <var>message</var>, const char *<var>msgctxt</var>)</i> |
| <a name="IDX928"></a> |
| </dt> |
| <dd><p>The <code>po_message_set_msgctxt</code> function changes the <code>msgctxt</code>, |
| the context of the message, to the value provided through |
| <var>msgctxt</var>. The value <code>NULL</code> removes the restriction. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> const char * <b>po_message_msgid</b><i> (po_message_t <var>message</var>)</i> |
| <a name="IDX929"></a> |
| </dt> |
| <dd><p>The <code>po_message_msgid</code> function returns the <code>msgid</code> (untranslated |
| English string) of <var>message</var>. This is guaranteed to be non-<code>NULL</code>. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_set_msgid</b><i> (po_message_t <var>message</var>, const char *<var>msgid</var>)</i> |
| <a name="IDX930"></a> |
| </dt> |
| <dd><p>The <code>po_message_set_msgid</code> function changes the <code>msgid</code> |
| (untranslated English string) of <var>message</var> to the value provided through |
| <var>msgid</var>, a non-<code>NULL</code> string. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> const char * <b>po_message_msgid_plural</b><i> (po_message_t <var>message</var>)</i> |
| <a name="IDX931"></a> |
| </dt> |
| <dd><p>The <code>po_message_msgid_plural</code> function returns the <code>msgid_plural</code> |
| (untranslated English plural string) of <var>message</var>, a message with plurals, |
| or <code>NULL</code> for a message without plural. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_set_msgid_plural</b><i> (po_message_t <var>message</var>, const char *<var>msgid_plural</var>)</i> |
| <a name="IDX932"></a> |
| </dt> |
| <dd><p>The <code>po_message_set_msgid_plural</code> function changes the |
| <code>msgid_plural</code> (untranslated English plural string) of a message to |
| the value provided through <var>msgid_plural</var>, or removes the plurals if |
| <code>NULL</code> is provided as <var>msgid_plural</var>. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> const char * <b>po_message_msgstr</b><i> (po_message_t <var>message</var>)</i> |
| <a name="IDX933"></a> |
| </dt> |
| <dd><p>The <code>po_message_msgstr</code> function returns the <code>msgstr</code> (translation) |
| of <var>message</var>. For an untranslated message, the return value is an empty |
| string. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_set_msgstr</b><i> (po_message_t <var>message</var>, const char *<var>msgstr</var>)</i> |
| <a name="IDX934"></a> |
| </dt> |
| <dd><p>The <code>po_message_set_msgstr</code> function changes the <code>msgstr</code> |
| (translation) of <var>message</var> to the value provided through <var>msgstr</var>, a |
| non-<code>NULL</code> string. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> const char * <b>po_message_msgstr_plural</b><i> (po_message_t <var>message</var>, int <var>index</var>)</i> |
| <a name="IDX935"></a> |
| </dt> |
| <dd><p>The <code>po_message_msgstr_plural</code> function returns the |
| <code>msgstr[<var>index</var>]</code> of <var>message</var>, a message with plurals, or |
| <code>NULL</code> when the <var>index</var> is out of range or for a message without |
| plural. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_set_msgstr_plural</b><i> (po_message_t <var>message</var>, int <var>index</var>, const char *<var>msgstr_plural</var>)</i> |
| <a name="IDX936"></a> |
| </dt> |
| <dd><p>The <code>po_message_set_msgstr_plural</code> function changes the |
| <code>msgstr[<var>index</var>]</code> of <var>message</var>, a message with plurals, to |
| the value provided through <var>msgstr_plural</var>. <var>message</var> must be a |
| message with plurals. |
| Use <code>NULL</code> as the value of <var>msgstr_plural</var> with |
| <var>index</var> pointing to the last element to reduce the number of plural |
| forms. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> const char * <b>po_message_comments</b><i> (po_message_t <var>message</var>)</i> |
| <a name="IDX937"></a> |
| </dt> |
| <dd><p>The <code>po_message_comments</code> function returns the comments of <var>message</var>, |
| a multiline string, ending in a newline, or a non-<code>NULL</code> empty string. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_set_comments</b><i> (po_message_t <var>message</var>, const char *<var>comments</var>)</i> |
| <a name="IDX938"></a> |
| </dt> |
| <dd><p>The <code>po_message_set_comments</code> function changes the comments of |
| <var>message</var> to the value <var>comments</var>, a multiline string, ending in a |
| newline, or a non-<code>NULL</code> empty string. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> const char * <b>po_message_extracted_comments</b><i> (po_message_t <var>message</var>)</i> |
| <a name="IDX939"></a> |
| </dt> |
| <dd><p>The <code>po_message_extracted_comments</code> function returns the extracted |
| comments of <var>message</var>, a multiline string, ending in a newline, or a |
| non-<code>NULL</code> empty string. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_set_extracted_comments</b><i> (po_message_t <var>message</var>, const char *<var>extracted_comments</var>)</i> |
| <a name="IDX940"></a> |
| </dt> |
| <dd><p>The <code>po_message_set_extracted_comments</code> function changes the |
| comments of <var>message</var> to the value <var>extracted_comments</var>, a multiline |
| string, ending in a newline, or a non-<code>NULL</code> empty string. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> const char * <b>po_message_prev_msgctxt</b><i> (po_message_t <var>message</var>)</i> |
| <a name="IDX941"></a> |
| </dt> |
| <dd><p>The <code>po_message_prev_msgctxt</code> function returns the previous |
| <code>msgctxt</code>, the previous context of <var>message</var>. Return |
| <code>NULL</code> for a message that does not have a previous context. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_set_prev_msgctxt</b><i> (po_message_t <var>message</var>, const char *<var>prev_msgctxt</var>)</i> |
| <a name="IDX942"></a> |
| </dt> |
| <dd><p>The <code>po_message_set_prev_msgctxt</code> function changes the previous |
| <code>msgctxt</code>, the context of the message, to the value provided |
| through <var>prev_msgctxt</var>. The value <code>NULL</code> removes the stored |
| previous msgctxt. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> const char * <b>po_message_prev_msgid</b><i> (po_message_t <var>message</var>)</i> |
| <a name="IDX943"></a> |
| </dt> |
| <dd><p>The <code>po_message_prev_msgid</code> function returns the previous |
| <code>msgid</code> (untranslated English string) of <var>message</var>, or |
| <code>NULL</code> if there is no previous <code>msgid</code> stored. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_set_prev_msgid</b><i> (po_message_t <var>message</var>, const char *<var>prev_msgid</var>)</i> |
| <a name="IDX944"></a> |
| </dt> |
| <dd><p>The <code>po_message_set_prev_msgid</code> function changes the previous |
| <code>msgid</code> (untranslated English string) of <var>message</var> to the value |
| provided through <var>prev_msgid</var>, or removes the message when it is |
| <code>NULL</code>. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> const char * <b>po_message_prev_msgid_plural</b><i> (po_message_t <var>message</var>)</i> |
| <a name="IDX945"></a> |
| </dt> |
| <dd><p>The <code>po_message_prev_msgid_plural</code> function returns the previous |
| <code>msgid_plural</code> (untranslated English plural string) of |
| <var>message</var>, a message with plurals, or <code>NULL</code> for a message |
| without plural without any stored previous <code>msgid_plural</code>. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_set_prev_msgid_plural</b><i> (po_message_t <var>message</var>, const char *<var>prev_msgid_plural</var>)</i> |
| <a name="IDX946"></a> |
| </dt> |
| <dd><p>The <code>po_message_set_prev_msgid_plural</code> function changes the |
| previous <code>msgid_plural</code> (untranslated English plural string) of a |
| message to the value provided through <var>prev_msgid_plural</var>, or |
| removes the stored previous <code>msgid_plural</code> if <code>NULL</code> is |
| provided as <var>prev_msgid_plural</var>. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> int <b>po_message_is_obsolete</b><i> (po_message_t <var>message</var>)</i> |
| <a name="IDX947"></a> |
| </dt> |
| <dd><p>The <code>po_message_is_obsolete</code> function returns true when <var>message</var> |
| is marked as obsolete. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_set_obsolete</b><i> (po_message_t <var>message</var>, int <var>obsolete</var>)</i> |
| <a name="IDX948"></a> |
| </dt> |
| <dd><p>The <code>po_message_set_obsolete</code> function changes the obsolete mark of |
| <var>message</var>. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> int <b>po_message_is_fuzzy</b><i> (po_message_t <var>message</var>)</i> |
| <a name="IDX949"></a> |
| </dt> |
| <dd><p>The <code>po_message_is_fuzzy</code> function returns true when <var>message</var> |
| is marked as fuzzy. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_set_fuzzy</b><i> (po_message_t <var>message</var>, int <var>fuzzy</var>)</i> |
| <a name="IDX950"></a> |
| </dt> |
| <dd><p>The <code>po_message_set_fuzzy</code> function changes the fuzzy mark of |
| <var>message</var>. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> int <b>po_message_is_format</b><i> (po_message_t <var>message</var>, const char *<var>format_type</var>)</i> |
| <a name="IDX951"></a> |
| </dt> |
| <dd><p>The <code>po_message_is_format</code> function returns true when the message |
| is marked as being a format string of <var>format_type</var>. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_set_format</b><i> (po_message_t <var>message</var>, const char *<var>format_type</var>, int <var>value</var>)</i> |
| <a name="IDX952"></a> |
| </dt> |
| <dd><p>The <code>po_message_set_format</code> function changes |
| the format string mark of the message for the <var>format_type</var> provided. |
| Pass <var>value</var> = 1 |
| to assert the format string mark (leading to e.g. ‘<samp>c-format</samp>’), |
| <var>value</var> = 0 |
| to assert the opposite (leading to e.g. ‘<samp>no-c-format</samp>’), |
| or <var>value</var> = -1 |
| to remove the format string mark and its opposite. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> int <b>po_message_is_range</b><i> (po_message_t <var>message</var>, int *<var>minp</var>, int *<var>maxp</var>)</i> |
| <a name="IDX953"></a> |
| </dt> |
| <dd><p>The <code>po_message_is_range</code> function returns true when the message |
| has a numeric range set, and stores the minimum and maximum value in the |
| locations pointed by <var>minp</var> and <var>maxp</var> respectively. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_set_range</b><i> (po_message_t <var>message</var>, int <var>min</var>, int <var>max</var>)</i> |
| <a name="IDX954"></a> |
| </dt> |
| <dd><p>The <code>po_message_set_range</code> function changes the numeric range of |
| the message. <var>min</var> and <var>max</var> must be non-negative, with |
| <var>min</var> < <var>max</var>. Use <var>min</var> and <var>max</var> with value <code>-1</code> |
| to remove the numeric range of <var>message</var>. |
| </p></dd></dl> |
|
|
|
|
| <a name="PO-Header-Entry-API"></a> |
| <a name="SEC184"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC178">9.13.5 PO Header Entry API</a> </h3> |
|
|
| <p>The following functions provide an interface to extract and manipulate |
| the header entry (see section <a href="gettext_6.html#SEC60">Filling in the Header Entry</a>) from a file loaded in memory. |
| The meta information must be written back into the domain message with |
| the empty string as <code>msgid</code>. |
| </p> |
| <dl> |
| <dt><u>Function:</u> const char * <b>po_file_domain_header</b><i> (po_file_t <var>file</var>, const char *<var>domain</var>)</i> |
| <a name="IDX955"></a> |
| </dt> |
| <dd><p>Returns the header entry of a domain from <var>file</var>, a PO file loaded in |
| memory. The value <code>NULL</code> provided as <var>domain</var> denotes the |
| default domain. Returns <code>NULL</code> if there is no header entry. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> char * <b>po_header_field</b><i> (const char *<var>header</var>, const char *<var>field</var>)</i> |
| <a name="IDX956"></a> |
| </dt> |
| <dd><p>Returns the value of <var>field</var> in the <var>header</var> entry. The return |
| value is either a freshly allocated string, to be freed by the caller, |
| or <code>NULL</code>. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> char * <b>po_header_set_field</b><i> (const char *<var>header</var>, const char *<var>field</var>, const char *<var>value</var>)</i> |
| <a name="IDX957"></a> |
| </dt> |
| <dd><p>Returns a freshly allocated string which contains the entry from |
| <var>header</var> with <var>field</var> set to <var>value</var>. The field is added if |
| necessary. |
| </p></dd></dl> |
|
|
|
|
| <a name="po_005ffilepos_005ft-API"></a> |
| <a name="SEC185"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC179">9.13.6 po_filepos_t API</a> </h3> |
|
|
| <dl> |
| <dt><u>Data Type:</u> <b>po_filepos_t</b> |
| <a name="IDX958"></a> |
| </dt> |
| <dd><p>This is a pointer type that refers to a string's position within a |
| source file. |
| </p></dd></dl> |
|
|
| <p>The following functions provide an interface to extract and manipulate |
| these references. |
| </p> |
| <dl> |
| <dt><u>Function:</u> po_filepos_t <b>po_message_filepos</b><i> (po_message_t <var>message</var>, int <var>index</var>)</i> |
| <a name="IDX959"></a> |
| </dt> |
| <dd><p>Returns the file reference in position <var>index</var> from the message. If |
| <var>index</var> is out of range, returns <code>NULL</code>. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_remove_filepos</b><i> (po_message_t <var>message</var>, int <var>index</var>)</i> |
| <a name="IDX960"></a> |
| </dt> |
| <dd><p>Removes the file reference in position <var>index</var> from the message. It |
| moves all references following <var>index</var> one position backwards. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_add_filepos</b><i> (po_message_t <var>message</var>, const char *<var>file</var>, size_t <var>start_line</var>)</i> |
| <a name="IDX961"></a> |
| </dt> |
| <dd><p>Adds a reference to the string from <var>file</var> starting at |
| <var>start_line</var>, if it is not already present for the message. The |
| value <code>(size_t)(-1)</code> for <var>start_line</var> denotes that the line |
| number is not available. |
| </p></dd></dl> |
|
|
|
|
| <a name="Format-Type-API"></a> |
| <a name="SEC186"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC180">9.13.7 Format Type API</a> </h3> |
|
|
| <dl> |
| <dt><u>Function:</u> const char * const * <b>po_format_list</b><i> (void)</i> |
| <a name="IDX962"></a> |
| </dt> |
| <dd><p>Returns a <code>NULL</code> terminated array of the supported format types. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> const char * <b>po_format_pretty_name</b><i> (const char *<var>format_type</var>)</i> |
| <a name="IDX963"></a> |
| </dt> |
| <dd><p>Returns the pretty name associated with <var>format_type</var>. For example, |
| it returns “C#” when <var>format_type</var> is “csharp_format”. |
| Return <code>NULL</code> if <var>format_type</var> is not a supported format type. |
| </p></dd></dl> |
|
|
|
|
| <a name="Checking-API"></a> |
| <a name="SEC187"></a> |
| <h3 class="subsection"> <a href="gettext_toc.html#TOC181">9.13.8 Checking API</a> </h3> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_file_check_all</b><i> (po_file_t <var>file</var>, po_xerror_handler_t <var>handler</var>)</i> |
| <a name="IDX964"></a> |
| </dt> |
| <dd><p>Tests whether the entire <var>file</var> is valid, like <code>msgfmt</code> does it. If it |
| is invalid, passes the reasons to <var>handler</var>. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_check_all</b><i> (po_message_t <var>message</var>, po_message_iterator_t <var>iterator</var>, po_xerror_handler_t <var>handler</var>)</i> |
| <a name="IDX965"></a> |
| </dt> |
| <dd><p>Tests <var>message</var>, to be inserted at <var>iterator</var> in a PO file in memory, |
| like <code>msgfmt</code> does it. If it is invalid, passes the reasons to |
| <var>handler</var>. <var>iterator</var> is not modified by this call; it only |
| specifies the file and the domain. |
| </p></dd></dl> |
|
|
| <dl> |
| <dt><u>Function:</u> void <b>po_message_check_format</b><i> (po_message_t <var>message</var>, po_xerror_handler_t <var>handler</var>)</i> |
| <a name="IDX966"></a> |
| </dt> |
| <dd><p>Tests whether the message translation from <var>message</var> is a valid |
| format string if the message is marked as being a format string. If it |
| is invalid, passes the reasons to <var>handler</var>. |
| </p> |
| <p>This function is exported as ‘<samp>po_message_check_format_v2</samp>’ at ABI |
| level, but is defined as <code>po_message_check_format</code> in C code after |
| the inclusion of ‘<samp><gettext-po.h></samp>’. |
| </p></dd></dl> |
|
|
|
|
| <table cellpadding="1" cellspacing="1" border="0"> |
| <tr><td valign="middle" align="left">[<a href="#SEC100" title="Beginning of this chapter or previous chapter"> << </a>]</td> |
| <td valign="middle" align="left">[<a href="gettext_10.html#SEC188" title="Next chapter"> >> </a>]</td> |
| <td valign="middle" align="left"> </td> |
| <td valign="middle" align="left"> </td> |
| <td valign="middle" align="left"> </td> |
| <td valign="middle" align="left"> </td> |
| <td valign="middle" align="left"> </td> |
| <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Top" title="Cover (top) of document">Top</a>]</td> |
| <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td> |
| <td valign="middle" align="left">[<a href="gettext_21.html#SEC410" title="Index">Index</a>]</td> |
| <td valign="middle" align="left">[<a href="gettext_abt.html#SEC_About" title="About (help)"> ? </a>]</td> |
| </tr></table> |
| <p> |
| <font size="-1"> |
| This document was generated by <em>Bruno Haible</em> on <em>July, 2 2025</em> using <a href="https://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. |
| </font> |
| <br> |
|
|
| </p> |
| </body> |
| </html> |
|
|