annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/share/doc/gettext/gettext_8.html @ 68:5028fdace37b

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 16:23:26 -0400
parents
children
rev   line source
jpayne@68 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
jpayne@68 2 <html>
jpayne@68 3 <!-- Created on February, 21 2024 by texi2html 1.78a -->
jpayne@68 4 <!--
jpayne@68 5 Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
jpayne@68 6 Karl Berry <karl@freefriends.org>
jpayne@68 7 Olaf Bachmann <obachman@mathematik.uni-kl.de>
jpayne@68 8 and many others.
jpayne@68 9 Maintained by: Many creative people.
jpayne@68 10 Send bugs and suggestions to <texi2html-bug@nongnu.org>
jpayne@68 11
jpayne@68 12 -->
jpayne@68 13 <head>
jpayne@68 14 <title>GNU gettext utilities: 8. Editing PO Files</title>
jpayne@68 15
jpayne@68 16 <meta name="description" content="GNU gettext utilities: 8. Editing PO Files">
jpayne@68 17 <meta name="keywords" content="GNU gettext utilities: 8. Editing PO Files">
jpayne@68 18 <meta name="resource-type" content="document">
jpayne@68 19 <meta name="distribution" content="global">
jpayne@68 20 <meta name="Generator" content="texi2html 1.78a">
jpayne@68 21 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
jpayne@68 22 <style type="text/css">
jpayne@68 23 <!--
jpayne@68 24 a.summary-letter {text-decoration: none}
jpayne@68 25 pre.display {font-family: serif}
jpayne@68 26 pre.format {font-family: serif}
jpayne@68 27 pre.menu-comment {font-family: serif}
jpayne@68 28 pre.menu-preformatted {font-family: serif}
jpayne@68 29 pre.smalldisplay {font-family: serif; font-size: smaller}
jpayne@68 30 pre.smallexample {font-size: smaller}
jpayne@68 31 pre.smallformat {font-family: serif; font-size: smaller}
jpayne@68 32 pre.smalllisp {font-size: smaller}
jpayne@68 33 span.roman {font-family:serif; font-weight:normal;}
jpayne@68 34 span.sansserif {font-family:sans-serif; font-weight:normal;}
jpayne@68 35 ul.toc {list-style: none}
jpayne@68 36 -->
jpayne@68 37 </style>
jpayne@68 38
jpayne@68 39
jpayne@68 40 </head>
jpayne@68 41
jpayne@68 42 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
jpayne@68 43
jpayne@68 44 <table cellpadding="1" cellspacing="1" border="0">
jpayne@68 45 <tr><td valign="middle" align="left">[<a href="gettext_7.html#SEC53" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
jpayne@68 46 <td valign="middle" align="left">[<a href="gettext_9.html#SEC87" title="Next chapter"> &gt;&gt; </a>]</td>
jpayne@68 47 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 48 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 49 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 50 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 51 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 52 <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
jpayne@68 53 <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
jpayne@68 54 <td valign="middle" align="left">[<a href="gettext_21.html#SEC389" title="Index">Index</a>]</td>
jpayne@68 55 <td valign="middle" align="left">[<a href="gettext_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
jpayne@68 56 </tr></table>
jpayne@68 57
jpayne@68 58 <hr size="2">
jpayne@68 59 <a name="Editing"></a>
jpayne@68 60 <a name="SEC63"></a>
jpayne@68 61 <h1 class="chapter"> <a href="gettext_toc.html#TOC56">8. Editing PO Files</a> </h1>
jpayne@68 62
jpayne@68 63
jpayne@68 64
jpayne@68 65 <a name="KBabel"></a>
jpayne@68 66 <a name="SEC64"></a>
jpayne@68 67 <h2 class="section"> <a href="gettext_toc.html#TOC57">8.1 KDE's PO File Editor</a> </h2>
jpayne@68 68
jpayne@68 69
jpayne@68 70 <a name="Gtranslator"></a>
jpayne@68 71 <a name="SEC65"></a>
jpayne@68 72 <h2 class="section"> <a href="gettext_toc.html#TOC58">8.2 GNOME's PO File Editor</a> </h2>
jpayne@68 73
jpayne@68 74
jpayne@68 75 <a name="PO-Mode"></a>
jpayne@68 76 <a name="SEC66"></a>
jpayne@68 77 <h2 class="section"> <a href="gettext_toc.html#TOC59">8.3 Emacs's PO File Editor</a> </h2>
jpayne@68 78
jpayne@68 79
jpayne@68 80 <p>For those of you being
jpayne@68 81 the lucky users of Emacs, PO mode has been specifically created
jpayne@68 82 for providing a cozy environment for editing or modifying PO files.
jpayne@68 83 While editing a PO file, PO mode allows for the easy browsing of
jpayne@68 84 auxiliary and compendium PO files, as well as for following references into
jpayne@68 85 the set of C program sources from which PO files have been derived.
jpayne@68 86 It has a few special features, among which are the interactive marking
jpayne@68 87 of program strings as translatable, and the validation of PO files
jpayne@68 88 with easy repositioning to PO file lines showing errors.
jpayne@68 89 </p>
jpayne@68 90 <p>For the beginning, besides main PO mode commands
jpayne@68 91 (see section <a href="#SEC68">Main PO mode Commands</a>), you should know how to move between entries
jpayne@68 92 (see section <a href="#SEC69">Entry Positioning</a>), and how to handle untranslated entries
jpayne@68 93 (see section <a href="#SEC73">Untranslated Entries</a>).
jpayne@68 94 </p>
jpayne@68 95
jpayne@68 96
jpayne@68 97 <a name="Installation"></a>
jpayne@68 98 <a name="SEC67"></a>
jpayne@68 99 <h3 class="subsection"> <a href="gettext_toc.html#TOC60">8.3.1 Completing GNU <code>gettext</code> Installation</a> </h3>
jpayne@68 100
jpayne@68 101 <p>Once you have received, unpacked, configured and compiled the GNU
jpayne@68 102 <code>gettext</code> distribution, the &lsquo;<samp>make install</samp>&rsquo; command puts in
jpayne@68 103 place the programs <code>xgettext</code>, <code>msgfmt</code>, <code>gettext</code>, and
jpayne@68 104 <code>msgmerge</code>, as well as their available message catalogs. To
jpayne@68 105 top off a comfortable installation, you might also want to make the
jpayne@68 106 PO mode available to your Emacs users.
jpayne@68 107 </p>
jpayne@68 108 <a name="IDX312"></a>
jpayne@68 109 <a name="IDX313"></a>
jpayne@68 110 <p>During the installation of the PO mode, you might want to modify your
jpayne@68 111 file &lsquo;<tt>.emacs</tt>&rsquo;, once and for all, so it contains a few lines looking
jpayne@68 112 like:
jpayne@68 113 </p>
jpayne@68 114 <table><tr><td>&nbsp;</td><td><pre class="example">(setq auto-mode-alist
jpayne@68 115 (cons '(&quot;\\.po\\'\\|\\.po\\.&quot; . po-mode) auto-mode-alist))
jpayne@68 116 (autoload 'po-mode &quot;po-mode&quot; &quot;Major mode for translators to edit PO files&quot; t)
jpayne@68 117 </pre></td></tr></table>
jpayne@68 118
jpayne@68 119 <p>Later, whenever you edit some &lsquo;<tt>.po</tt>&rsquo;
jpayne@68 120 file, or any file having the string &lsquo;<samp>.po.</samp>&rsquo; within its name,
jpayne@68 121 Emacs loads &lsquo;<tt>po-mode.elc</tt>&rsquo; (or &lsquo;<tt>po-mode.el</tt>&rsquo;) as needed, and
jpayne@68 122 automatically activates PO mode commands for the associated buffer.
jpayne@68 123 The string <em>PO</em> appears in the mode line for any buffer for
jpayne@68 124 which PO mode is active. Many PO files may be active at once in a
jpayne@68 125 single Emacs session.
jpayne@68 126 </p>
jpayne@68 127 <p>If you are using Emacs version 20 or newer, and have already installed
jpayne@68 128 the appropriate international fonts on your system, you may also tell
jpayne@68 129 Emacs how to determine automatically the coding system of every PO file.
jpayne@68 130 This will often (but not always) cause the necessary fonts to be loaded
jpayne@68 131 and used for displaying the translations on your Emacs screen. For this
jpayne@68 132 to happen, add the lines:
jpayne@68 133 </p>
jpayne@68 134 <table><tr><td>&nbsp;</td><td><pre class="example">(modify-coding-system-alist 'file &quot;\\.po\\'\\|\\.po\\.&quot;
jpayne@68 135 'po-find-file-coding-system)
jpayne@68 136 (autoload 'po-find-file-coding-system &quot;po-mode&quot;)
jpayne@68 137 </pre></td></tr></table>
jpayne@68 138
jpayne@68 139 <p>to your &lsquo;<tt>.emacs</tt>&rsquo; file. If, with this, you still see boxes instead
jpayne@68 140 of international characters, try a different font set (via Shift Mouse
jpayne@68 141 button 1).
jpayne@68 142 </p>
jpayne@68 143
jpayne@68 144 <a name="Main-PO-Commands"></a>
jpayne@68 145 <a name="SEC68"></a>
jpayne@68 146 <h3 class="subsection"> <a href="gettext_toc.html#TOC61">8.3.2 Main PO mode Commands</a> </h3>
jpayne@68 147
jpayne@68 148 <p>After setting up Emacs with something similar to the lines in
jpayne@68 149 <a href="#SEC67">Completing GNU <code>gettext</code> Installation</a>, PO mode is activated for a window when Emacs finds a
jpayne@68 150 PO file in that window. This puts the window read-only and establishes a
jpayne@68 151 po-mode-map, which is a genuine Emacs mode, in a way that is not derived
jpayne@68 152 from text mode in any way. Functions found on <code>po-mode-hook</code>,
jpayne@68 153 if any, will be executed.
jpayne@68 154 </p>
jpayne@68 155 <p>When PO mode is active in a window, the letters &lsquo;<samp>PO</samp>&rsquo; appear
jpayne@68 156 in the mode line for that window. The mode line also displays how
jpayne@68 157 many entries of each kind are held in the PO file. For example,
jpayne@68 158 the string &lsquo;<samp>132t+3f+10u+2o</samp>&rsquo; would tell the translator that the
jpayne@68 159 PO mode contains 132 translated entries (see section <a href="#SEC71">Translated Entries</a>,
jpayne@68 160 3 fuzzy entries (see section <a href="#SEC72">Fuzzy Entries</a>), 10 untranslated entries
jpayne@68 161 (see section <a href="#SEC73">Untranslated Entries</a>) and 2 obsolete entries (see section <a href="#SEC74">Obsolete Entries</a>). Zero-coefficients items are not shown. So, in this example, if
jpayne@68 162 the fuzzy entries were unfuzzied, the untranslated entries were translated
jpayne@68 163 and the obsolete entries were deleted, the mode line would merely display
jpayne@68 164 &lsquo;<samp>145t</samp>&rsquo; for the counters.
jpayne@68 165 </p>
jpayne@68 166 <p>The main PO commands are those which do not fit into the other categories of
jpayne@68 167 subsequent sections. These allow for quitting PO mode or for managing windows
jpayne@68 168 in special ways.
jpayne@68 169 </p>
jpayne@68 170 <dl compact="compact">
jpayne@68 171 <dt> <kbd>_</kbd></dt>
jpayne@68 172 <dd><a name="IDX314"></a>
jpayne@68 173 <p>Undo last modification to the PO file (<code>po-undo</code>).
jpayne@68 174 </p>
jpayne@68 175 </dd>
jpayne@68 176 <dt> <kbd>Q</kbd></dt>
jpayne@68 177 <dd><a name="IDX315"></a>
jpayne@68 178 <p>Quit processing and save the PO file (<code>po-quit</code>).
jpayne@68 179 </p>
jpayne@68 180 </dd>
jpayne@68 181 <dt> <kbd>q</kbd></dt>
jpayne@68 182 <dd><a name="IDX316"></a>
jpayne@68 183 <p>Quit processing, possibly after confirmation (<code>po-confirm-and-quit</code>).
jpayne@68 184 </p>
jpayne@68 185 </dd>
jpayne@68 186 <dt> <kbd>0</kbd></dt>
jpayne@68 187 <dd><a name="IDX317"></a>
jpayne@68 188 <p>Temporary leave the PO file window (<code>po-other-window</code>).
jpayne@68 189 </p>
jpayne@68 190 </dd>
jpayne@68 191 <dt> <kbd>?</kbd></dt>
jpayne@68 192 <dt> <kbd>h</kbd></dt>
jpayne@68 193 <dd><a name="IDX318"></a>
jpayne@68 194 <a name="IDX319"></a>
jpayne@68 195 <p>Show help about PO mode (<code>po-help</code>).
jpayne@68 196 </p>
jpayne@68 197 </dd>
jpayne@68 198 <dt> <kbd>=</kbd></dt>
jpayne@68 199 <dd><a name="IDX320"></a>
jpayne@68 200 <p>Give some PO file statistics (<code>po-statistics</code>).
jpayne@68 201 </p>
jpayne@68 202 </dd>
jpayne@68 203 <dt> <kbd>V</kbd></dt>
jpayne@68 204 <dd><a name="IDX321"></a>
jpayne@68 205 <p>Batch validate the format of the whole PO file (<code>po-validate</code>).
jpayne@68 206 </p>
jpayne@68 207 </dd>
jpayne@68 208 </dl>
jpayne@68 209
jpayne@68 210 <a name="IDX322"></a>
jpayne@68 211 <a name="IDX323"></a>
jpayne@68 212 <p>The command <kbd>_</kbd> (<code>po-undo</code>) interfaces to the Emacs
jpayne@68 213 <em>undo</em> facility. See <a href="../emacs/Undo.html#Undo">(emacs)Undo</a> section `Undoing Changes' in <cite>The Emacs Editor</cite>. Each time <kbd>_</kbd> is typed, modifications which the translator
jpayne@68 214 did to the PO file are undone a little more. For the purpose of
jpayne@68 215 undoing, each PO mode command is atomic. This is especially true for
jpayne@68 216 the <kbd>&lt;RET&gt;</kbd> command: the whole edition made by using a single
jpayne@68 217 use of this command is undone at once, even if the edition itself
jpayne@68 218 implied several actions. However, while in the editing window, one
jpayne@68 219 can undo the edition work quite parsimoniously.
jpayne@68 220 </p>
jpayne@68 221 <a name="IDX324"></a>
jpayne@68 222 <a name="IDX325"></a>
jpayne@68 223 <a name="IDX326"></a>
jpayne@68 224 <a name="IDX327"></a>
jpayne@68 225 <p>The commands <kbd>Q</kbd> (<code>po-quit</code>) and <kbd>q</kbd>
jpayne@68 226 (<code>po-confirm-and-quit</code>) are used when the translator is done with the
jpayne@68 227 PO file. The former is a bit less verbose than the latter. If the file
jpayne@68 228 has been modified, it is saved to disk first. In both cases, and prior to
jpayne@68 229 all this, the commands check if any untranslated messages remain in the
jpayne@68 230 PO file and, if so, the translator is asked if she really wants to leave
jpayne@68 231 off working with this PO file. This is the preferred way of getting rid
jpayne@68 232 of an Emacs PO file buffer. Merely killing it through the usual command
jpayne@68 233 <kbd>C-x k</kbd> (<code>kill-buffer</code>) is not the tidiest way to proceed.
jpayne@68 234 </p>
jpayne@68 235 <a name="IDX328"></a>
jpayne@68 236 <a name="IDX329"></a>
jpayne@68 237 <p>The command <kbd>0</kbd> (<code>po-other-window</code>) is another, softer way,
jpayne@68 238 to leave PO mode, temporarily. It just moves the cursor to some other
jpayne@68 239 Emacs window, and pops one if necessary. For example, if the translator
jpayne@68 240 just got PO mode to show some source context in some other, she might
jpayne@68 241 discover some apparent bug in the program source that needs correction.
jpayne@68 242 This command allows the translator to change sex, become a programmer,
jpayne@68 243 and have the cursor right into the window containing the program she
jpayne@68 244 (or rather <em>he</em>) wants to modify. By later getting the cursor back
jpayne@68 245 in the PO file window, or by asking Emacs to edit this file once again,
jpayne@68 246 PO mode is then recovered.
jpayne@68 247 </p>
jpayne@68 248 <a name="IDX330"></a>
jpayne@68 249 <a name="IDX331"></a>
jpayne@68 250 <a name="IDX332"></a>
jpayne@68 251 <p>The command <kbd>h</kbd> (<code>po-help</code>) displays a summary of all available PO
jpayne@68 252 mode commands. The translator should then type any character to resume
jpayne@68 253 normal PO mode operations. The command <kbd>?</kbd> has the same effect
jpayne@68 254 as <kbd>h</kbd>.
jpayne@68 255 </p>
jpayne@68 256 <a name="IDX333"></a>
jpayne@68 257 <a name="IDX334"></a>
jpayne@68 258 <p>The command <kbd>=</kbd> (<code>po-statistics</code>) computes the total number of
jpayne@68 259 entries in the PO file, the ordinal of the current entry (counted from
jpayne@68 260 1), the number of untranslated entries, the number of obsolete entries,
jpayne@68 261 and displays all these numbers.
jpayne@68 262 </p>
jpayne@68 263 <a name="IDX335"></a>
jpayne@68 264 <a name="IDX336"></a>
jpayne@68 265 <p>The command <kbd>V</kbd> (<code>po-validate</code>) launches <code>msgfmt</code> in
jpayne@68 266 checking and verbose
jpayne@68 267 mode over the current PO file. This command first offers to save the
jpayne@68 268 current PO file on disk. The <code>msgfmt</code> tool, from GNU <code>gettext</code>,
jpayne@68 269 has the purpose of creating a MO file out of a PO file, and PO mode uses
jpayne@68 270 the features of this program for checking the overall format of a PO file,
jpayne@68 271 as well as all individual entries.
jpayne@68 272 </p>
jpayne@68 273 <a name="IDX337"></a>
jpayne@68 274 <p>The program <code>msgfmt</code> runs asynchronously with Emacs, so the
jpayne@68 275 translator regains control immediately while her PO file is being studied.
jpayne@68 276 Error output is collected in the Emacs &lsquo;<samp>*compilation*</samp>&rsquo; buffer,
jpayne@68 277 displayed in another window. The regular Emacs command <kbd>C-x`</kbd>
jpayne@68 278 (<code>next-error</code>), as well as other usual compile commands, allow the
jpayne@68 279 translator to reposition quickly to the offending parts of the PO file.
jpayne@68 280 Once the cursor is on the line in error, the translator may decide on
jpayne@68 281 any PO mode action which would help correcting the error.
jpayne@68 282 </p>
jpayne@68 283
jpayne@68 284 <a name="Entry-Positioning"></a>
jpayne@68 285 <a name="SEC69"></a>
jpayne@68 286 <h3 class="subsection"> <a href="gettext_toc.html#TOC62">8.3.3 Entry Positioning</a> </h3>
jpayne@68 287
jpayne@68 288 <p>The cursor in a PO file window is almost always part of
jpayne@68 289 an entry. The only exceptions are the special case when the cursor
jpayne@68 290 is after the last entry in the file, or when the PO file is
jpayne@68 291 empty. The entry where the cursor is found to be is said to be the
jpayne@68 292 current entry. Many PO mode commands operate on the current entry,
jpayne@68 293 so moving the cursor does more than allowing the translator to browse
jpayne@68 294 the PO file, this also selects on which entry commands operate.
jpayne@68 295 </p>
jpayne@68 296 <a name="IDX338"></a>
jpayne@68 297 <p>Some PO mode commands alter the position of the cursor in a specialized
jpayne@68 298 way. A few of those special purpose positioning are described here,
jpayne@68 299 the others are described in following sections (for a complete list try
jpayne@68 300 <kbd>C-h m</kbd>):
jpayne@68 301 </p>
jpayne@68 302 <dl compact="compact">
jpayne@68 303 <dt> <kbd>.</kbd></dt>
jpayne@68 304 <dd><a name="IDX339"></a>
jpayne@68 305 <p>Redisplay the current entry (<code>po-current-entry</code>).
jpayne@68 306 </p>
jpayne@68 307 </dd>
jpayne@68 308 <dt> <kbd>n</kbd></dt>
jpayne@68 309 <dd><a name="IDX340"></a>
jpayne@68 310 <p>Select the entry after the current one (<code>po-next-entry</code>).
jpayne@68 311 </p>
jpayne@68 312 </dd>
jpayne@68 313 <dt> <kbd>p</kbd></dt>
jpayne@68 314 <dd><a name="IDX341"></a>
jpayne@68 315 <p>Select the entry before the current one (<code>po-previous-entry</code>).
jpayne@68 316 </p>
jpayne@68 317 </dd>
jpayne@68 318 <dt> <kbd>&lt;</kbd></dt>
jpayne@68 319 <dd><a name="IDX342"></a>
jpayne@68 320 <p>Select the first entry in the PO file (<code>po-first-entry</code>).
jpayne@68 321 </p>
jpayne@68 322 </dd>
jpayne@68 323 <dt> <kbd>&gt;</kbd></dt>
jpayne@68 324 <dd><a name="IDX343"></a>
jpayne@68 325 <p>Select the last entry in the PO file (<code>po-last-entry</code>).
jpayne@68 326 </p>
jpayne@68 327 </dd>
jpayne@68 328 <dt> <kbd>m</kbd></dt>
jpayne@68 329 <dd><a name="IDX344"></a>
jpayne@68 330 <p>Record the location of the current entry for later use
jpayne@68 331 (<code>po-push-location</code>).
jpayne@68 332 </p>
jpayne@68 333 </dd>
jpayne@68 334 <dt> <kbd>r</kbd></dt>
jpayne@68 335 <dd><a name="IDX345"></a>
jpayne@68 336 <p>Return to a previously saved entry location (<code>po-pop-location</code>).
jpayne@68 337 </p>
jpayne@68 338 </dd>
jpayne@68 339 <dt> <kbd>x</kbd></dt>
jpayne@68 340 <dd><a name="IDX346"></a>
jpayne@68 341 <p>Exchange the current entry location with the previously saved one
jpayne@68 342 (<code>po-exchange-location</code>).
jpayne@68 343 </p>
jpayne@68 344 </dd>
jpayne@68 345 </dl>
jpayne@68 346
jpayne@68 347 <a name="IDX347"></a>
jpayne@68 348 <a name="IDX348"></a>
jpayne@68 349 <p>Any Emacs command able to reposition the cursor may be used
jpayne@68 350 to select the current entry in PO mode, including commands which
jpayne@68 351 move by characters, lines, paragraphs, screens or pages, and search
jpayne@68 352 commands. However, there is a kind of standard way to display the
jpayne@68 353 current entry in PO mode, which usual Emacs commands moving
jpayne@68 354 the cursor do not especially try to enforce. The command <kbd>.</kbd>
jpayne@68 355 (<code>po-current-entry</code>) has the sole purpose of redisplaying the
jpayne@68 356 current entry properly, after the current entry has been changed by
jpayne@68 357 means external to PO mode, or the Emacs screen otherwise altered.
jpayne@68 358 </p>
jpayne@68 359 <p>It is yet to be decided if PO mode helps the translator, or otherwise
jpayne@68 360 irritates her, by forcing a rigid window disposition while she
jpayne@68 361 is doing her work. We originally had quite precise ideas about
jpayne@68 362 how windows should behave, but on the other hand, anyone used to
jpayne@68 363 Emacs is often happy to keep full control. Maybe a fixed window
jpayne@68 364 disposition might be offered as a PO mode option that the translator
jpayne@68 365 might activate or deactivate at will, so it could be offered on an
jpayne@68 366 experimental basis. If nobody feels a real need for using it, or
jpayne@68 367 a compulsion for writing it, we should drop this whole idea.
jpayne@68 368 The incentive for doing it should come from translators rather than
jpayne@68 369 programmers, as opinions from an experienced translator are surely
jpayne@68 370 more worth to me than opinions from programmers <em>thinking</em> about
jpayne@68 371 how <em>others</em> should do translation.
jpayne@68 372 </p>
jpayne@68 373 <a name="IDX349"></a>
jpayne@68 374 <a name="IDX350"></a>
jpayne@68 375 <a name="IDX351"></a>
jpayne@68 376 <a name="IDX352"></a>
jpayne@68 377 <p>The commands <kbd>n</kbd> (<code>po-next-entry</code>) and <kbd>p</kbd>
jpayne@68 378 (<code>po-previous-entry</code>) move the cursor the entry following,
jpayne@68 379 or preceding, the current one. If <kbd>n</kbd> is given while the
jpayne@68 380 cursor is on the last entry of the PO file, or if <kbd>p</kbd>
jpayne@68 381 is given while the cursor is on the first entry, no move is done.
jpayne@68 382 </p>
jpayne@68 383 <a name="IDX353"></a>
jpayne@68 384 <a name="IDX354"></a>
jpayne@68 385 <a name="IDX355"></a>
jpayne@68 386 <a name="IDX356"></a>
jpayne@68 387 <p>The commands <kbd>&lt;</kbd> (<code>po-first-entry</code>) and <kbd>&gt;</kbd>
jpayne@68 388 (<code>po-last-entry</code>) move the cursor to the first entry, or last
jpayne@68 389 entry, of the PO file. When the cursor is located past the last
jpayne@68 390 entry in a PO file, most PO mode commands will return an error saying
jpayne@68 391 &lsquo;<samp>After last entry</samp>&rsquo;. Moreover, the commands <kbd>&lt;</kbd> and <kbd>&gt;</kbd>
jpayne@68 392 have the special property of being able to work even when the cursor
jpayne@68 393 is not into some PO file entry, and one may use them for nicely
jpayne@68 394 correcting this situation. But even these commands will fail on a
jpayne@68 395 truly empty PO file. There are development plans for the PO mode for it
jpayne@68 396 to interactively fill an empty PO file from sources. See section <a href="gettext_4.html#SEC29">Marking Translatable Strings</a>.
jpayne@68 397 </p>
jpayne@68 398 <p>The translator may decide, before working at the translation of
jpayne@68 399 a particular entry, that she needs to browse the remainder of the
jpayne@68 400 PO file, maybe for finding the terminology or phraseology used
jpayne@68 401 in related entries. She can of course use the standard Emacs idioms
jpayne@68 402 for saving the current cursor location in some register, and use that
jpayne@68 403 register for getting back, or else, use the location ring.
jpayne@68 404 </p>
jpayne@68 405 <a name="IDX357"></a>
jpayne@68 406 <a name="IDX358"></a>
jpayne@68 407 <a name="IDX359"></a>
jpayne@68 408 <a name="IDX360"></a>
jpayne@68 409 <p>PO mode offers another approach, by which cursor locations may be saved
jpayne@68 410 onto a special stack. The command <kbd>m</kbd> (<code>po-push-location</code>)
jpayne@68 411 merely adds the location of current entry to the stack, pushing
jpayne@68 412 the already saved locations under the new one. The command
jpayne@68 413 <kbd>r</kbd> (<code>po-pop-location</code>) consumes the top stack element and
jpayne@68 414 repositions the cursor to the entry associated with that top element.
jpayne@68 415 This position is then lost, for the next <kbd>r</kbd> will move the cursor
jpayne@68 416 to the previously saved location, and so on until no locations remain
jpayne@68 417 on the stack.
jpayne@68 418 </p>
jpayne@68 419 <p>If the translator wants the position to be kept on the location stack,
jpayne@68 420 maybe for taking a look at the entry associated with the top
jpayne@68 421 element, then go elsewhere with the intent of getting back later, she
jpayne@68 422 ought to use <kbd>m</kbd> immediately after <kbd>r</kbd>.
jpayne@68 423 </p>
jpayne@68 424 <a name="IDX361"></a>
jpayne@68 425 <a name="IDX362"></a>
jpayne@68 426 <p>The command <kbd>x</kbd> (<code>po-exchange-location</code>) simultaneously
jpayne@68 427 repositions the cursor to the entry associated with the top element of
jpayne@68 428 the stack of saved locations, and replaces that top element with the
jpayne@68 429 location of the current entry before the move. Consequently, repeating
jpayne@68 430 the <kbd>x</kbd> command toggles alternatively between two entries.
jpayne@68 431 For achieving this, the translator will position the cursor on the
jpayne@68 432 first entry, use <kbd>m</kbd>, then position to the second entry, and
jpayne@68 433 merely use <kbd>x</kbd> for making the switch.
jpayne@68 434 </p>
jpayne@68 435
jpayne@68 436 <a name="Normalizing"></a>
jpayne@68 437 <a name="SEC70"></a>
jpayne@68 438 <h3 class="subsection"> <a href="gettext_toc.html#TOC63">8.3.4 Normalizing Strings in Entries</a> </h3>
jpayne@68 439
jpayne@68 440 <p>There are many different ways for encoding a particular string into a
jpayne@68 441 PO file entry, because there are so many different ways to split and
jpayne@68 442 quote multi-line strings, and even, to represent special characters
jpayne@68 443 by backslashed escaped sequences. Some features of PO mode rely on
jpayne@68 444 the ability for PO mode to scan an already existing PO file for a
jpayne@68 445 particular string encoded into the <code>msgid</code> field of some entry.
jpayne@68 446 Even if PO mode has internally all the built-in machinery for
jpayne@68 447 implementing this recognition easily, doing it fast is technically
jpayne@68 448 difficult. To facilitate a solution to this efficiency problem,
jpayne@68 449 we decided on a canonical representation for strings.
jpayne@68 450 </p>
jpayne@68 451 <p>A conventional representation of strings in a PO file is currently
jpayne@68 452 under discussion, and PO mode experiments with a canonical representation.
jpayne@68 453 Having both <code>xgettext</code> and PO mode converging towards a uniform
jpayne@68 454 way of representing equivalent strings would be useful, as the internal
jpayne@68 455 normalization needed by PO mode could be automatically satisfied
jpayne@68 456 when using <code>xgettext</code> from GNU <code>gettext</code>. An explicit
jpayne@68 457 PO mode normalization should then be only necessary for PO files
jpayne@68 458 imported from elsewhere, or for when the convention itself evolves.
jpayne@68 459 </p>
jpayne@68 460 <p>So, for achieving normalization of at least the strings of a given
jpayne@68 461 PO file needing a canonical representation, the following PO mode
jpayne@68 462 command is available:
jpayne@68 463 </p>
jpayne@68 464 <a name="IDX363"></a>
jpayne@68 465 <dl compact="compact">
jpayne@68 466 <dt> <kbd>M-x po-normalize</kbd></dt>
jpayne@68 467 <dd><a name="IDX364"></a>
jpayne@68 468 <p>Tidy the whole PO file by making entries more uniform.
jpayne@68 469 </p>
jpayne@68 470 </dd>
jpayne@68 471 </dl>
jpayne@68 472
jpayne@68 473 <p>The special command <kbd>M-x po-normalize</kbd>, which has no associated
jpayne@68 474 keys, revises all entries, ensuring that strings of both original
jpayne@68 475 and translated entries use uniform internal quoting in the PO file.
jpayne@68 476 It also removes any crumb after the last entry. This command may be
jpayne@68 477 useful for PO files freshly imported from elsewhere, or if we ever
jpayne@68 478 improve on the canonical quoting format we use. This canonical format
jpayne@68 479 is not only meant for getting cleaner PO files, but also for greatly
jpayne@68 480 speeding up <code>msgid</code> string lookup for some other PO mode commands.
jpayne@68 481 </p>
jpayne@68 482 <p><kbd>M-x po-normalize</kbd> presently makes three passes over the entries.
jpayne@68 483 The first implements heuristics for converting PO files for GNU
jpayne@68 484 <code>gettext</code> 0.6 and earlier, in which <code>msgid</code> and <code>msgstr</code>
jpayne@68 485 fields were using K&amp;R style C string syntax for multi-line strings.
jpayne@68 486 These heuristics may fail for comments not related to obsolete
jpayne@68 487 entries and ending with a backslash; they also depend on subsequent
jpayne@68 488 passes for finalizing the proper commenting of continued lines for
jpayne@68 489 obsolete entries. This first pass might disappear once all oldish PO
jpayne@68 490 files would have been adjusted. The second and third pass normalize
jpayne@68 491 all <code>msgid</code> and <code>msgstr</code> strings respectively. They also
jpayne@68 492 clean out those trailing backslashes used by XView's <code>msgfmt</code>
jpayne@68 493 for continued lines.
jpayne@68 494 </p>
jpayne@68 495 <a name="IDX365"></a>
jpayne@68 496 <p>Having such an explicit normalizing command allows for importing PO
jpayne@68 497 files from other sources, but also eases the evolution of the current
jpayne@68 498 convention, evolution driven mostly by aesthetic concerns, as of now.
jpayne@68 499 It is easy to make suggested adjustments at a later time, as the
jpayne@68 500 normalizing command and eventually, other GNU <code>gettext</code> tools
jpayne@68 501 should greatly automate conformance. A description of the canonical
jpayne@68 502 string format is given below, for the particular benefit of those not
jpayne@68 503 having Emacs handy, and who would nevertheless want to handcraft
jpayne@68 504 their PO files in nice ways.
jpayne@68 505 </p>
jpayne@68 506 <a name="IDX366"></a>
jpayne@68 507 <p>Right now, in PO mode, strings are single line or multi-line. A string
jpayne@68 508 goes multi-line if and only if it has <em>embedded</em> newlines, that
jpayne@68 509 is, if it matches &lsquo;<samp>[^\n]\n+[^\n]</samp>&rsquo;. So, we would have:
jpayne@68 510 </p>
jpayne@68 511 <table><tr><td>&nbsp;</td><td><pre class="example">msgstr &quot;\n\nHello, world!\n\n\n&quot;
jpayne@68 512 </pre></td></tr></table>
jpayne@68 513
jpayne@68 514 <p>but, replacing the space by a newline, this becomes:
jpayne@68 515 </p>
jpayne@68 516 <table><tr><td>&nbsp;</td><td><pre class="example">msgstr &quot;&quot;
jpayne@68 517 &quot;\n&quot;
jpayne@68 518 &quot;\n&quot;
jpayne@68 519 &quot;Hello,\n&quot;
jpayne@68 520 &quot;world!\n&quot;
jpayne@68 521 &quot;\n&quot;
jpayne@68 522 &quot;\n&quot;
jpayne@68 523 </pre></td></tr></table>
jpayne@68 524
jpayne@68 525 <p>We are deliberately using a caricatural example, here, to make the
jpayne@68 526 point clearer. Usually, multi-lines are not that bad looking.
jpayne@68 527 It is probable that we will implement the following suggestion.
jpayne@68 528 We might lump together all initial newlines into the empty string,
jpayne@68 529 and also all newlines introducing empty lines (that is, for <var>n</var>
jpayne@68 530 &gt; 1, the <var>n</var>-1'th last newlines would go together on a separate
jpayne@68 531 string), so making the previous example appear:
jpayne@68 532 </p>
jpayne@68 533 <table><tr><td>&nbsp;</td><td><pre class="example">msgstr &quot;\n\n&quot;
jpayne@68 534 &quot;Hello,\n&quot;
jpayne@68 535 &quot;world!\n&quot;
jpayne@68 536 &quot;\n\n&quot;
jpayne@68 537 </pre></td></tr></table>
jpayne@68 538
jpayne@68 539 <p>There are a few yet undecided little points about string normalization,
jpayne@68 540 to be documented in this manual, once these questions settle.
jpayne@68 541 </p>
jpayne@68 542
jpayne@68 543 <a name="Translated-Entries"></a>
jpayne@68 544 <a name="SEC71"></a>
jpayne@68 545 <h3 class="subsection"> <a href="gettext_toc.html#TOC64">8.3.5 Translated Entries</a> </h3>
jpayne@68 546
jpayne@68 547 <p>Each PO file entry for which the <code>msgstr</code> field has been filled with
jpayne@68 548 a translation, and which is not marked as fuzzy (see section <a href="#SEC72">Fuzzy Entries</a>),
jpayne@68 549 is said to be a <em>translated</em> entry. Only translated entries will
jpayne@68 550 later be compiled by GNU <code>msgfmt</code> and become usable in programs.
jpayne@68 551 Other entry types will be excluded; translation will not occur for them.
jpayne@68 552 </p>
jpayne@68 553 <a name="IDX367"></a>
jpayne@68 554 <p>Some commands are more specifically related to translated entry processing.
jpayne@68 555 </p>
jpayne@68 556 <dl compact="compact">
jpayne@68 557 <dt> <kbd>t</kbd></dt>
jpayne@68 558 <dd><a name="IDX368"></a>
jpayne@68 559 <p>Find the next translated entry (<code>po-next-translated-entry</code>).
jpayne@68 560 </p>
jpayne@68 561 </dd>
jpayne@68 562 <dt> <kbd>T</kbd></dt>
jpayne@68 563 <dd><a name="IDX369"></a>
jpayne@68 564 <p>Find the previous translated entry (<code>po-previous-translated-entry</code>).
jpayne@68 565 </p>
jpayne@68 566 </dd>
jpayne@68 567 </dl>
jpayne@68 568
jpayne@68 569 <a name="IDX370"></a>
jpayne@68 570 <a name="IDX371"></a>
jpayne@68 571 <a name="IDX372"></a>
jpayne@68 572 <a name="IDX373"></a>
jpayne@68 573 <p>The commands <kbd>t</kbd> (<code>po-next-translated-entry</code>) and <kbd>T</kbd>
jpayne@68 574 (<code>po-previous-translated-entry</code>) move forwards or backwards, chasing
jpayne@68 575 for an translated entry. If none is found, the search is extended and
jpayne@68 576 wraps around in the PO file buffer.
jpayne@68 577 </p>
jpayne@68 578 <a name="IDX374"></a>
jpayne@68 579 <p>Translated entries usually result from the translator having edited in
jpayne@68 580 a translation for them, <a href="#SEC75">Modifying Translations</a>. However, if the
jpayne@68 581 variable <code>po-auto-fuzzy-on-edit</code> is not <code>nil</code>, the entry having
jpayne@68 582 received a new translation first becomes a fuzzy entry, which ought to
jpayne@68 583 be later unfuzzied before becoming an official, genuine translated entry.
jpayne@68 584 See section <a href="#SEC72">Fuzzy Entries</a>.
jpayne@68 585 </p>
jpayne@68 586
jpayne@68 587 <a name="Fuzzy-Entries"></a>
jpayne@68 588 <a name="SEC72"></a>
jpayne@68 589 <h3 class="subsection"> <a href="gettext_toc.html#TOC65">8.3.6 Fuzzy Entries</a> </h3>
jpayne@68 590
jpayne@68 591 <p>Each PO file entry may have a set of <em>attributes</em>, which are
jpayne@68 592 qualities given a name and explicitly associated with the translation,
jpayne@68 593 using a special system comment. One of these attributes
jpayne@68 594 has the name <code>fuzzy</code>, and entries having this attribute are said
jpayne@68 595 to have a fuzzy translation. They are called fuzzy entries, for short.
jpayne@68 596 </p>
jpayne@68 597 <p>Fuzzy entries, even if they account for translated entries for
jpayne@68 598 most other purposes, usually call for revision by the translator.
jpayne@68 599 Those may be produced by applying the program <code>msgmerge</code> to
jpayne@68 600 update an older translated PO files according to a new PO template
jpayne@68 601 file, when this tool hypothesises that some new <code>msgid</code> has
jpayne@68 602 been modified only slightly out of an older one, and chooses to pair
jpayne@68 603 what it thinks to be the old translation for the new modified entry.
jpayne@68 604 The slight alteration in the original string (the <code>msgid</code> string)
jpayne@68 605 should often be reflected in the translated string, and this requires
jpayne@68 606 the intervention of the translator. For this reason, <code>msgmerge</code>
jpayne@68 607 might mark some entries as being fuzzy.
jpayne@68 608 </p>
jpayne@68 609 <a name="IDX375"></a>
jpayne@68 610 <p>Also, the translator may decide herself to mark an entry as fuzzy
jpayne@68 611 for her own convenience, when she wants to remember that the entry
jpayne@68 612 has to be later revisited. So, some commands are more specifically
jpayne@68 613 related to fuzzy entry processing.
jpayne@68 614 </p>
jpayne@68 615 <dl compact="compact">
jpayne@68 616 <dt> <kbd>f</kbd></dt>
jpayne@68 617 <dd><a name="IDX376"></a>
jpayne@68 618 <p>Find the next fuzzy entry (<code>po-next-fuzzy-entry</code>).
jpayne@68 619 </p>
jpayne@68 620 </dd>
jpayne@68 621 <dt> <kbd>F</kbd></dt>
jpayne@68 622 <dd><a name="IDX377"></a>
jpayne@68 623 <p>Find the previous fuzzy entry (<code>po-previous-fuzzy-entry</code>).
jpayne@68 624 </p>
jpayne@68 625 </dd>
jpayne@68 626 <dt> <kbd>&lt;TAB&gt;</kbd></dt>
jpayne@68 627 <dd><a name="IDX378"></a>
jpayne@68 628 <p>Remove the fuzzy attribute of the current entry (<code>po-unfuzzy</code>).
jpayne@68 629 </p>
jpayne@68 630 </dd>
jpayne@68 631 </dl>
jpayne@68 632
jpayne@68 633 <a name="IDX379"></a>
jpayne@68 634 <a name="IDX380"></a>
jpayne@68 635 <a name="IDX381"></a>
jpayne@68 636 <a name="IDX382"></a>
jpayne@68 637 <p>The commands <kbd>f</kbd> (<code>po-next-fuzzy-entry</code>) and <kbd>F</kbd>
jpayne@68 638 (<code>po-previous-fuzzy-entry</code>) move forwards or backwards, chasing for
jpayne@68 639 a fuzzy entry. If none is found, the search is extended and wraps
jpayne@68 640 around in the PO file buffer.
jpayne@68 641 </p>
jpayne@68 642 <a name="IDX383"></a>
jpayne@68 643 <a name="IDX384"></a>
jpayne@68 644 <a name="IDX385"></a>
jpayne@68 645 <p>The command <kbd>&lt;TAB&gt;</kbd> (<code>po-unfuzzy</code>) removes the fuzzy
jpayne@68 646 attribute associated with an entry, usually leaving it translated.
jpayne@68 647 Further, if the variable <code>po-auto-select-on-unfuzzy</code> has not
jpayne@68 648 the <code>nil</code> value, the <kbd>&lt;TAB&gt;</kbd> command will automatically chase
jpayne@68 649 for another interesting entry to work on. The initial value of
jpayne@68 650 <code>po-auto-select-on-unfuzzy</code> is <code>nil</code>.
jpayne@68 651 </p>
jpayne@68 652 <p>The initial value of <code>po-auto-fuzzy-on-edit</code> is <code>nil</code>. However,
jpayne@68 653 if the variable <code>po-auto-fuzzy-on-edit</code> is set to <code>t</code>, any entry
jpayne@68 654 edited through the <kbd>&lt;RET&gt;</kbd> command is marked fuzzy, as a way to
jpayne@68 655 ensure some kind of double check, later. In this case, the usual paradigm
jpayne@68 656 is that an entry becomes fuzzy (if not already) whenever the translator
jpayne@68 657 modifies it. If she is satisfied with the translation, she then uses
jpayne@68 658 <kbd>&lt;TAB&gt;</kbd> to pick another entry to work on, clearing the fuzzy attribute
jpayne@68 659 on the same blow. If she is not satisfied yet, she merely uses <kbd>&lt;SPC&gt;</kbd>
jpayne@68 660 to chase another entry, leaving the entry fuzzy.
jpayne@68 661 </p>
jpayne@68 662 <a name="IDX386"></a>
jpayne@68 663 <a name="IDX387"></a>
jpayne@68 664 <p>The translator may also use the <kbd>&lt;DEL&gt;</kbd> command
jpayne@68 665 (<code>po-fade-out-entry</code>) over any translated entry to mark it as being
jpayne@68 666 fuzzy, when she wants to easily leave a trace she wants to later return
jpayne@68 667 working at this entry.
jpayne@68 668 </p>
jpayne@68 669 <p>Also, when time comes to quit working on a PO file buffer with the <kbd>q</kbd>
jpayne@68 670 command, the translator is asked for confirmation, if fuzzy string
jpayne@68 671 still exists.
jpayne@68 672 </p>
jpayne@68 673
jpayne@68 674 <a name="Untranslated-Entries"></a>
jpayne@68 675 <a name="SEC73"></a>
jpayne@68 676 <h3 class="subsection"> <a href="gettext_toc.html#TOC66">8.3.7 Untranslated Entries</a> </h3>
jpayne@68 677
jpayne@68 678 <p>When <code>xgettext</code> originally creates a PO file, unless told
jpayne@68 679 otherwise, it initializes the <code>msgid</code> field with the untranslated
jpayne@68 680 string, and leaves the <code>msgstr</code> string to be empty. Such entries,
jpayne@68 681 having an empty translation, are said to be <em>untranslated</em> entries.
jpayne@68 682 Later, when the programmer slightly modifies some string right in
jpayne@68 683 the program, this change is later reflected in the PO file
jpayne@68 684 by the appearance of a new untranslated entry for the modified string.
jpayne@68 685 </p>
jpayne@68 686 <p>The usual commands moving from entry to entry consider untranslated
jpayne@68 687 entries on the same level as active entries. Untranslated entries
jpayne@68 688 are easily recognizable by the fact they end with &lsquo;<samp>msgstr &quot;&quot;</samp>&rsquo;.
jpayne@68 689 </p>
jpayne@68 690 <a name="IDX388"></a>
jpayne@68 691 <p>The work of the translator might be (quite naively) seen as the process
jpayne@68 692 of seeking for an untranslated entry, editing a translation for
jpayne@68 693 it, and repeating these actions until no untranslated entries remain.
jpayne@68 694 Some commands are more specifically related to untranslated entry
jpayne@68 695 processing.
jpayne@68 696 </p>
jpayne@68 697 <dl compact="compact">
jpayne@68 698 <dt> <kbd>u</kbd></dt>
jpayne@68 699 <dd><a name="IDX389"></a>
jpayne@68 700 <p>Find the next untranslated entry (<code>po-next-untranslated-entry</code>).
jpayne@68 701 </p>
jpayne@68 702 </dd>
jpayne@68 703 <dt> <kbd>U</kbd></dt>
jpayne@68 704 <dd><a name="IDX390"></a>
jpayne@68 705 <p>Find the previous untranslated entry (<code>po-previous-untransted-entry</code>).
jpayne@68 706 </p>
jpayne@68 707 </dd>
jpayne@68 708 <dt> <kbd>k</kbd></dt>
jpayne@68 709 <dd><a name="IDX391"></a>
jpayne@68 710 <p>Turn the current entry into an untranslated one (<code>po-kill-msgstr</code>).
jpayne@68 711 </p>
jpayne@68 712 </dd>
jpayne@68 713 </dl>
jpayne@68 714
jpayne@68 715 <a name="IDX392"></a>
jpayne@68 716 <a name="IDX393"></a>
jpayne@68 717 <a name="IDX394"></a>
jpayne@68 718 <a name="IDX395"></a>
jpayne@68 719 <p>The commands <kbd>u</kbd> (<code>po-next-untranslated-entry</code>) and <kbd>U</kbd>
jpayne@68 720 (<code>po-previous-untransted-entry</code>) move forwards or backwards,
jpayne@68 721 chasing for an untranslated entry. If none is found, the search is
jpayne@68 722 extended and wraps around in the PO file buffer.
jpayne@68 723 </p>
jpayne@68 724 <a name="IDX396"></a>
jpayne@68 725 <a name="IDX397"></a>
jpayne@68 726 <p>An entry can be turned back into an untranslated entry by
jpayne@68 727 merely emptying its translation, using the command <kbd>k</kbd>
jpayne@68 728 (<code>po-kill-msgstr</code>). See section <a href="#SEC75">Modifying Translations</a>.
jpayne@68 729 </p>
jpayne@68 730 <p>Also, when time comes to quit working on a PO file buffer
jpayne@68 731 with the <kbd>q</kbd> command, the translator is asked for confirmation,
jpayne@68 732 if some untranslated string still exists.
jpayne@68 733 </p>
jpayne@68 734
jpayne@68 735 <a name="Obsolete-Entries"></a>
jpayne@68 736 <a name="SEC74"></a>
jpayne@68 737 <h3 class="subsection"> <a href="gettext_toc.html#TOC67">8.3.8 Obsolete Entries</a> </h3>
jpayne@68 738
jpayne@68 739 <p>By <em>obsolete</em> PO file entries, we mean those entries which are
jpayne@68 740 commented out, usually by <code>msgmerge</code> when it found that the
jpayne@68 741 translation is not needed anymore by the package being localized.
jpayne@68 742 </p>
jpayne@68 743 <p>The usual commands moving from entry to entry consider obsolete
jpayne@68 744 entries on the same level as active entries. Obsolete entries are
jpayne@68 745 easily recognizable by the fact that all their lines start with
jpayne@68 746 <code>#</code>, even those lines containing <code>msgid</code> or <code>msgstr</code>.
jpayne@68 747 </p>
jpayne@68 748 <p>Commands exist for emptying the translation or reinitializing it
jpayne@68 749 to the original untranslated string. Commands interfacing with the
jpayne@68 750 kill ring may force some previously saved text into the translation.
jpayne@68 751 The user may interactively edit the translation. All these commands
jpayne@68 752 may apply to obsolete entries, carefully leaving the entry obsolete
jpayne@68 753 after the fact.
jpayne@68 754 </p>
jpayne@68 755 <a name="IDX398"></a>
jpayne@68 756 <p>Moreover, some commands are more specifically related to obsolete
jpayne@68 757 entry processing.
jpayne@68 758 </p>
jpayne@68 759 <dl compact="compact">
jpayne@68 760 <dt> <kbd>o</kbd></dt>
jpayne@68 761 <dd><a name="IDX399"></a>
jpayne@68 762 <p>Find the next obsolete entry (<code>po-next-obsolete-entry</code>).
jpayne@68 763 </p>
jpayne@68 764 </dd>
jpayne@68 765 <dt> <kbd>O</kbd></dt>
jpayne@68 766 <dd><a name="IDX400"></a>
jpayne@68 767 <p>Find the previous obsolete entry (<code>po-previous-obsolete-entry</code>).
jpayne@68 768 </p>
jpayne@68 769 </dd>
jpayne@68 770 <dt> <kbd>&lt;DEL&gt;</kbd></dt>
jpayne@68 771 <dd><a name="IDX401"></a>
jpayne@68 772 <p>Make an active entry obsolete, or zap out an obsolete entry
jpayne@68 773 (<code>po-fade-out-entry</code>).
jpayne@68 774 </p>
jpayne@68 775 </dd>
jpayne@68 776 </dl>
jpayne@68 777
jpayne@68 778 <a name="IDX402"></a>
jpayne@68 779 <a name="IDX403"></a>
jpayne@68 780 <a name="IDX404"></a>
jpayne@68 781 <a name="IDX405"></a>
jpayne@68 782 <p>The commands <kbd>o</kbd> (<code>po-next-obsolete-entry</code>) and <kbd>O</kbd>
jpayne@68 783 (<code>po-previous-obsolete-entry</code>) move forwards or backwards,
jpayne@68 784 chasing for an obsolete entry. If none is found, the search is
jpayne@68 785 extended and wraps around in the PO file buffer.
jpayne@68 786 </p>
jpayne@68 787 <p>PO mode does not provide ways for un-commenting an obsolete entry
jpayne@68 788 and making it active, because this would reintroduce an original
jpayne@68 789 untranslated string which does not correspond to any marked string
jpayne@68 790 in the program sources. This goes with the philosophy of never
jpayne@68 791 introducing useless <code>msgid</code> values.
jpayne@68 792 </p>
jpayne@68 793 <a name="IDX406"></a>
jpayne@68 794 <a name="IDX407"></a>
jpayne@68 795 <a name="IDX408"></a>
jpayne@68 796 <a name="IDX409"></a>
jpayne@68 797 <p>However, it is possible to comment out an active entry, so making
jpayne@68 798 it obsolete. GNU <code>gettext</code> utilities will later react to the
jpayne@68 799 disappearance of a translation by using the untranslated string.
jpayne@68 800 The command <kbd>&lt;DEL&gt;</kbd> (<code>po-fade-out-entry</code>) pushes the current entry
jpayne@68 801 a little further towards annihilation. If the entry is active (it is a
jpayne@68 802 translated entry), then it is first made fuzzy. If it is already fuzzy,
jpayne@68 803 then the entry is merely commented out, with confirmation. If the entry
jpayne@68 804 is already obsolete, then it is completely deleted from the PO file.
jpayne@68 805 It is easy to recycle the translation so deleted into some other PO file
jpayne@68 806 entry, usually one which is untranslated. See section <a href="#SEC75">Modifying Translations</a>.
jpayne@68 807 </p>
jpayne@68 808 <p>Here is a quite interesting problem to solve for later development of
jpayne@68 809 PO mode, for those nights you are not sleepy. The idea would be that
jpayne@68 810 PO mode might become bright enough, one of these days, to make good
jpayne@68 811 guesses at retrieving the most probable candidate, among all obsolete
jpayne@68 812 entries, for initializing the translation of a newly appeared string.
jpayne@68 813 I think it might be a quite hard problem to do this algorithmically, as
jpayne@68 814 we have to develop good and efficient measures of string similarity.
jpayne@68 815 Right now, PO mode completely lets the decision to the translator,
jpayne@68 816 when the time comes to find the adequate obsolete translation, it
jpayne@68 817 merely tries to provide handy tools for helping her to do so.
jpayne@68 818 </p>
jpayne@68 819
jpayne@68 820 <a name="Modifying-Translations"></a>
jpayne@68 821 <a name="SEC75"></a>
jpayne@68 822 <h3 class="subsection"> <a href="gettext_toc.html#TOC68">8.3.9 Modifying Translations</a> </h3>
jpayne@68 823
jpayne@68 824 <p>PO mode prevents direct modification of the PO file, by the usual
jpayne@68 825 means Emacs gives for altering a buffer's contents. By doing so,
jpayne@68 826 it pretends helping the translator to avoid little clerical errors
jpayne@68 827 about the overall file format, or the proper quoting of strings,
jpayne@68 828 as those errors would be easily made. Other kinds of errors are
jpayne@68 829 still possible, but some may be caught and diagnosed by the batch
jpayne@68 830 validation process, which the translator may always trigger by the
jpayne@68 831 <kbd>V</kbd> command. For all other errors, the translator has to rely on
jpayne@68 832 her own judgment, and also on the linguistic reports submitted to her
jpayne@68 833 by the users of the translated package, having the same mother tongue.
jpayne@68 834 </p>
jpayne@68 835 <p>When the time comes to create a translation, correct an error diagnosed
jpayne@68 836 mechanically or reported by a user, the translators have to resort to
jpayne@68 837 using the following commands for modifying the translations.
jpayne@68 838 </p>
jpayne@68 839 <dl compact="compact">
jpayne@68 840 <dt> <kbd>&lt;RET&gt;</kbd></dt>
jpayne@68 841 <dd><a name="IDX410"></a>
jpayne@68 842 <p>Interactively edit the translation (<code>po-edit-msgstr</code>).
jpayne@68 843 </p>
jpayne@68 844 </dd>
jpayne@68 845 <dt> <kbd>&lt;LFD&gt;</kbd></dt>
jpayne@68 846 <dt> <kbd>C-j</kbd></dt>
jpayne@68 847 <dd><a name="IDX411"></a>
jpayne@68 848 <a name="IDX412"></a>
jpayne@68 849 <p>Reinitialize the translation with the original, untranslated string
jpayne@68 850 (<code>po-msgid-to-msgstr</code>).
jpayne@68 851 </p>
jpayne@68 852 </dd>
jpayne@68 853 <dt> <kbd>k</kbd></dt>
jpayne@68 854 <dd><a name="IDX413"></a>
jpayne@68 855 <p>Save the translation on the kill ring, and delete it (<code>po-kill-msgstr</code>).
jpayne@68 856 </p>
jpayne@68 857 </dd>
jpayne@68 858 <dt> <kbd>w</kbd></dt>
jpayne@68 859 <dd><a name="IDX414"></a>
jpayne@68 860 <p>Save the translation on the kill ring, without deleting it
jpayne@68 861 (<code>po-kill-ring-save-msgstr</code>).
jpayne@68 862 </p>
jpayne@68 863 </dd>
jpayne@68 864 <dt> <kbd>y</kbd></dt>
jpayne@68 865 <dd><a name="IDX415"></a>
jpayne@68 866 <p>Replace the translation, taking the new from the kill ring
jpayne@68 867 (<code>po-yank-msgstr</code>).
jpayne@68 868 </p>
jpayne@68 869 </dd>
jpayne@68 870 </dl>
jpayne@68 871
jpayne@68 872 <a name="IDX416"></a>
jpayne@68 873 <a name="IDX417"></a>
jpayne@68 874 <p>The command <kbd>&lt;RET&gt;</kbd> (<code>po-edit-msgstr</code>) opens a new Emacs
jpayne@68 875 window meant to edit in a new translation, or to modify an already existing
jpayne@68 876 translation. The new window contains a copy of the translation taken from
jpayne@68 877 the current PO file entry, all ready for edition, expunged of all quoting
jpayne@68 878 marks, fully modifiable and with the complete extent of Emacs modifying
jpayne@68 879 commands. When the translator is done with her modifications, she may use
jpayne@68 880 <kbd>C-c C-c</kbd> to close the subedit window with the automatically requoted
jpayne@68 881 results, or <kbd>C-c C-k</kbd> to abort her modifications. See section <a href="#SEC77">Details of Sub Edition</a>,
jpayne@68 882 for more information.
jpayne@68 883 </p>
jpayne@68 884 <a name="IDX418"></a>
jpayne@68 885 <a name="IDX419"></a>
jpayne@68 886 <a name="IDX420"></a>
jpayne@68 887 <p>The command <kbd>&lt;LFD&gt;</kbd> (<code>po-msgid-to-msgstr</code>) initializes, or
jpayne@68 888 reinitializes the translation with the original string. This command is
jpayne@68 889 normally used when the translator wants to redo a fresh translation of
jpayne@68 890 the original string, disregarding any previous work.
jpayne@68 891 </p>
jpayne@68 892 <a name="IDX421"></a>
jpayne@68 893 <p>It is possible to arrange so, whenever editing an untranslated
jpayne@68 894 entry, the <kbd>&lt;LFD&gt;</kbd> command be automatically executed. If you set
jpayne@68 895 <code>po-auto-edit-with-msgid</code> to <code>t</code>, the translation gets
jpayne@68 896 initialised with the original string, in case none exists already.
jpayne@68 897 The default value for <code>po-auto-edit-with-msgid</code> is <code>nil</code>.
jpayne@68 898 </p>
jpayne@68 899 <a name="IDX422"></a>
jpayne@68 900 <p>In fact, whether it is best to start a translation with an empty
jpayne@68 901 string, or rather with a copy of the original string, is a matter of
jpayne@68 902 taste or habit. Sometimes, the source language and the
jpayne@68 903 target language are so different that is simply best to start writing
jpayne@68 904 on an empty page. At other times, the source and target languages
jpayne@68 905 are so close that it would be a waste to retype a number of words
jpayne@68 906 already being written in the original string. A translator may also
jpayne@68 907 like having the original string right under her eyes, as she will
jpayne@68 908 progressively overwrite the original text with the translation, even
jpayne@68 909 if this requires some extra editing work to get rid of the original.
jpayne@68 910 </p>
jpayne@68 911 <a name="IDX423"></a>
jpayne@68 912 <a name="IDX424"></a>
jpayne@68 913 <a name="IDX425"></a>
jpayne@68 914 <a name="IDX426"></a>
jpayne@68 915 <a name="IDX427"></a>
jpayne@68 916 <p>The command <kbd>k</kbd> (<code>po-kill-msgstr</code>) merely empties the
jpayne@68 917 translation string, so turning the entry into an untranslated
jpayne@68 918 one. But while doing so, its previous contents is put apart in
jpayne@68 919 a special place, known as the kill ring. The command <kbd>w</kbd>
jpayne@68 920 (<code>po-kill-ring-save-msgstr</code>) has also the effect of taking a
jpayne@68 921 copy of the translation onto the kill ring, but it otherwise leaves
jpayne@68 922 the entry alone, and does <em>not</em> remove the translation from the
jpayne@68 923 entry. Both commands use exactly the Emacs kill ring, which is shared
jpayne@68 924 between buffers, and which is well known already to Emacs lovers.
jpayne@68 925 </p>
jpayne@68 926 <p>The translator may use <kbd>k</kbd> or <kbd>w</kbd> many times in the course
jpayne@68 927 of her work, as the kill ring may hold several saved translations.
jpayne@68 928 From the kill ring, strings may later be reinserted in various
jpayne@68 929 Emacs buffers. In particular, the kill ring may be used for moving
jpayne@68 930 translation strings between different entries of a single PO file
jpayne@68 931 buffer, or if the translator is handling many such buffers at once,
jpayne@68 932 even between PO files.
jpayne@68 933 </p>
jpayne@68 934 <p>To facilitate exchanges with buffers which are not in PO mode, the
jpayne@68 935 translation string put on the kill ring by the <kbd>k</kbd> command is fully
jpayne@68 936 unquoted before being saved: external quotes are removed, multi-line
jpayne@68 937 strings are concatenated, and backslash escaped sequences are turned
jpayne@68 938 into their corresponding characters. In the special case of obsolete
jpayne@68 939 entries, the translation is also uncommented prior to saving.
jpayne@68 940 </p>
jpayne@68 941 <a name="IDX428"></a>
jpayne@68 942 <a name="IDX429"></a>
jpayne@68 943 <p>The command <kbd>y</kbd> (<code>po-yank-msgstr</code>) completely replaces the
jpayne@68 944 translation of the current entry by a string taken from the kill ring.
jpayne@68 945 Following Emacs terminology, we then say that the replacement
jpayne@68 946 string is <em>yanked</em> into the PO file buffer.
jpayne@68 947 See <a href="../emacs/Yanking.html#Yanking">(emacs)Yanking</a> section `Yanking' in <cite>The Emacs Editor</cite>.
jpayne@68 948 The first time <kbd>y</kbd> is used, the translation receives the value of
jpayne@68 949 the most recent addition to the kill ring. If <kbd>y</kbd> is typed once
jpayne@68 950 again, immediately, without intervening keystrokes, the translation
jpayne@68 951 just inserted is taken away and replaced by the second most recent
jpayne@68 952 addition to the kill ring. By repeating <kbd>y</kbd> many times in a row,
jpayne@68 953 the translator may travel along the kill ring for saved strings,
jpayne@68 954 until she finds the string she really wanted.
jpayne@68 955 </p>
jpayne@68 956 <p>When a string is yanked into a PO file entry, it is fully and
jpayne@68 957 automatically requoted for complying with the format PO files should
jpayne@68 958 have. Further, if the entry is obsolete, PO mode then appropriately
jpayne@68 959 push the inserted string inside comments. Once again, translators
jpayne@68 960 should not burden themselves with quoting considerations besides, of
jpayne@68 961 course, the necessity of the translated string itself respective to
jpayne@68 962 the program using it.
jpayne@68 963 </p>
jpayne@68 964 <p>Note that <kbd>k</kbd> or <kbd>w</kbd> are not the only commands pushing strings
jpayne@68 965 on the kill ring, as almost any PO mode command replacing translation
jpayne@68 966 strings (or the translator comments) automatically saves the old string
jpayne@68 967 on the kill ring. The main exceptions to this general rule are the
jpayne@68 968 yanking commands themselves.
jpayne@68 969 </p>
jpayne@68 970 <a name="IDX430"></a>
jpayne@68 971 <p>To better illustrate the operation of killing and yanking, let's
jpayne@68 972 use an actual example, taken from a common situation. When the
jpayne@68 973 programmer slightly modifies some string right in the program, his
jpayne@68 974 change is later reflected in the PO file by the appearance
jpayne@68 975 of a new untranslated entry for the modified string, and the fact
jpayne@68 976 that the entry translating the original or unmodified string becomes
jpayne@68 977 obsolete. In many cases, the translator might spare herself some work
jpayne@68 978 by retrieving the unmodified translation from the obsolete entry,
jpayne@68 979 then initializing the untranslated entry <code>msgstr</code> field with
jpayne@68 980 this retrieved translation. Once this done, the obsolete entry is
jpayne@68 981 not wanted anymore, and may be safely deleted.
jpayne@68 982 </p>
jpayne@68 983 <p>When the translator finds an untranslated entry and suspects that a
jpayne@68 984 slight variant of the translation exists, she immediately uses <kbd>m</kbd>
jpayne@68 985 to mark the current entry location, then starts chasing obsolete
jpayne@68 986 entries with <kbd>o</kbd>, hoping to find some translation corresponding
jpayne@68 987 to the unmodified string. Once found, she uses the <kbd>&lt;DEL&gt;</kbd> command
jpayne@68 988 for deleting the obsolete entry, knowing that <kbd>&lt;DEL&gt;</kbd> also <em>kills</em>
jpayne@68 989 the translation, that is, pushes the translation on the kill ring.
jpayne@68 990 Then, <kbd>r</kbd> returns to the initial untranslated entry, and <kbd>y</kbd>
jpayne@68 991 then <em>yanks</em> the saved translation right into the <code>msgstr</code>
jpayne@68 992 field. The translator is then free to use <kbd>&lt;RET&gt;</kbd> for fine
jpayne@68 993 tuning the translation contents, and maybe to later use <kbd>u</kbd>,
jpayne@68 994 then <kbd>m</kbd> again, for going on with the next untranslated string.
jpayne@68 995 </p>
jpayne@68 996 <p>When some sequence of keys has to be typed over and over again, the
jpayne@68 997 translator may find it useful to become better acquainted with the Emacs
jpayne@68 998 capability of learning these sequences and playing them back under request.
jpayne@68 999 See <a href="../emacs/Keyboard-Macros.html#Keyboard-Macros">(emacs)Keyboard Macros</a> section `Keyboard Macros' in <cite>The Emacs Editor</cite>.
jpayne@68 1000 </p>
jpayne@68 1001
jpayne@68 1002 <a name="Modifying-Comments"></a>
jpayne@68 1003 <a name="SEC76"></a>
jpayne@68 1004 <h3 class="subsection"> <a href="gettext_toc.html#TOC69">8.3.10 Modifying Comments</a> </h3>
jpayne@68 1005
jpayne@68 1006 <p>Any translation work done seriously will raise many linguistic
jpayne@68 1007 difficulties, for which decisions have to be made, and the choices
jpayne@68 1008 further documented. These documents may be saved within the
jpayne@68 1009 PO file in form of translator comments, which the translator
jpayne@68 1010 is free to create, delete, or modify at will. These comments may
jpayne@68 1011 be useful to herself when she returns to this PO file after a while.
jpayne@68 1012 </p>
jpayne@68 1013 <p>Comments not having whitespace after the initial &lsquo;<samp>#</samp>&rsquo;, for example,
jpayne@68 1014 those beginning with &lsquo;<samp>#.</samp>&rsquo; or &lsquo;<samp>#:</samp>&rsquo;, are <em>not</em> translator
jpayne@68 1015 comments, they are exclusively created by other <code>gettext</code> tools.
jpayne@68 1016 So, the commands below will never alter such system added comments,
jpayne@68 1017 they are not meant for the translator to modify. See section <a href="gettext_3.html#SEC16">The Format of PO Files</a>.
jpayne@68 1018 </p>
jpayne@68 1019 <p>The following commands are somewhat similar to those modifying translations,
jpayne@68 1020 so the general indications given for those apply here. See section <a href="#SEC75">Modifying Translations</a>.
jpayne@68 1021 </p>
jpayne@68 1022 <dl compact="compact">
jpayne@68 1023 <dt> <kbd>#</kbd></dt>
jpayne@68 1024 <dd><a name="IDX431"></a>
jpayne@68 1025 <p>Interactively edit the translator comments (<code>po-edit-comment</code>).
jpayne@68 1026 </p>
jpayne@68 1027 </dd>
jpayne@68 1028 <dt> <kbd>K</kbd></dt>
jpayne@68 1029 <dd><a name="IDX432"></a>
jpayne@68 1030 <p>Save the translator comments on the kill ring, and delete it
jpayne@68 1031 (<code>po-kill-comment</code>).
jpayne@68 1032 </p>
jpayne@68 1033 </dd>
jpayne@68 1034 <dt> <kbd>W</kbd></dt>
jpayne@68 1035 <dd><a name="IDX433"></a>
jpayne@68 1036 <p>Save the translator comments on the kill ring, without deleting it
jpayne@68 1037 (<code>po-kill-ring-save-comment</code>).
jpayne@68 1038 </p>
jpayne@68 1039 </dd>
jpayne@68 1040 <dt> <kbd>Y</kbd></dt>
jpayne@68 1041 <dd><a name="IDX434"></a>
jpayne@68 1042 <p>Replace the translator comments, taking the new from the kill ring
jpayne@68 1043 (<code>po-yank-comment</code>).
jpayne@68 1044 </p>
jpayne@68 1045 </dd>
jpayne@68 1046 </dl>
jpayne@68 1047
jpayne@68 1048 <p>These commands parallel PO mode commands for modifying the translation
jpayne@68 1049 strings, and behave much the same way as they do, except that they handle
jpayne@68 1050 this part of PO file comments meant for translator usage, rather
jpayne@68 1051 than the translation strings. So, if the descriptions given below are
jpayne@68 1052 slightly succinct, it is because the full details have already been given.
jpayne@68 1053 See section <a href="#SEC75">Modifying Translations</a>.
jpayne@68 1054 </p>
jpayne@68 1055 <a name="IDX435"></a>
jpayne@68 1056 <a name="IDX436"></a>
jpayne@68 1057 <p>The command <kbd>#</kbd> (<code>po-edit-comment</code>) opens a new Emacs window
jpayne@68 1058 containing a copy of the translator comments on the current PO file entry.
jpayne@68 1059 If there are no such comments, PO mode understands that the translator wants
jpayne@68 1060 to add a comment to the entry, and she is presented with an empty screen.
jpayne@68 1061 Comment marks (<code>#</code>) and the space following them are automatically
jpayne@68 1062 removed before edition, and reinstated after. For translator comments
jpayne@68 1063 pertaining to obsolete entries, the uncommenting and recommenting operations
jpayne@68 1064 are done twice. Once in the editing window, the keys <kbd>C-c C-c</kbd>
jpayne@68 1065 allow the translator to tell she is finished with editing the comment.
jpayne@68 1066 See section <a href="#SEC77">Details of Sub Edition</a>, for further details.
jpayne@68 1067 </p>
jpayne@68 1068 <a name="IDX437"></a>
jpayne@68 1069 <p>Functions found on <code>po-subedit-mode-hook</code>, if any, are executed after
jpayne@68 1070 the string has been inserted in the edit buffer.
jpayne@68 1071 </p>
jpayne@68 1072 <a name="IDX438"></a>
jpayne@68 1073 <a name="IDX439"></a>
jpayne@68 1074 <a name="IDX440"></a>
jpayne@68 1075 <a name="IDX441"></a>
jpayne@68 1076 <a name="IDX442"></a>
jpayne@68 1077 <a name="IDX443"></a>
jpayne@68 1078 <p>The command <kbd>K</kbd> (<code>po-kill-comment</code>) gets rid of all
jpayne@68 1079 translator comments, while saving those comments on the kill ring.
jpayne@68 1080 The command <kbd>W</kbd> (<code>po-kill-ring-save-comment</code>) takes
jpayne@68 1081 a copy of the translator comments on the kill ring, but leaves
jpayne@68 1082 them undisturbed in the current entry. The command <kbd>Y</kbd>
jpayne@68 1083 (<code>po-yank-comment</code>) completely replaces the translator comments
jpayne@68 1084 by a string taken at the front of the kill ring. When this command
jpayne@68 1085 is immediately repeated, the comments just inserted are withdrawn,
jpayne@68 1086 and replaced by other strings taken along the kill ring.
jpayne@68 1087 </p>
jpayne@68 1088 <p>On the kill ring, all strings have the same nature. There is no
jpayne@68 1089 distinction between <em>translation</em> strings and <em>translator
jpayne@68 1090 comments</em> strings. So, for example, let's presume the translator
jpayne@68 1091 has just finished editing a translation, and wants to create a new
jpayne@68 1092 translator comment to document why the previous translation was
jpayne@68 1093 not good, just to remember what was the problem. Foreseeing that she
jpayne@68 1094 will do that in her documentation, the translator may want to quote
jpayne@68 1095 the previous translation in her translator comments. To do so, she
jpayne@68 1096 may initialize the translator comments with the previous translation,
jpayne@68 1097 still at the head of the kill ring. Because editing already pushed the
jpayne@68 1098 previous translation on the kill ring, she merely has to type <kbd>M-w</kbd>
jpayne@68 1099 prior to <kbd>#</kbd>, and the previous translation will be right there,
jpayne@68 1100 all ready for being introduced by some explanatory text.
jpayne@68 1101 </p>
jpayne@68 1102 <p>On the other hand, presume there are some translator comments already
jpayne@68 1103 and that the translator wants to add to those comments, instead
jpayne@68 1104 of wholly replacing them. Then, she should edit the comment right
jpayne@68 1105 away with <kbd>#</kbd>. Once inside the editing window, she can use the
jpayne@68 1106 regular Emacs commands <kbd>C-y</kbd> (<code>yank</code>) and <kbd>M-y</kbd>
jpayne@68 1107 (<code>yank-pop</code>) to get the previous translation where she likes.
jpayne@68 1108 </p>
jpayne@68 1109
jpayne@68 1110 <a name="Subedit"></a>
jpayne@68 1111 <a name="SEC77"></a>
jpayne@68 1112 <h3 class="subsection"> <a href="gettext_toc.html#TOC70">8.3.11 Details of Sub Edition</a> </h3>
jpayne@68 1113
jpayne@68 1114 <p>The PO subedit minor mode has a few peculiarities worth being described
jpayne@68 1115 in fuller detail. It installs a few commands over the usual editing set
jpayne@68 1116 of Emacs, which are described below.
jpayne@68 1117 </p>
jpayne@68 1118 <dl compact="compact">
jpayne@68 1119 <dt> <kbd>C-c C-c</kbd></dt>
jpayne@68 1120 <dd><a name="IDX444"></a>
jpayne@68 1121 <p>Complete edition (<code>po-subedit-exit</code>).
jpayne@68 1122 </p>
jpayne@68 1123 </dd>
jpayne@68 1124 <dt> <kbd>C-c C-k</kbd></dt>
jpayne@68 1125 <dd><a name="IDX445"></a>
jpayne@68 1126 <p>Abort edition (<code>po-subedit-abort</code>).
jpayne@68 1127 </p>
jpayne@68 1128 </dd>
jpayne@68 1129 <dt> <kbd>C-c C-a</kbd></dt>
jpayne@68 1130 <dd><a name="IDX446"></a>
jpayne@68 1131 <p>Consult auxiliary PO files (<code>po-subedit-cycle-auxiliary</code>).
jpayne@68 1132 </p>
jpayne@68 1133 </dd>
jpayne@68 1134 </dl>
jpayne@68 1135
jpayne@68 1136 <a name="IDX447"></a>
jpayne@68 1137 <a name="IDX448"></a>
jpayne@68 1138 <a name="IDX449"></a>
jpayne@68 1139 <p>The window's contents represents a translation for a given message,
jpayne@68 1140 or a translator comment. The translator may modify this window to
jpayne@68 1141 her heart's content. Once this is done, the command <kbd>C-c C-c</kbd>
jpayne@68 1142 (<code>po-subedit-exit</code>) may be used to return the edited translation into
jpayne@68 1143 the PO file, replacing the original translation, even if it moved out of
jpayne@68 1144 sight or if buffers were switched.
jpayne@68 1145 </p>
jpayne@68 1146 <a name="IDX450"></a>
jpayne@68 1147 <a name="IDX451"></a>
jpayne@68 1148 <p>If the translator becomes unsatisfied with her translation or comment,
jpayne@68 1149 to the extent she prefers keeping what was existent prior to the
jpayne@68 1150 <kbd>&lt;RET&gt;</kbd> or <kbd>#</kbd> command, she may use the command <kbd>C-c C-k</kbd>
jpayne@68 1151 (<code>po-subedit-abort</code>) to merely get rid of edition, while preserving
jpayne@68 1152 the original translation or comment. Another way would be for her to exit
jpayne@68 1153 normally with <kbd>C-c C-c</kbd>, then type <code>U</code> once for undoing the
jpayne@68 1154 whole effect of last edition.
jpayne@68 1155 </p>
jpayne@68 1156 <a name="IDX452"></a>
jpayne@68 1157 <a name="IDX453"></a>
jpayne@68 1158 <p>The command <kbd>C-c C-a</kbd> (<code>po-subedit-cycle-auxiliary</code>)
jpayne@68 1159 allows for glancing through translations
jpayne@68 1160 already achieved in other languages, directly while editing the current
jpayne@68 1161 translation. This may be quite convenient when the translator is fluent
jpayne@68 1162 at many languages, but of course, only makes sense when such completed
jpayne@68 1163 auxiliary PO files are already available to her (see section <a href="#SEC79">Consulting Auxiliary PO Files</a>).
jpayne@68 1164 </p>
jpayne@68 1165 <p>Functions found on <code>po-subedit-mode-hook</code>, if any, are executed after
jpayne@68 1166 the string has been inserted in the edit buffer.
jpayne@68 1167 </p>
jpayne@68 1168 <p>While editing her translation, the translator should pay attention to not
jpayne@68 1169 inserting unwanted <kbd>&lt;RET&gt;</kbd> (newline) characters at the end of
jpayne@68 1170 the translated string if those are not meant to be there, or to removing
jpayne@68 1171 such characters when they are required. Since these characters are not
jpayne@68 1172 visible in the editing buffer, they are easily introduced by mistake.
jpayne@68 1173 To help her, <kbd>&lt;RET&gt;</kbd> automatically puts the character <code>&lt;</code>
jpayne@68 1174 at the end of the string being edited, but this <code>&lt;</code> is not really
jpayne@68 1175 part of the string. On exiting the editing window with <kbd>C-c C-c</kbd>,
jpayne@68 1176 PO mode automatically removes such <kbd>&lt;</kbd> and all whitespace added after
jpayne@68 1177 it. If the translator adds characters after the terminating <code>&lt;</code>, it
jpayne@68 1178 looses its delimiting property and integrally becomes part of the string.
jpayne@68 1179 If she removes the delimiting <code>&lt;</code>, then the edited string is taken
jpayne@68 1180 <em>as is</em>, with all trailing newlines, even if invisible. Also, if
jpayne@68 1181 the translated string ought to end itself with a genuine <code>&lt;</code>, then
jpayne@68 1182 the delimiting <code>&lt;</code> may not be removed; so the string should appear,
jpayne@68 1183 in the editing window, as ending with two <code>&lt;</code> in a row.
jpayne@68 1184 </p>
jpayne@68 1185 <a name="IDX454"></a>
jpayne@68 1186 <p>When a translation (or a comment) is being edited, the translator may move
jpayne@68 1187 the cursor back into the PO file buffer and freely move to other entries,
jpayne@68 1188 browsing at will. If, with an edition pending, the translator wanders in the
jpayne@68 1189 PO file buffer, she may decide to start modifying another entry. Each entry
jpayne@68 1190 being edited has its own subedit buffer. It is possible to simultaneously
jpayne@68 1191 edit the translation <em>and</em> the comment of a single entry, or to
jpayne@68 1192 edit entries in different PO files, all at once. Typing <kbd>&lt;RET&gt;</kbd>
jpayne@68 1193 on a field already being edited merely resumes that particular edit. Yet,
jpayne@68 1194 the translator should better be comfortable at handling many Emacs windows!
jpayne@68 1195 </p>
jpayne@68 1196 <a name="IDX455"></a>
jpayne@68 1197 <p>Pending subedits may be completed or aborted in any order, regardless
jpayne@68 1198 of how or when they were started. When many subedits are pending and the
jpayne@68 1199 translator asks for quitting the PO file (with the <kbd>q</kbd> command), subedits
jpayne@68 1200 are automatically resumed one at a time, so she may decide for each of them.
jpayne@68 1201 </p>
jpayne@68 1202
jpayne@68 1203 <a name="C-Sources-Context"></a>
jpayne@68 1204 <a name="SEC78"></a>
jpayne@68 1205 <h3 class="subsection"> <a href="gettext_toc.html#TOC71">8.3.12 C Sources Context</a> </h3>
jpayne@68 1206
jpayne@68 1207 <p>PO mode is particularly powerful when used with PO files
jpayne@68 1208 created through GNU <code>gettext</code> utilities, as those utilities
jpayne@68 1209 insert special comments in the PO files they generate.
jpayne@68 1210 Some of these special comments relate the PO file entry to
jpayne@68 1211 exactly where the untranslated string appears in the program sources.
jpayne@68 1212 </p>
jpayne@68 1213 <p>When the translator gets to an untranslated entry, she is fairly
jpayne@68 1214 often faced with an original string which is not as informative as
jpayne@68 1215 it normally should be, being succinct, cryptic, or otherwise ambiguous.
jpayne@68 1216 Before choosing how to translate the string, she needs to understand
jpayne@68 1217 better what the string really means and how tight the translation has
jpayne@68 1218 to be. Most of the time, when problems arise, the only way left to make
jpayne@68 1219 her judgment is looking at the true program sources from where this
jpayne@68 1220 string originated, searching for surrounding comments the programmer
jpayne@68 1221 might have put in there, and looking around for helping clues of
jpayne@68 1222 <em>any</em> kind.
jpayne@68 1223 </p>
jpayne@68 1224 <p>Surely, when looking at program sources, the translator will receive
jpayne@68 1225 more help if she is a fluent programmer. However, even if she is
jpayne@68 1226 not versed in programming and feels a little lost in C code, the
jpayne@68 1227 translator should not be shy at taking a look, once in a while.
jpayne@68 1228 It is most probable that she will still be able to find some of the
jpayne@68 1229 hints she needs. She will learn quickly to not feel uncomfortable
jpayne@68 1230 in program code, paying more attention to programmer's comments,
jpayne@68 1231 variable and function names (if he dared choosing them well), and
jpayne@68 1232 overall organization, than to the program code itself.
jpayne@68 1233 </p>
jpayne@68 1234 <a name="IDX456"></a>
jpayne@68 1235 <p>The following commands are meant to help the translator at getting
jpayne@68 1236 program source context for a PO file entry.
jpayne@68 1237 </p>
jpayne@68 1238 <dl compact="compact">
jpayne@68 1239 <dt> <kbd>s</kbd></dt>
jpayne@68 1240 <dd><a name="IDX457"></a>
jpayne@68 1241 <p>Resume the display of a program source context, or cycle through them
jpayne@68 1242 (<code>po-cycle-source-reference</code>).
jpayne@68 1243 </p>
jpayne@68 1244 </dd>
jpayne@68 1245 <dt> <kbd>M-s</kbd></dt>
jpayne@68 1246 <dd><a name="IDX458"></a>
jpayne@68 1247 <p>Display of a program source context selected by menu
jpayne@68 1248 (<code>po-select-source-reference</code>).
jpayne@68 1249 </p>
jpayne@68 1250 </dd>
jpayne@68 1251 <dt> <kbd>S</kbd></dt>
jpayne@68 1252 <dd><a name="IDX459"></a>
jpayne@68 1253 <p>Add a directory to the search path for source files
jpayne@68 1254 (<code>po-consider-source-path</code>).
jpayne@68 1255 </p>
jpayne@68 1256 </dd>
jpayne@68 1257 <dt> <kbd>M-S</kbd></dt>
jpayne@68 1258 <dd><a name="IDX460"></a>
jpayne@68 1259 <p>Delete a directory from the search path for source files
jpayne@68 1260 (<code>po-ignore-source-path</code>).
jpayne@68 1261 </p>
jpayne@68 1262 </dd>
jpayne@68 1263 </dl>
jpayne@68 1264
jpayne@68 1265 <a name="IDX461"></a>
jpayne@68 1266 <a name="IDX462"></a>
jpayne@68 1267 <a name="IDX463"></a>
jpayne@68 1268 <a name="IDX464"></a>
jpayne@68 1269 <p>The commands <kbd>s</kbd> (<code>po-cycle-source-reference</code>) and <kbd>M-s</kbd>
jpayne@68 1270 (<code>po-select-source-reference</code>) both open another window displaying
jpayne@68 1271 some source program file, and already positioned in such a way that
jpayne@68 1272 it shows an actual use of the string to be translated. By doing
jpayne@68 1273 so, the command gives source program context for the string. But if
jpayne@68 1274 the entry has no source context references, or if all references
jpayne@68 1275 are unresolved along the search path for program sources, then the
jpayne@68 1276 command diagnoses this as an error.
jpayne@68 1277 </p>
jpayne@68 1278 <p>Even if <kbd>s</kbd> (or <kbd>M-s</kbd>) opens a new window, the cursor stays
jpayne@68 1279 in the PO file window. If the translator really wants to
jpayne@68 1280 get into the program source window, she ought to do it explicitly,
jpayne@68 1281 maybe by using command <kbd>O</kbd>.
jpayne@68 1282 </p>
jpayne@68 1283 <p>When <kbd>s</kbd> is typed for the first time, or for a PO file entry which
jpayne@68 1284 is different of the last one used for getting source context, then the
jpayne@68 1285 command reacts by giving the first context available for this entry,
jpayne@68 1286 if any. If some context has already been recently displayed for the
jpayne@68 1287 current PO file entry, and the translator wandered off to do other
jpayne@68 1288 things, typing <kbd>s</kbd> again will merely resume, in another window,
jpayne@68 1289 the context last displayed. In particular, if the translator moved
jpayne@68 1290 the cursor away from the context in the source file, the command will
jpayne@68 1291 bring the cursor back to the context. By using <kbd>s</kbd> many times
jpayne@68 1292 in a row, with no other commands intervening, PO mode will cycle to
jpayne@68 1293 the next available contexts for this particular entry, getting back
jpayne@68 1294 to the first context once the last has been shown.
jpayne@68 1295 </p>
jpayne@68 1296 <p>The command <kbd>M-s</kbd> behaves differently. Instead of cycling through
jpayne@68 1297 references, it lets the translator choose a particular reference among
jpayne@68 1298 many, and displays that reference. It is best used with completion,
jpayne@68 1299 if the translator types <kbd>&lt;TAB&gt;</kbd> immediately after <kbd>M-s</kbd>, in
jpayne@68 1300 response to the question, she will be offered a menu of all possible
jpayne@68 1301 references, as a reminder of which are the acceptable answers.
jpayne@68 1302 This command is useful only where there are really many contexts
jpayne@68 1303 available for a single string to translate.
jpayne@68 1304 </p>
jpayne@68 1305 <a name="IDX465"></a>
jpayne@68 1306 <a name="IDX466"></a>
jpayne@68 1307 <a name="IDX467"></a>
jpayne@68 1308 <a name="IDX468"></a>
jpayne@68 1309 <p>Program source files are usually found relative to where the PO
jpayne@68 1310 file stands. As a special provision, when this fails, the file is
jpayne@68 1311 also looked for, but relative to the directory immediately above it.
jpayne@68 1312 Those two cases take proper care of most PO files. However, it might
jpayne@68 1313 happen that a PO file has been moved, or is edited in a different
jpayne@68 1314 place than its normal location. When this happens, the translator
jpayne@68 1315 should tell PO mode in which directory normally sits the genuine PO
jpayne@68 1316 file. Many such directories may be specified, and all together, they
jpayne@68 1317 constitute what is called the <em>search path</em> for program sources.
jpayne@68 1318 The command <kbd>S</kbd> (<code>po-consider-source-path</code>) is used to interactively
jpayne@68 1319 enter a new directory at the front of the search path, and the command
jpayne@68 1320 <kbd>M-S</kbd> (<code>po-ignore-source-path</code>) is used to select, with completion,
jpayne@68 1321 one of the directories she does not want anymore on the search path.
jpayne@68 1322 </p>
jpayne@68 1323
jpayne@68 1324 <a name="Auxiliary"></a>
jpayne@68 1325 <a name="SEC79"></a>
jpayne@68 1326 <h3 class="subsection"> <a href="gettext_toc.html#TOC72">8.3.13 Consulting Auxiliary PO Files</a> </h3>
jpayne@68 1327
jpayne@68 1328 <p>PO mode is able to help the knowledgeable translator, being fluent in
jpayne@68 1329 many languages, at taking advantage of translations already achieved
jpayne@68 1330 in other languages she just happens to know. It provides these other
jpayne@68 1331 language translations as additional context for her own work. Moreover,
jpayne@68 1332 it has features to ease the production of translations for many languages
jpayne@68 1333 at once, for translators preferring to work in this way.
jpayne@68 1334 </p>
jpayne@68 1335 <a name="IDX469"></a>
jpayne@68 1336 <a name="IDX470"></a>
jpayne@68 1337 <p>An <em>auxiliary</em> PO file is an existing PO file meant for the same
jpayne@68 1338 package the translator is working on, but targeted to a different mother
jpayne@68 1339 tongue language. Commands exist for declaring and handling auxiliary
jpayne@68 1340 PO files, and also for showing contexts for the entry under work.
jpayne@68 1341 </p>
jpayne@68 1342 <p>Here are the auxiliary file commands available in PO mode.
jpayne@68 1343 </p>
jpayne@68 1344 <dl compact="compact">
jpayne@68 1345 <dt> <kbd>a</kbd></dt>
jpayne@68 1346 <dd><a name="IDX471"></a>
jpayne@68 1347 <p>Seek auxiliary files for another translation for the same entry
jpayne@68 1348 (<code>po-cycle-auxiliary</code>).
jpayne@68 1349 </p>
jpayne@68 1350 </dd>
jpayne@68 1351 <dt> <kbd>C-c C-a</kbd></dt>
jpayne@68 1352 <dd><a name="IDX472"></a>
jpayne@68 1353 <p>Switch to a particular auxiliary file (<code>po-select-auxiliary</code>).
jpayne@68 1354 </p>
jpayne@68 1355 </dd>
jpayne@68 1356 <dt> <kbd>A</kbd></dt>
jpayne@68 1357 <dd><a name="IDX473"></a>
jpayne@68 1358 <p>Declare this PO file as an auxiliary file (<code>po-consider-as-auxiliary</code>).
jpayne@68 1359 </p>
jpayne@68 1360 </dd>
jpayne@68 1361 <dt> <kbd>M-A</kbd></dt>
jpayne@68 1362 <dd><a name="IDX474"></a>
jpayne@68 1363 <p>Remove this PO file from the list of auxiliary files
jpayne@68 1364 (<code>po-ignore-as-auxiliary</code>).
jpayne@68 1365 </p>
jpayne@68 1366 </dd>
jpayne@68 1367 </dl>
jpayne@68 1368
jpayne@68 1369 <a name="IDX475"></a>
jpayne@68 1370 <a name="IDX476"></a>
jpayne@68 1371 <a name="IDX477"></a>
jpayne@68 1372 <a name="IDX478"></a>
jpayne@68 1373 <p>Command <kbd>A</kbd> (<code>po-consider-as-auxiliary</code>) adds the current
jpayne@68 1374 PO file to the list of auxiliary files, while command <kbd>M-A</kbd>
jpayne@68 1375 (<code>po-ignore-as-auxiliary</code> just removes it.
jpayne@68 1376 </p>
jpayne@68 1377 <a name="IDX479"></a>
jpayne@68 1378 <a name="IDX480"></a>
jpayne@68 1379 <p>The command <kbd>a</kbd> (<code>po-cycle-auxiliary</code>) seeks all auxiliary PO
jpayne@68 1380 files, round-robin, searching for a translated entry in some other language
jpayne@68 1381 having an <code>msgid</code> field identical as the one for the current entry.
jpayne@68 1382 The found PO file, if any, takes the place of the current PO file in
jpayne@68 1383 the display (its window gets on top). Before doing so, the current PO
jpayne@68 1384 file is also made into an auxiliary file, if not already. So, <kbd>a</kbd>
jpayne@68 1385 in this newly displayed PO file will seek another PO file, and so on,
jpayne@68 1386 so repeating <kbd>a</kbd> will eventually yield back the original PO file.
jpayne@68 1387 </p>
jpayne@68 1388 <a name="IDX481"></a>
jpayne@68 1389 <a name="IDX482"></a>
jpayne@68 1390 <p>The command <kbd>C-c C-a</kbd> (<code>po-select-auxiliary</code>) asks the translator
jpayne@68 1391 for her choice of a particular auxiliary file, with completion, and
jpayne@68 1392 then switches to that selected PO file. The command also checks if
jpayne@68 1393 the selected file has an <code>msgid</code> field identical as the one for
jpayne@68 1394 the current entry, and if yes, this entry becomes current. Otherwise,
jpayne@68 1395 the cursor of the selected file is left undisturbed.
jpayne@68 1396 </p>
jpayne@68 1397 <p>For all this to work fully, auxiliary PO files will have to be normalized,
jpayne@68 1398 in that way that <code>msgid</code> fields should be written <em>exactly</em>
jpayne@68 1399 the same way. It is possible to write <code>msgid</code> fields in various
jpayne@68 1400 ways for representing the same string, different writing would break the
jpayne@68 1401 proper behaviour of the auxiliary file commands of PO mode. This is not
jpayne@68 1402 expected to be much a problem in practice, as most existing PO files have
jpayne@68 1403 their <code>msgid</code> entries written by the same GNU <code>gettext</code> tools.
jpayne@68 1404 </p>
jpayne@68 1405 <a name="IDX483"></a>
jpayne@68 1406 <p>However, PO files initially created by PO mode itself, while marking
jpayne@68 1407 strings in source files, are normalised differently. So are PO
jpayne@68 1408 files resulting of the &lsquo;<samp>M-x normalize</samp>&rsquo; command. Until these
jpayne@68 1409 discrepancies between PO mode and other GNU <code>gettext</code> tools get
jpayne@68 1410 fully resolved, the translator should stay aware of normalisation issues.
jpayne@68 1411 </p>
jpayne@68 1412
jpayne@68 1413 <a name="Compendium"></a>
jpayne@68 1414 <a name="SEC80"></a>
jpayne@68 1415 <h2 class="section"> <a href="gettext_toc.html#TOC73">8.4 Using Translation Compendia</a> </h2>
jpayne@68 1416
jpayne@68 1417 <p>A <em>compendium</em> is a special PO file containing a set of
jpayne@68 1418 translations recurring in many different packages. The translator can
jpayne@68 1419 use gettext tools to build a new compendium, to add entries to her
jpayne@68 1420 compendium, and to initialize untranslated entries, or to update
jpayne@68 1421 already translated entries, from translations kept in the compendium.
jpayne@68 1422 </p>
jpayne@68 1423
jpayne@68 1424
jpayne@68 1425 <a name="Creating-Compendia"></a>
jpayne@68 1426 <a name="SEC81"></a>
jpayne@68 1427 <h3 class="subsection"> <a href="gettext_toc.html#TOC74">8.4.1 Creating Compendia</a> </h3>
jpayne@68 1428
jpayne@68 1429 <p>Basically every PO file consisting of translated entries only can be
jpayne@68 1430 declared as a valid compendium. Often the translator wants to have
jpayne@68 1431 special compendia; let's consider two cases: <cite>concatenating PO
jpayne@68 1432 files</cite> and <cite>extracting a message subset from a PO file</cite>.
jpayne@68 1433 </p>
jpayne@68 1434
jpayne@68 1435 <a name="SEC82"></a>
jpayne@68 1436 <h4 class="subsubsection"> <a href="gettext_toc.html#TOC75">8.4.1.1 Concatenate PO Files</a> </h4>
jpayne@68 1437
jpayne@68 1438 <p>To concatenate several valid PO files into one compendium file you can
jpayne@68 1439 use &lsquo;<samp>msgcomm</samp>&rsquo; or &lsquo;<samp>msgcat</samp>&rsquo; (the latter preferred):
jpayne@68 1440 </p>
jpayne@68 1441 <table><tr><td>&nbsp;</td><td><pre class="example">msgcat -o compendium.po file1.po file2.po
jpayne@68 1442 </pre></td></tr></table>
jpayne@68 1443
jpayne@68 1444 <p>By default, <code>msgcat</code> will accumulate divergent translations
jpayne@68 1445 for the same string. Those occurrences will be marked as <code>fuzzy</code>
jpayne@68 1446 and highly visible decorated; calling <code>msgcat</code> on
jpayne@68 1447 &lsquo;<tt>file1.po</tt>&rsquo;:
jpayne@68 1448 </p>
jpayne@68 1449 <table><tr><td>&nbsp;</td><td><pre class="example">#: src/hello.c:200
jpayne@68 1450 #, c-format
jpayne@68 1451 msgid &quot;Report bugs to &lt;%s&gt;.\n&quot;
jpayne@68 1452 msgstr &quot;Comunicar `bugs' a &lt;%s&gt;.\n&quot;
jpayne@68 1453 </pre></td></tr></table>
jpayne@68 1454
jpayne@68 1455 <p>and &lsquo;<tt>file2.po</tt>&rsquo;:
jpayne@68 1456 </p>
jpayne@68 1457 <table><tr><td>&nbsp;</td><td><pre class="example">#: src/bye.c:100
jpayne@68 1458 #, c-format
jpayne@68 1459 msgid &quot;Report bugs to &lt;%s&gt;.\n&quot;
jpayne@68 1460 msgstr &quot;Comunicar \&quot;bugs\&quot; a &lt;%s&gt;.\n&quot;
jpayne@68 1461 </pre></td></tr></table>
jpayne@68 1462
jpayne@68 1463 <p>will result in:
jpayne@68 1464 </p>
jpayne@68 1465 <table><tr><td>&nbsp;</td><td><pre class="example">#: src/hello.c:200 src/bye.c:100
jpayne@68 1466 #, fuzzy, c-format
jpayne@68 1467 msgid &quot;Report bugs to &lt;%s&gt;.\n&quot;
jpayne@68 1468 msgstr &quot;&quot;
jpayne@68 1469 &quot;#-#-#-#-# file1.po #-#-#-#-#\n&quot;
jpayne@68 1470 &quot;Comunicar `bugs' a &lt;%s&gt;.\n&quot;
jpayne@68 1471 &quot;#-#-#-#-# file2.po #-#-#-#-#\n&quot;
jpayne@68 1472 &quot;Comunicar \&quot;bugs\&quot; a &lt;%s&gt;.\n&quot;
jpayne@68 1473 </pre></td></tr></table>
jpayne@68 1474
jpayne@68 1475 <p>The translator will have to resolve this &ldquo;conflict&rdquo; manually; she
jpayne@68 1476 has to decide whether the first or the second version is appropriate
jpayne@68 1477 (or provide a new translation), to delete the &ldquo;marker lines&rdquo;, and
jpayne@68 1478 finally to remove the <code>fuzzy</code> mark.
jpayne@68 1479 </p>
jpayne@68 1480 <p>If the translator knows in advance the first found translation of a
jpayne@68 1481 message is always the best translation she can make use to the
jpayne@68 1482 &lsquo;<samp>--use-first</samp>&rsquo; switch:
jpayne@68 1483 </p>
jpayne@68 1484 <table><tr><td>&nbsp;</td><td><pre class="example">msgcat --use-first -o compendium.po file1.po file2.po
jpayne@68 1485 </pre></td></tr></table>
jpayne@68 1486
jpayne@68 1487 <p>A good compendium file must not contain <code>fuzzy</code> or untranslated
jpayne@68 1488 entries. If input files are &ldquo;dirty&rdquo; you must preprocess the input
jpayne@68 1489 files or postprocess the result using &lsquo;<samp>msgattrib --translated --no-fuzzy</samp>&rsquo;.
jpayne@68 1490 </p>
jpayne@68 1491
jpayne@68 1492 <a name="SEC83"></a>
jpayne@68 1493 <h4 class="subsubsection"> <a href="gettext_toc.html#TOC76">8.4.1.2 Extract a Message Subset from a PO File</a> </h4>
jpayne@68 1494
jpayne@68 1495 <p>Nobody wants to translate the same messages again and again; thus you
jpayne@68 1496 may wish to have a compendium file containing &lsquo;<tt>getopt.c</tt>&rsquo; messages.
jpayne@68 1497 </p>
jpayne@68 1498 <p>To extract a message subset (e.g., all &lsquo;<tt>getopt.c</tt>&rsquo; messages) from an
jpayne@68 1499 existing PO file into one compendium file you can use &lsquo;<samp>msggrep</samp>&rsquo;:
jpayne@68 1500 </p>
jpayne@68 1501 <table><tr><td>&nbsp;</td><td><pre class="example">msggrep --location src/getopt.c -o compendium.po file.po
jpayne@68 1502 </pre></td></tr></table>
jpayne@68 1503
jpayne@68 1504
jpayne@68 1505 <a name="Using-Compendia"></a>
jpayne@68 1506 <a name="SEC84"></a>
jpayne@68 1507 <h3 class="subsection"> <a href="gettext_toc.html#TOC77">8.4.2 Using Compendia</a> </h3>
jpayne@68 1508
jpayne@68 1509 <p>You can use a compendium file to initialize a translation from scratch
jpayne@68 1510 or to update an already existing translation.
jpayne@68 1511 </p>
jpayne@68 1512
jpayne@68 1513 <a name="SEC85"></a>
jpayne@68 1514 <h4 class="subsubsection"> <a href="gettext_toc.html#TOC78">8.4.2.1 Initialize a New Translation File</a> </h4>
jpayne@68 1515
jpayne@68 1516 <p>Since a PO file with translations does not exist the translator can
jpayne@68 1517 merely use &lsquo;<tt>/dev/null</tt>&rsquo; to fake the &ldquo;old&rdquo; translation file.
jpayne@68 1518 </p>
jpayne@68 1519 <table><tr><td>&nbsp;</td><td><pre class="example">msgmerge --compendium compendium.po -o file.po /dev/null file.pot
jpayne@68 1520 </pre></td></tr></table>
jpayne@68 1521
jpayne@68 1522
jpayne@68 1523 <a name="SEC86"></a>
jpayne@68 1524 <h4 class="subsubsection"> <a href="gettext_toc.html#TOC79">8.4.2.2 Update an Existing Translation File</a> </h4>
jpayne@68 1525
jpayne@68 1526 <p>Concatenate the compendium file(s) and the existing PO, merge the
jpayne@68 1527 result with the POT file and remove the obsolete entries (optional,
jpayne@68 1528 here done using &lsquo;<samp>msgattrib</samp>&rsquo;):
jpayne@68 1529 </p>
jpayne@68 1530 <table><tr><td>&nbsp;</td><td><pre class="example">msgcat --use-first -o update.po compendium1.po compendium2.po file.po
jpayne@68 1531 msgmerge update.po file.pot | msgattrib --no-obsolete &gt; file.po
jpayne@68 1532 </pre></td></tr></table>
jpayne@68 1533
jpayne@68 1534
jpayne@68 1535 <table cellpadding="1" cellspacing="1" border="0">
jpayne@68 1536 <tr><td valign="middle" align="left">[<a href="#SEC63" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
jpayne@68 1537 <td valign="middle" align="left">[<a href="gettext_9.html#SEC87" title="Next chapter"> &gt;&gt; </a>]</td>
jpayne@68 1538 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 1539 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 1540 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 1541 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 1542 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 1543 <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
jpayne@68 1544 <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
jpayne@68 1545 <td valign="middle" align="left">[<a href="gettext_21.html#SEC389" title="Index">Index</a>]</td>
jpayne@68 1546 <td valign="middle" align="left">[<a href="gettext_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
jpayne@68 1547 </tr></table>
jpayne@68 1548 <p>
jpayne@68 1549 <font size="-1">
jpayne@68 1550 This document was generated by <em>Bruno Haible</em> on <em>February, 21 2024</em> using <a href="https://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>.
jpayne@68 1551 </font>
jpayne@68 1552 <br>
jpayne@68 1553
jpayne@68 1554 </p>
jpayne@68 1555 </body>
jpayne@68 1556 </html>