Install gettext-0.18.1.1.tar.gz
[msysgit.git] / mingw / share / doc / gettext / gettext_8.html
blob02974e8a32383f40bc3f88a96f3e4888b92e9461
1 <HTML>
2 <HEAD>
3 <!-- This HTML file has been created by texi2html 1.52b
4 from gettext.texi on 6 June 2010 -->
6 <META HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
7 <TITLE>GNU gettext utilities - 8 Editing PO Files</TITLE>
8 </HEAD>
9 <BODY>
10 Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_7.html">previous</A>, <A HREF="gettext_9.html">next</A>, <A HREF="gettext_25.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>.
11 <P><HR><P>
14 <H1><A NAME="SEC55" HREF="gettext_toc.html#TOC55">8 Editing PO Files</A></H1>
15 <P>
16 <A NAME="IDX328"></A>
18 </P>
22 <H2><A NAME="SEC56" HREF="gettext_toc.html#TOC56">8.1 KDE's PO File Editor</A></H2>
23 <P>
24 <A NAME="IDX329"></A>
26 </P>
29 <H2><A NAME="SEC57" HREF="gettext_toc.html#TOC57">8.2 GNOME's PO File Editor</A></H2>
30 <P>
31 <A NAME="IDX330"></A>
33 </P>
36 <H2><A NAME="SEC58" HREF="gettext_toc.html#TOC58">8.3 Emacs's PO File Editor</A></H2>
37 <P>
38 <A NAME="IDX331"></A>
40 </P>
42 <P>
43 For those of you being
44 the lucky users of Emacs, PO mode has been specifically created
45 for providing a cozy environment for editing or modifying PO files.
46 While editing a PO file, PO mode allows for the easy browsing of
47 auxiliary and compendium PO files, as well as for following references into
48 the set of C program sources from which PO files have been derived.
49 It has a few special features, among which are the interactive marking
50 of program strings as translatable, and the validation of PO files
51 with easy repositioning to PO file lines showing errors.
53 </P>
54 <P>
55 For the beginning, besides main PO mode commands
56 (see section <A HREF="gettext_8.html#SEC60">8.3.2 Main PO mode Commands</A>), you should know how to move between entries
57 (see section <A HREF="gettext_8.html#SEC61">8.3.3 Entry Positioning</A>), and how to handle untranslated entries
58 (see section <A HREF="gettext_8.html#SEC65">8.3.7 Untranslated Entries</A>).
60 </P>
64 <H3><A NAME="SEC59" HREF="gettext_toc.html#TOC59">8.3.1 Completing GNU <CODE>gettext</CODE> Installation</A></H3>
66 <P>
67 <A NAME="IDX332"></A>
68 <A NAME="IDX333"></A>
69 Once you have received, unpacked, configured and compiled the GNU
70 <CODE>gettext</CODE> distribution, the <SAMP>&lsquo;make install&rsquo;</SAMP> command puts in
71 place the programs <CODE>xgettext</CODE>, <CODE>msgfmt</CODE>, <CODE>gettext</CODE>, and
72 <CODE>msgmerge</CODE>, as well as their available message catalogs. To
73 top off a comfortable installation, you might also want to make the
74 PO mode available to your Emacs users.
76 </P>
77 <P>
78 <A NAME="IDX334"></A>
79 <A NAME="IDX335"></A>
80 During the installation of the PO mode, you might want to modify your
81 file <TT>&lsquo;.emacs&rsquo;</TT>, once and for all, so it contains a few lines looking
82 like:
84 </P>
86 <PRE>
87 (setq auto-mode-alist
88 (cons '("\\.po\\'\\|\\.po\\." . po-mode) auto-mode-alist))
89 (autoload 'po-mode "po-mode" "Major mode for translators to edit PO files" t)
90 </PRE>
92 <P>
93 Later, whenever you edit some <TT>&lsquo;.po&rsquo;</TT>
94 file, or any file having the string <SAMP>&lsquo;.po.&rsquo;</SAMP> within its name,
95 Emacs loads <TT>&lsquo;po-mode.elc&rsquo;</TT> (or <TT>&lsquo;po-mode.el&rsquo;</TT>) as needed, and
96 automatically activates PO mode commands for the associated buffer.
97 The string <EM>PO</EM> appears in the mode line for any buffer for
98 which PO mode is active. Many PO files may be active at once in a
99 single Emacs session.
101 </P>
103 If you are using Emacs version 20 or newer, and have already installed
104 the appropriate international fonts on your system, you may also tell
105 Emacs how to determine automatically the coding system of every PO file.
106 This will often (but not always) cause the necessary fonts to be loaded
107 and used for displaying the translations on your Emacs screen. For this
108 to happen, add the lines:
110 </P>
112 <PRE>
113 (modify-coding-system-alist 'file "\\.po\\'\\|\\.po\\."
114 'po-find-file-coding-system)
115 (autoload 'po-find-file-coding-system "po-mode")
116 </PRE>
119 to your <TT>&lsquo;.emacs&rsquo;</TT> file. If, with this, you still see boxes instead
120 of international characters, try a different font set (via Shift Mouse
121 button 1).
123 </P>
126 <H3><A NAME="SEC60" HREF="gettext_toc.html#TOC60">8.3.2 Main PO mode Commands</A></H3>
129 <A NAME="IDX336"></A>
130 <A NAME="IDX337"></A>
131 After setting up Emacs with something similar to the lines in
132 section <A HREF="gettext_8.html#SEC59">8.3.1 Completing GNU <CODE>gettext</CODE> Installation</A>, PO mode is activated for a window when Emacs finds a
133 PO file in that window. This puts the window read-only and establishes a
134 po-mode-map, which is a genuine Emacs mode, in a way that is not derived
135 from text mode in any way. Functions found on <CODE>po-mode-hook</CODE>,
136 if any, will be executed.
138 </P>
140 When PO mode is active in a window, the letters <SAMP>&lsquo;PO&rsquo;</SAMP> appear
141 in the mode line for that window. The mode line also displays how
142 many entries of each kind are held in the PO file. For example,
143 the string <SAMP>&lsquo;132t+3f+10u+2o&rsquo;</SAMP> would tell the translator that the
144 PO mode contains 132 translated entries (see section <A HREF="gettext_8.html#SEC63">8.3.5 Translated Entries</A>,
145 3 fuzzy entries (see section <A HREF="gettext_8.html#SEC64">8.3.6 Fuzzy Entries</A>), 10 untranslated entries
146 (see section <A HREF="gettext_8.html#SEC65">8.3.7 Untranslated Entries</A>) and 2 obsolete entries (see section <A HREF="gettext_8.html#SEC66">8.3.8 Obsolete Entries</A>). Zero-coefficients items are not shown. So, in this example, if
147 the fuzzy entries were unfuzzied, the untranslated entries were translated
148 and the obsolete entries were deleted, the mode line would merely display
149 <SAMP>&lsquo;145t&rsquo;</SAMP> for the counters.
151 </P>
153 The main PO commands are those which do not fit into the other categories of
154 subsequent sections. These allow for quitting PO mode or for managing windows
155 in special ways.
157 </P>
158 <DL COMPACT>
160 <DT><KBD>_</KBD>
161 <DD>
162 <A NAME="IDX338"></A>
163 Undo last modification to the PO file (<CODE>po-undo</CODE>).
165 <DT><KBD>Q</KBD>
166 <DD>
167 <A NAME="IDX339"></A>
168 Quit processing and save the PO file (<CODE>po-quit</CODE>).
170 <DT><KBD>q</KBD>
171 <DD>
172 <A NAME="IDX340"></A>
173 Quit processing, possibly after confirmation (<CODE>po-confirm-and-quit</CODE>).
175 <DT><KBD>0</KBD>
176 <DD>
177 <A NAME="IDX341"></A>
178 Temporary leave the PO file window (<CODE>po-other-window</CODE>).
180 <DT><KBD>?</KBD>
181 <DD>
182 <DT><KBD>h</KBD>
183 <DD>
184 <A NAME="IDX342"></A>
185 <A NAME="IDX343"></A>
186 Show help about PO mode (<CODE>po-help</CODE>).
188 <DT><KBD>=</KBD>
189 <DD>
190 <A NAME="IDX344"></A>
191 Give some PO file statistics (<CODE>po-statistics</CODE>).
193 <DT><KBD>V</KBD>
194 <DD>
195 <A NAME="IDX345"></A>
196 Batch validate the format of the whole PO file (<CODE>po-validate</CODE>).
198 </DL>
201 <A NAME="IDX346"></A>
202 <A NAME="IDX347"></A>
203 The command <KBD>_</KBD> (<CODE>po-undo</CODE>) interfaces to the Emacs
204 <EM>undo</EM> facility. See section ‘Undoing Changes’ in <CITE>The Emacs Editor</CITE>. Each time <KBD>_</KBD> is typed, modifications which the translator
205 did to the PO file are undone a little more. For the purpose of
206 undoing, each PO mode command is atomic. This is especially true for
207 the <KBD><KBD>RET</KBD></KBD> command: the whole edition made by using a single
208 use of this command is undone at once, even if the edition itself
209 implied several actions. However, while in the editing window, one
210 can undo the edition work quite parsimoniously.
212 </P>
214 <A NAME="IDX348"></A>
215 <A NAME="IDX349"></A>
216 <A NAME="IDX350"></A>
217 <A NAME="IDX351"></A>
218 The commands <KBD>Q</KBD> (<CODE>po-quit</CODE>) and <KBD>q</KBD>
219 (<CODE>po-confirm-and-quit</CODE>) are used when the translator is done with the
220 PO file. The former is a bit less verbose than the latter. If the file
221 has been modified, it is saved to disk first. In both cases, and prior to
222 all this, the commands check if any untranslated messages remain in the
223 PO file and, if so, the translator is asked if she really wants to leave
224 off working with this PO file. This is the preferred way of getting rid
225 of an Emacs PO file buffer. Merely killing it through the usual command
226 <KBD>C-x k</KBD> (<CODE>kill-buffer</CODE>) is not the tidiest way to proceed.
228 </P>
230 <A NAME="IDX352"></A>
231 <A NAME="IDX353"></A>
232 The command <KBD>0</KBD> (<CODE>po-other-window</CODE>) is another, softer way,
233 to leave PO mode, temporarily. It just moves the cursor to some other
234 Emacs window, and pops one if necessary. For example, if the translator
235 just got PO mode to show some source context in some other, she might
236 discover some apparent bug in the program source that needs correction.
237 This command allows the translator to change sex, become a programmer,
238 and have the cursor right into the window containing the program she
239 (or rather <EM>he</EM>) wants to modify. By later getting the cursor back
240 in the PO file window, or by asking Emacs to edit this file once again,
241 PO mode is then recovered.
243 </P>
245 <A NAME="IDX354"></A>
246 <A NAME="IDX355"></A>
247 <A NAME="IDX356"></A>
248 The command <KBD>h</KBD> (<CODE>po-help</CODE>) displays a summary of all available PO
249 mode commands. The translator should then type any character to resume
250 normal PO mode operations. The command <KBD>?</KBD> has the same effect
251 as <KBD>h</KBD>.
253 </P>
255 <A NAME="IDX357"></A>
256 <A NAME="IDX358"></A>
257 The command <KBD>=</KBD> (<CODE>po-statistics</CODE>) computes the total number of
258 entries in the PO file, the ordinal of the current entry (counted from
259 1), the number of untranslated entries, the number of obsolete entries,
260 and displays all these numbers.
262 </P>
264 <A NAME="IDX359"></A>
265 <A NAME="IDX360"></A>
266 The command <KBD>V</KBD> (<CODE>po-validate</CODE>) launches <CODE>msgfmt</CODE> in
267 checking and verbose
268 mode over the current PO file. This command first offers to save the
269 current PO file on disk. The <CODE>msgfmt</CODE> tool, from GNU <CODE>gettext</CODE>,
270 has the purpose of creating a MO file out of a PO file, and PO mode uses
271 the features of this program for checking the overall format of a PO file,
272 as well as all individual entries.
274 </P>
276 <A NAME="IDX361"></A>
277 The program <CODE>msgfmt</CODE> runs asynchronously with Emacs, so the
278 translator regains control immediately while her PO file is being studied.
279 Error output is collected in the Emacs <SAMP>&lsquo;*compilation*&rsquo;</SAMP> buffer,
280 displayed in another window. The regular Emacs command <KBD>C-x`</KBD>
281 (<CODE>next-error</CODE>), as well as other usual compile commands, allow the
282 translator to reposition quickly to the offending parts of the PO file.
283 Once the cursor is on the line in error, the translator may decide on
284 any PO mode action which would help correcting the error.
286 </P>
289 <H3><A NAME="SEC61" HREF="gettext_toc.html#TOC61">8.3.3 Entry Positioning</A></H3>
292 <A NAME="IDX362"></A>
293 The cursor in a PO file window is almost always part of
294 an entry. The only exceptions are the special case when the cursor
295 is after the last entry in the file, or when the PO file is
296 empty. The entry where the cursor is found to be is said to be the
297 current entry. Many PO mode commands operate on the current entry,
298 so moving the cursor does more than allowing the translator to browse
299 the PO file, this also selects on which entry commands operate.
301 </P>
303 <A NAME="IDX363"></A>
304 Some PO mode commands alter the position of the cursor in a specialized
305 way. A few of those special purpose positioning are described here,
306 the others are described in following sections (for a complete list try
307 <KBD>C-h m</KBD>):
309 </P>
310 <DL COMPACT>
312 <DT><KBD>.</KBD>
313 <DD>
314 <A NAME="IDX364"></A>
315 Redisplay the current entry (<CODE>po-current-entry</CODE>).
317 <DT><KBD>n</KBD>
318 <DD>
319 <A NAME="IDX365"></A>
320 Select the entry after the current one (<CODE>po-next-entry</CODE>).
322 <DT><KBD>p</KBD>
323 <DD>
324 <A NAME="IDX366"></A>
325 Select the entry before the current one (<CODE>po-previous-entry</CODE>).
327 <DT><KBD>&#60;</KBD>
328 <DD>
329 <A NAME="IDX367"></A>
330 Select the first entry in the PO file (<CODE>po-first-entry</CODE>).
332 <DT><KBD>&#62;</KBD>
333 <DD>
334 <A NAME="IDX368"></A>
335 Select the last entry in the PO file (<CODE>po-last-entry</CODE>).
337 <DT><KBD>m</KBD>
338 <DD>
339 <A NAME="IDX369"></A>
340 Record the location of the current entry for later use
341 (<CODE>po-push-location</CODE>).
343 <DT><KBD>r</KBD>
344 <DD>
345 <A NAME="IDX370"></A>
346 Return to a previously saved entry location (<CODE>po-pop-location</CODE>).
348 <DT><KBD>x</KBD>
349 <DD>
350 <A NAME="IDX371"></A>
351 Exchange the current entry location with the previously saved one
352 (<CODE>po-exchange-location</CODE>).
354 </DL>
357 <A NAME="IDX372"></A>
358 <A NAME="IDX373"></A>
359 Any Emacs command able to reposition the cursor may be used
360 to select the current entry in PO mode, including commands which
361 move by characters, lines, paragraphs, screens or pages, and search
362 commands. However, there is a kind of standard way to display the
363 current entry in PO mode, which usual Emacs commands moving
364 the cursor do not especially try to enforce. The command <KBD>.</KBD>
365 (<CODE>po-current-entry</CODE>) has the sole purpose of redisplaying the
366 current entry properly, after the current entry has been changed by
367 means external to PO mode, or the Emacs screen otherwise altered.
369 </P>
371 It is yet to be decided if PO mode helps the translator, or otherwise
372 irritates her, by forcing a rigid window disposition while she
373 is doing her work. We originally had quite precise ideas about
374 how windows should behave, but on the other hand, anyone used to
375 Emacs is often happy to keep full control. Maybe a fixed window
376 disposition might be offered as a PO mode option that the translator
377 might activate or deactivate at will, so it could be offered on an
378 experimental basis. If nobody feels a real need for using it, or
379 a compulsion for writing it, we should drop this whole idea.
380 The incentive for doing it should come from translators rather than
381 programmers, as opinions from an experienced translator are surely
382 more worth to me than opinions from programmers <EM>thinking</EM> about
383 how <EM>others</EM> should do translation.
385 </P>
387 <A NAME="IDX374"></A>
388 <A NAME="IDX375"></A>
389 <A NAME="IDX376"></A>
390 <A NAME="IDX377"></A>
391 The commands <KBD>n</KBD> (<CODE>po-next-entry</CODE>) and <KBD>p</KBD>
392 (<CODE>po-previous-entry</CODE>) move the cursor the entry following,
393 or preceding, the current one. If <KBD>n</KBD> is given while the
394 cursor is on the last entry of the PO file, or if <KBD>p</KBD>
395 is given while the cursor is on the first entry, no move is done.
397 </P>
399 <A NAME="IDX378"></A>
400 <A NAME="IDX379"></A>
401 <A NAME="IDX380"></A>
402 <A NAME="IDX381"></A>
403 The commands <KBD>&#60;</KBD> (<CODE>po-first-entry</CODE>) and <KBD>&#62;</KBD>
404 (<CODE>po-last-entry</CODE>) move the cursor to the first entry, or last
405 entry, of the PO file. When the cursor is located past the last
406 entry in a PO file, most PO mode commands will return an error saying
407 <SAMP>&lsquo;After last entry&rsquo;</SAMP>. Moreover, the commands <KBD>&#60;</KBD> and <KBD>&#62;</KBD>
408 have the special property of being able to work even when the cursor
409 is not into some PO file entry, and one may use them for nicely
410 correcting this situation. But even these commands will fail on a
411 truly empty PO file. There are development plans for the PO mode for it
412 to interactively fill an empty PO file from sources. See section <A HREF="gettext_4.html#SEC21">4.5 Marking Translatable Strings</A>.
414 </P>
416 The translator may decide, before working at the translation of
417 a particular entry, that she needs to browse the remainder of the
418 PO file, maybe for finding the terminology or phraseology used
419 in related entries. She can of course use the standard Emacs idioms
420 for saving the current cursor location in some register, and use that
421 register for getting back, or else, use the location ring.
423 </P>
425 <A NAME="IDX382"></A>
426 <A NAME="IDX383"></A>
427 <A NAME="IDX384"></A>
428 <A NAME="IDX385"></A>
429 PO mode offers another approach, by which cursor locations may be saved
430 onto a special stack. The command <KBD>m</KBD> (<CODE>po-push-location</CODE>)
431 merely adds the location of current entry to the stack, pushing
432 the already saved locations under the new one. The command
433 <KBD>r</KBD> (<CODE>po-pop-location</CODE>) consumes the top stack element and
434 repositions the cursor to the entry associated with that top element.
435 This position is then lost, for the next <KBD>r</KBD> will move the cursor
436 to the previously saved location, and so on until no locations remain
437 on the stack.
439 </P>
441 If the translator wants the position to be kept on the location stack,
442 maybe for taking a look at the entry associated with the top
443 element, then go elsewhere with the intent of getting back later, she
444 ought to use <KBD>m</KBD> immediately after <KBD>r</KBD>.
446 </P>
448 <A NAME="IDX386"></A>
449 <A NAME="IDX387"></A>
450 The command <KBD>x</KBD> (<CODE>po-exchange-location</CODE>) simultaneously
451 repositions the cursor to the entry associated with the top element of
452 the stack of saved locations, and replaces that top element with the
453 location of the current entry before the move. Consequently, repeating
454 the <KBD>x</KBD> command toggles alternatively between two entries.
455 For achieving this, the translator will position the cursor on the
456 first entry, use <KBD>m</KBD>, then position to the second entry, and
457 merely use <KBD>x</KBD> for making the switch.
459 </P>
462 <H3><A NAME="SEC62" HREF="gettext_toc.html#TOC62">8.3.4 Normalizing Strings in Entries</A></H3>
464 <A NAME="IDX388"></A>
466 </P>
468 There are many different ways for encoding a particular string into a
469 PO file entry, because there are so many different ways to split and
470 quote multi-line strings, and even, to represent special characters
471 by backslashed escaped sequences. Some features of PO mode rely on
472 the ability for PO mode to scan an already existing PO file for a
473 particular string encoded into the <CODE>msgid</CODE> field of some entry.
474 Even if PO mode has internally all the built-in machinery for
475 implementing this recognition easily, doing it fast is technically
476 difficult. To facilitate a solution to this efficiency problem,
477 we decided on a canonical representation for strings.
479 </P>
481 A conventional representation of strings in a PO file is currently
482 under discussion, and PO mode experiments with a canonical representation.
483 Having both <CODE>xgettext</CODE> and PO mode converging towards a uniform
484 way of representing equivalent strings would be useful, as the internal
485 normalization needed by PO mode could be automatically satisfied
486 when using <CODE>xgettext</CODE> from GNU <CODE>gettext</CODE>. An explicit
487 PO mode normalization should then be only necessary for PO files
488 imported from elsewhere, or for when the convention itself evolves.
490 </P>
492 So, for achieving normalization of at least the strings of a given
493 PO file needing a canonical representation, the following PO mode
494 command is available:
496 </P>
498 <A NAME="IDX389"></A>
499 <DL COMPACT>
501 <DT><KBD>M-x po-normalize</KBD>
502 <DD>
503 <A NAME="IDX390"></A>
504 Tidy the whole PO file by making entries more uniform.
506 </DL>
509 The special command <KBD>M-x po-normalize</KBD>, which has no associated
510 keys, revises all entries, ensuring that strings of both original
511 and translated entries use uniform internal quoting in the PO file.
512 It also removes any crumb after the last entry. This command may be
513 useful for PO files freshly imported from elsewhere, or if we ever
514 improve on the canonical quoting format we use. This canonical format
515 is not only meant for getting cleaner PO files, but also for greatly
516 speeding up <CODE>msgid</CODE> string lookup for some other PO mode commands.
518 </P>
520 <KBD>M-x po-normalize</KBD> presently makes three passes over the entries.
521 The first implements heuristics for converting PO files for GNU
522 <CODE>gettext</CODE> 0.6 and earlier, in which <CODE>msgid</CODE> and <CODE>msgstr</CODE>
523 fields were using K&#38;R style C string syntax for multi-line strings.
524 These heuristics may fail for comments not related to obsolete
525 entries and ending with a backslash; they also depend on subsequent
526 passes for finalizing the proper commenting of continued lines for
527 obsolete entries. This first pass might disappear once all oldish PO
528 files would have been adjusted. The second and third pass normalize
529 all <CODE>msgid</CODE> and <CODE>msgstr</CODE> strings respectively. They also
530 clean out those trailing backslashes used by XView's <CODE>msgfmt</CODE>
531 for continued lines.
533 </P>
535 <A NAME="IDX391"></A>
536 Having such an explicit normalizing command allows for importing PO
537 files from other sources, but also eases the evolution of the current
538 convention, evolution driven mostly by aesthetic concerns, as of now.
539 It is easy to make suggested adjustments at a later time, as the
540 normalizing command and eventually, other GNU <CODE>gettext</CODE> tools
541 should greatly automate conformance. A description of the canonical
542 string format is given below, for the particular benefit of those not
543 having Emacs handy, and who would nevertheless want to handcraft
544 their PO files in nice ways.
546 </P>
548 <A NAME="IDX392"></A>
549 Right now, in PO mode, strings are single line or multi-line. A string
550 goes multi-line if and only if it has <EM>embedded</EM> newlines, that
551 is, if it matches <SAMP>&lsquo;[^\n]\n+[^\n]&rsquo;</SAMP>. So, we would have:
553 </P>
555 <PRE>
556 msgstr "\n\nHello, world!\n\n\n"
557 </PRE>
560 but, replacing the space by a newline, this becomes:
562 </P>
564 <PRE>
565 msgstr ""
566 "\n"
567 "\n"
568 "Hello,\n"
569 "world!\n"
570 "\n"
571 "\n"
572 </PRE>
575 We are deliberately using a caricatural example, here, to make the
576 point clearer. Usually, multi-lines are not that bad looking.
577 It is probable that we will implement the following suggestion.
578 We might lump together all initial newlines into the empty string,
579 and also all newlines introducing empty lines (that is, for <VAR>n</VAR>
580 &#62; 1, the <VAR>n</VAR>-1'th last newlines would go together on a separate
581 string), so making the previous example appear:
583 </P>
585 <PRE>
586 msgstr "\n\n"
587 "Hello,\n"
588 "world!\n"
589 "\n\n"
590 </PRE>
593 There are a few yet undecided little points about string normalization,
594 to be documented in this manual, once these questions settle.
596 </P>
599 <H3><A NAME="SEC63" HREF="gettext_toc.html#TOC63">8.3.5 Translated Entries</A></H3>
601 <A NAME="IDX393"></A>
603 </P>
605 Each PO file entry for which the <CODE>msgstr</CODE> field has been filled with
606 a translation, and which is not marked as fuzzy (see section <A HREF="gettext_8.html#SEC64">8.3.6 Fuzzy Entries</A>),
607 is said to be a <EM>translated</EM> entry. Only translated entries will
608 later be compiled by GNU <CODE>msgfmt</CODE> and become usable in programs.
609 Other entry types will be excluded; translation will not occur for them.
611 </P>
613 <A NAME="IDX394"></A>
614 Some commands are more specifically related to translated entry processing.
616 </P>
617 <DL COMPACT>
619 <DT><KBD>t</KBD>
620 <DD>
621 <A NAME="IDX395"></A>
622 Find the next translated entry (<CODE>po-next-translated-entry</CODE>).
624 <DT><KBD>T</KBD>
625 <DD>
626 <A NAME="IDX396"></A>
627 Find the previous translated entry (<CODE>po-previous-translated-entry</CODE>).
629 </DL>
632 <A NAME="IDX397"></A>
633 <A NAME="IDX398"></A>
634 <A NAME="IDX399"></A>
635 <A NAME="IDX400"></A>
636 The commands <KBD>t</KBD> (<CODE>po-next-translated-entry</CODE>) and <KBD>T</KBD>
637 (<CODE>po-previous-translated-entry</CODE>) move forwards or backwards, chasing
638 for an translated entry. If none is found, the search is extended and
639 wraps around in the PO file buffer.
641 </P>
643 <A NAME="IDX401"></A>
644 Translated entries usually result from the translator having edited in
645 a translation for them, section <A HREF="gettext_8.html#SEC67">8.3.9 Modifying Translations</A>. However, if the
646 variable <CODE>po-auto-fuzzy-on-edit</CODE> is not <CODE>nil</CODE>, the entry having
647 received a new translation first becomes a fuzzy entry, which ought to
648 be later unfuzzied before becoming an official, genuine translated entry.
649 See section <A HREF="gettext_8.html#SEC64">8.3.6 Fuzzy Entries</A>.
651 </P>
654 <H3><A NAME="SEC64" HREF="gettext_toc.html#TOC64">8.3.6 Fuzzy Entries</A></H3>
656 <A NAME="IDX402"></A>
658 </P>
660 <A NAME="IDX403"></A>
661 <A NAME="IDX404"></A>
662 Each PO file entry may have a set of <EM>attributes</EM>, which are
663 qualities given a name and explicitly associated with the translation,
664 using a special system comment. One of these attributes
665 has the name <CODE>fuzzy</CODE>, and entries having this attribute are said
666 to have a fuzzy translation. They are called fuzzy entries, for short.
668 </P>
670 Fuzzy entries, even if they account for translated entries for
671 most other purposes, usually call for revision by the translator.
672 Those may be produced by applying the program <CODE>msgmerge</CODE> to
673 update an older translated PO files according to a new PO template
674 file, when this tool hypothesises that some new <CODE>msgid</CODE> has
675 been modified only slightly out of an older one, and chooses to pair
676 what it thinks to be the old translation for the new modified entry.
677 The slight alteration in the original string (the <CODE>msgid</CODE> string)
678 should often be reflected in the translated string, and this requires
679 the intervention of the translator. For this reason, <CODE>msgmerge</CODE>
680 might mark some entries as being fuzzy.
682 </P>
684 <A NAME="IDX405"></A>
685 Also, the translator may decide herself to mark an entry as fuzzy
686 for her own convenience, when she wants to remember that the entry
687 has to be later revisited. So, some commands are more specifically
688 related to fuzzy entry processing.
690 </P>
691 <DL COMPACT>
693 <DT><KBD>f</KBD>
694 <DD>
695 <A NAME="IDX406"></A>
696 Find the next fuzzy entry (<CODE>po-next-fuzzy-entry</CODE>).
698 <DT><KBD>F</KBD>
699 <DD>
700 <A NAME="IDX407"></A>
701 Find the previous fuzzy entry (<CODE>po-previous-fuzzy-entry</CODE>).
703 <DT><KBD><KBD>TAB</KBD></KBD>
704 <DD>
705 <A NAME="IDX408"></A>
706 Remove the fuzzy attribute of the current entry (<CODE>po-unfuzzy</CODE>).
708 </DL>
711 <A NAME="IDX409"></A>
712 <A NAME="IDX410"></A>
713 <A NAME="IDX411"></A>
714 <A NAME="IDX412"></A>
715 The commands <KBD>f</KBD> (<CODE>po-next-fuzzy-entry</CODE>) and <KBD>F</KBD>
716 (<CODE>po-previous-fuzzy-entry</CODE>) move forwards or backwards, chasing for
717 a fuzzy entry. If none is found, the search is extended and wraps
718 around in the PO file buffer.
720 </P>
722 <A NAME="IDX413"></A>
723 <A NAME="IDX414"></A>
724 <A NAME="IDX415"></A>
725 The command <KBD><KBD>TAB</KBD></KBD> (<CODE>po-unfuzzy</CODE>) removes the fuzzy
726 attribute associated with an entry, usually leaving it translated.
727 Further, if the variable <CODE>po-auto-select-on-unfuzzy</CODE> has not
728 the <CODE>nil</CODE> value, the <KBD><KBD>TAB</KBD></KBD> command will automatically chase
729 for another interesting entry to work on. The initial value of
730 <CODE>po-auto-select-on-unfuzzy</CODE> is <CODE>nil</CODE>.
732 </P>
734 The initial value of <CODE>po-auto-fuzzy-on-edit</CODE> is <CODE>nil</CODE>. However,
735 if the variable <CODE>po-auto-fuzzy-on-edit</CODE> is set to <CODE>t</CODE>, any entry
736 edited through the <KBD><KBD>RET</KBD></KBD> command is marked fuzzy, as a way to
737 ensure some kind of double check, later. In this case, the usual paradigm
738 is that an entry becomes fuzzy (if not already) whenever the translator
739 modifies it. If she is satisfied with the translation, she then uses
740 <KBD><KBD>TAB</KBD></KBD> to pick another entry to work on, clearing the fuzzy attribute
741 on the same blow. If she is not satisfied yet, she merely uses <KBD><KBD>SPC</KBD></KBD>
742 to chase another entry, leaving the entry fuzzy.
744 </P>
746 <A NAME="IDX416"></A>
747 <A NAME="IDX417"></A>
748 The translator may also use the <KBD><KBD>DEL</KBD></KBD> command
749 (<CODE>po-fade-out-entry</CODE>) over any translated entry to mark it as being
750 fuzzy, when she wants to easily leave a trace she wants to later return
751 working at this entry.
753 </P>
755 Also, when time comes to quit working on a PO file buffer with the <KBD>q</KBD>
756 command, the translator is asked for confirmation, if fuzzy string
757 still exists.
759 </P>
762 <H3><A NAME="SEC65" HREF="gettext_toc.html#TOC65">8.3.7 Untranslated Entries</A></H3>
764 <A NAME="IDX418"></A>
766 </P>
768 When <CODE>xgettext</CODE> originally creates a PO file, unless told
769 otherwise, it initializes the <CODE>msgid</CODE> field with the untranslated
770 string, and leaves the <CODE>msgstr</CODE> string to be empty. Such entries,
771 having an empty translation, are said to be <EM>untranslated</EM> entries.
772 Later, when the programmer slightly modifies some string right in
773 the program, this change is later reflected in the PO file
774 by the appearance of a new untranslated entry for the modified string.
776 </P>
778 The usual commands moving from entry to entry consider untranslated
779 entries on the same level as active entries. Untranslated entries
780 are easily recognizable by the fact they end with <SAMP>&lsquo;msgstr ""&rsquo;</SAMP>.
782 </P>
784 <A NAME="IDX419"></A>
785 The work of the translator might be (quite naively) seen as the process
786 of seeking for an untranslated entry, editing a translation for
787 it, and repeating these actions until no untranslated entries remain.
788 Some commands are more specifically related to untranslated entry
789 processing.
791 </P>
792 <DL COMPACT>
794 <DT><KBD>u</KBD>
795 <DD>
796 <A NAME="IDX420"></A>
797 Find the next untranslated entry (<CODE>po-next-untranslated-entry</CODE>).
799 <DT><KBD>U</KBD>
800 <DD>
801 <A NAME="IDX421"></A>
802 Find the previous untranslated entry (<CODE>po-previous-untransted-entry</CODE>).
804 <DT><KBD>k</KBD>
805 <DD>
806 <A NAME="IDX422"></A>
807 Turn the current entry into an untranslated one (<CODE>po-kill-msgstr</CODE>).
809 </DL>
812 <A NAME="IDX423"></A>
813 <A NAME="IDX424"></A>
814 <A NAME="IDX425"></A>
815 <A NAME="IDX426"></A>
816 The commands <KBD>u</KBD> (<CODE>po-next-untranslated-entry</CODE>) and <KBD>U</KBD>
817 (<CODE>po-previous-untransted-entry</CODE>) move forwards or backwards,
818 chasing for an untranslated entry. If none is found, the search is
819 extended and wraps around in the PO file buffer.
821 </P>
823 <A NAME="IDX427"></A>
824 <A NAME="IDX428"></A>
825 An entry can be turned back into an untranslated entry by
826 merely emptying its translation, using the command <KBD>k</KBD>
827 (<CODE>po-kill-msgstr</CODE>). See section <A HREF="gettext_8.html#SEC67">8.3.9 Modifying Translations</A>.
829 </P>
831 Also, when time comes to quit working on a PO file buffer
832 with the <KBD>q</KBD> command, the translator is asked for confirmation,
833 if some untranslated string still exists.
835 </P>
838 <H3><A NAME="SEC66" HREF="gettext_toc.html#TOC66">8.3.8 Obsolete Entries</A></H3>
840 <A NAME="IDX429"></A>
842 </P>
844 By <EM>obsolete</EM> PO file entries, we mean those entries which are
845 commented out, usually by <CODE>msgmerge</CODE> when it found that the
846 translation is not needed anymore by the package being localized.
848 </P>
850 The usual commands moving from entry to entry consider obsolete
851 entries on the same level as active entries. Obsolete entries are
852 easily recognizable by the fact that all their lines start with
853 <CODE>#</CODE>, even those lines containing <CODE>msgid</CODE> or <CODE>msgstr</CODE>.
855 </P>
857 Commands exist for emptying the translation or reinitializing it
858 to the original untranslated string. Commands interfacing with the
859 kill ring may force some previously saved text into the translation.
860 The user may interactively edit the translation. All these commands
861 may apply to obsolete entries, carefully leaving the entry obsolete
862 after the fact.
864 </P>
866 <A NAME="IDX430"></A>
867 Moreover, some commands are more specifically related to obsolete
868 entry processing.
870 </P>
871 <DL COMPACT>
873 <DT><KBD>o</KBD>
874 <DD>
875 <A NAME="IDX431"></A>
876 Find the next obsolete entry (<CODE>po-next-obsolete-entry</CODE>).
878 <DT><KBD>O</KBD>
879 <DD>
880 <A NAME="IDX432"></A>
881 Find the previous obsolete entry (<CODE>po-previous-obsolete-entry</CODE>).
883 <DT><KBD><KBD>DEL</KBD></KBD>
884 <DD>
885 <A NAME="IDX433"></A>
886 Make an active entry obsolete, or zap out an obsolete entry
887 (<CODE>po-fade-out-entry</CODE>).
889 </DL>
892 <A NAME="IDX434"></A>
893 <A NAME="IDX435"></A>
894 <A NAME="IDX436"></A>
895 <A NAME="IDX437"></A>
896 The commands <KBD>o</KBD> (<CODE>po-next-obsolete-entry</CODE>) and <KBD>O</KBD>
897 (<CODE>po-previous-obsolete-entry</CODE>) move forwards or backwards,
898 chasing for an obsolete entry. If none is found, the search is
899 extended and wraps around in the PO file buffer.
901 </P>
903 PO mode does not provide ways for un-commenting an obsolete entry
904 and making it active, because this would reintroduce an original
905 untranslated string which does not correspond to any marked string
906 in the program sources. This goes with the philosophy of never
907 introducing useless <CODE>msgid</CODE> values.
909 </P>
911 <A NAME="IDX438"></A>
912 <A NAME="IDX439"></A>
913 <A NAME="IDX440"></A>
914 <A NAME="IDX441"></A>
915 However, it is possible to comment out an active entry, so making
916 it obsolete. GNU <CODE>gettext</CODE> utilities will later react to the
917 disappearance of a translation by using the untranslated string.
918 The command <KBD><KBD>DEL</KBD></KBD> (<CODE>po-fade-out-entry</CODE>) pushes the current entry
919 a little further towards annihilation. If the entry is active (it is a
920 translated entry), then it is first made fuzzy. If it is already fuzzy,
921 then the entry is merely commented out, with confirmation. If the entry
922 is already obsolete, then it is completely deleted from the PO file.
923 It is easy to recycle the translation so deleted into some other PO file
924 entry, usually one which is untranslated. See section <A HREF="gettext_8.html#SEC67">8.3.9 Modifying Translations</A>.
926 </P>
928 Here is a quite interesting problem to solve for later development of
929 PO mode, for those nights you are not sleepy. The idea would be that
930 PO mode might become bright enough, one of these days, to make good
931 guesses at retrieving the most probable candidate, among all obsolete
932 entries, for initializing the translation of a newly appeared string.
933 I think it might be a quite hard problem to do this algorithmically, as
934 we have to develop good and efficient measures of string similarity.
935 Right now, PO mode completely lets the decision to the translator,
936 when the time comes to find the adequate obsolete translation, it
937 merely tries to provide handy tools for helping her to do so.
939 </P>
942 <H3><A NAME="SEC67" HREF="gettext_toc.html#TOC67">8.3.9 Modifying Translations</A></H3>
944 <A NAME="IDX442"></A>
945 <A NAME="IDX443"></A>
947 </P>
949 PO mode prevents direct modification of the PO file, by the usual
950 means Emacs gives for altering a buffer's contents. By doing so,
951 it pretends helping the translator to avoid little clerical errors
952 about the overall file format, or the proper quoting of strings,
953 as those errors would be easily made. Other kinds of errors are
954 still possible, but some may be caught and diagnosed by the batch
955 validation process, which the translator may always trigger by the
956 <KBD>V</KBD> command. For all other errors, the translator has to rely on
957 her own judgment, and also on the linguistic reports submitted to her
958 by the users of the translated package, having the same mother tongue.
960 </P>
962 When the time comes to create a translation, correct an error diagnosed
963 mechanically or reported by a user, the translators have to resort to
964 using the following commands for modifying the translations.
966 </P>
967 <DL COMPACT>
969 <DT><KBD><KBD>RET</KBD></KBD>
970 <DD>
971 <A NAME="IDX444"></A>
972 Interactively edit the translation (<CODE>po-edit-msgstr</CODE>).
974 <DT><KBD><KBD>LFD</KBD></KBD>
975 <DD>
976 <DT><KBD>C-j</KBD>
977 <DD>
978 <A NAME="IDX445"></A>
979 <A NAME="IDX446"></A>
980 Reinitialize the translation with the original, untranslated string
981 (<CODE>po-msgid-to-msgstr</CODE>).
983 <DT><KBD>k</KBD>
984 <DD>
985 <A NAME="IDX447"></A>
986 Save the translation on the kill ring, and delete it (<CODE>po-kill-msgstr</CODE>).
988 <DT><KBD>w</KBD>
989 <DD>
990 <A NAME="IDX448"></A>
991 Save the translation on the kill ring, without deleting it
992 (<CODE>po-kill-ring-save-msgstr</CODE>).
994 <DT><KBD>y</KBD>
995 <DD>
996 <A NAME="IDX449"></A>
997 Replace the translation, taking the new from the kill ring
998 (<CODE>po-yank-msgstr</CODE>).
1000 </DL>
1003 <A NAME="IDX450"></A>
1004 <A NAME="IDX451"></A>
1005 The command <KBD><KBD>RET</KBD></KBD> (<CODE>po-edit-msgstr</CODE>) opens a new Emacs
1006 window meant to edit in a new translation, or to modify an already existing
1007 translation. The new window contains a copy of the translation taken from
1008 the current PO file entry, all ready for edition, expunged of all quoting
1009 marks, fully modifiable and with the complete extent of Emacs modifying
1010 commands. When the translator is done with her modifications, she may use
1011 <KBD>C-c C-c</KBD> to close the subedit window with the automatically requoted
1012 results, or <KBD>C-c C-k</KBD> to abort her modifications. See section <A HREF="gettext_8.html#SEC69">8.3.11 Details of Sub Edition</A>,
1013 for more information.
1015 </P>
1017 <A NAME="IDX452"></A>
1018 <A NAME="IDX453"></A>
1019 <A NAME="IDX454"></A>
1020 The command <KBD><KBD>LFD</KBD></KBD> (<CODE>po-msgid-to-msgstr</CODE>) initializes, or
1021 reinitializes the translation with the original string. This command is
1022 normally used when the translator wants to redo a fresh translation of
1023 the original string, disregarding any previous work.
1025 </P>
1027 <A NAME="IDX455"></A>
1028 It is possible to arrange so, whenever editing an untranslated
1029 entry, the <KBD><KBD>LFD</KBD></KBD> command be automatically executed. If you set
1030 <CODE>po-auto-edit-with-msgid</CODE> to <CODE>t</CODE>, the translation gets
1031 initialised with the original string, in case none exists already.
1032 The default value for <CODE>po-auto-edit-with-msgid</CODE> is <CODE>nil</CODE>.
1034 </P>
1036 <A NAME="IDX456"></A>
1037 In fact, whether it is best to start a translation with an empty
1038 string, or rather with a copy of the original string, is a matter of
1039 taste or habit. Sometimes, the source language and the
1040 target language are so different that is simply best to start writing
1041 on an empty page. At other times, the source and target languages
1042 are so close that it would be a waste to retype a number of words
1043 already being written in the original string. A translator may also
1044 like having the original string right under her eyes, as she will
1045 progressively overwrite the original text with the translation, even
1046 if this requires some extra editing work to get rid of the original.
1048 </P>
1050 <A NAME="IDX457"></A>
1051 <A NAME="IDX458"></A>
1052 <A NAME="IDX459"></A>
1053 <A NAME="IDX460"></A>
1054 <A NAME="IDX461"></A>
1055 The command <KBD>k</KBD> (<CODE>po-kill-msgstr</CODE>) merely empties the
1056 translation string, so turning the entry into an untranslated
1057 one. But while doing so, its previous contents is put apart in
1058 a special place, known as the kill ring. The command <KBD>w</KBD>
1059 (<CODE>po-kill-ring-save-msgstr</CODE>) has also the effect of taking a
1060 copy of the translation onto the kill ring, but it otherwise leaves
1061 the entry alone, and does <EM>not</EM> remove the translation from the
1062 entry. Both commands use exactly the Emacs kill ring, which is shared
1063 between buffers, and which is well known already to Emacs lovers.
1065 </P>
1067 The translator may use <KBD>k</KBD> or <KBD>w</KBD> many times in the course
1068 of her work, as the kill ring may hold several saved translations.
1069 From the kill ring, strings may later be reinserted in various
1070 Emacs buffers. In particular, the kill ring may be used for moving
1071 translation strings between different entries of a single PO file
1072 buffer, or if the translator is handling many such buffers at once,
1073 even between PO files.
1075 </P>
1077 To facilitate exchanges with buffers which are not in PO mode, the
1078 translation string put on the kill ring by the <KBD>k</KBD> command is fully
1079 unquoted before being saved: external quotes are removed, multi-line
1080 strings are concatenated, and backslash escaped sequences are turned
1081 into their corresponding characters. In the special case of obsolete
1082 entries, the translation is also uncommented prior to saving.
1084 </P>
1086 <A NAME="IDX462"></A>
1087 <A NAME="IDX463"></A>
1088 The command <KBD>y</KBD> (<CODE>po-yank-msgstr</CODE>) completely replaces the
1089 translation of the current entry by a string taken from the kill ring.
1090 Following Emacs terminology, we then say that the replacement
1091 string is <EM>yanked</EM> into the PO file buffer.
1092 See section ‘Yanking’ in <CITE>The Emacs Editor</CITE>.
1093 The first time <KBD>y</KBD> is used, the translation receives the value of
1094 the most recent addition to the kill ring. If <KBD>y</KBD> is typed once
1095 again, immediately, without intervening keystrokes, the translation
1096 just inserted is taken away and replaced by the second most recent
1097 addition to the kill ring. By repeating <KBD>y</KBD> many times in a row,
1098 the translator may travel along the kill ring for saved strings,
1099 until she finds the string she really wanted.
1101 </P>
1103 When a string is yanked into a PO file entry, it is fully and
1104 automatically requoted for complying with the format PO files should
1105 have. Further, if the entry is obsolete, PO mode then appropriately
1106 push the inserted string inside comments. Once again, translators
1107 should not burden themselves with quoting considerations besides, of
1108 course, the necessity of the translated string itself respective to
1109 the program using it.
1111 </P>
1113 Note that <KBD>k</KBD> or <KBD>w</KBD> are not the only commands pushing strings
1114 on the kill ring, as almost any PO mode command replacing translation
1115 strings (or the translator comments) automatically saves the old string
1116 on the kill ring. The main exceptions to this general rule are the
1117 yanking commands themselves.
1119 </P>
1121 <A NAME="IDX464"></A>
1122 To better illustrate the operation of killing and yanking, let's
1123 use an actual example, taken from a common situation. When the
1124 programmer slightly modifies some string right in the program, his
1125 change is later reflected in the PO file by the appearance
1126 of a new untranslated entry for the modified string, and the fact
1127 that the entry translating the original or unmodified string becomes
1128 obsolete. In many cases, the translator might spare herself some work
1129 by retrieving the unmodified translation from the obsolete entry,
1130 then initializing the untranslated entry <CODE>msgstr</CODE> field with
1131 this retrieved translation. Once this done, the obsolete entry is
1132 not wanted anymore, and may be safely deleted.
1134 </P>
1136 When the translator finds an untranslated entry and suspects that a
1137 slight variant of the translation exists, she immediately uses <KBD>m</KBD>
1138 to mark the current entry location, then starts chasing obsolete
1139 entries with <KBD>o</KBD>, hoping to find some translation corresponding
1140 to the unmodified string. Once found, she uses the <KBD><KBD>DEL</KBD></KBD> command
1141 for deleting the obsolete entry, knowing that <KBD><KBD>DEL</KBD></KBD> also <EM>kills</EM>
1142 the translation, that is, pushes the translation on the kill ring.
1143 Then, <KBD>r</KBD> returns to the initial untranslated entry, and <KBD>y</KBD>
1144 then <EM>yanks</EM> the saved translation right into the <CODE>msgstr</CODE>
1145 field. The translator is then free to use <KBD><KBD>RET</KBD></KBD> for fine
1146 tuning the translation contents, and maybe to later use <KBD>u</KBD>,
1147 then <KBD>m</KBD> again, for going on with the next untranslated string.
1149 </P>
1151 When some sequence of keys has to be typed over and over again, the
1152 translator may find it useful to become better acquainted with the Emacs
1153 capability of learning these sequences and playing them back under request.
1154 See section ‘Keyboard Macros’ in <CITE>The Emacs Editor</CITE>.
1156 </P>
1159 <H3><A NAME="SEC68" HREF="gettext_toc.html#TOC68">8.3.10 Modifying Comments</A></H3>
1161 <A NAME="IDX465"></A>
1162 <A NAME="IDX466"></A>
1164 </P>
1166 Any translation work done seriously will raise many linguistic
1167 difficulties, for which decisions have to be made, and the choices
1168 further documented. These documents may be saved within the
1169 PO file in form of translator comments, which the translator
1170 is free to create, delete, or modify at will. These comments may
1171 be useful to herself when she returns to this PO file after a while.
1173 </P>
1175 Comments not having whitespace after the initial <SAMP>&lsquo;#&rsquo;</SAMP>, for example,
1176 those beginning with <SAMP>&lsquo;#.&rsquo;</SAMP> or <SAMP>&lsquo;#:&rsquo;</SAMP>, are <EM>not</EM> translator
1177 comments, they are exclusively created by other <CODE>gettext</CODE> tools.
1178 So, the commands below will never alter such system added comments,
1179 they are not meant for the translator to modify. See section <A HREF="gettext_3.html#SEC15">3 The Format of PO Files</A>.
1181 </P>
1183 The following commands are somewhat similar to those modifying translations,
1184 so the general indications given for those apply here. See section <A HREF="gettext_8.html#SEC67">8.3.9 Modifying Translations</A>.
1186 </P>
1187 <DL COMPACT>
1189 <DT><KBD>#</KBD>
1190 <DD>
1191 <A NAME="IDX467"></A>
1192 Interactively edit the translator comments (<CODE>po-edit-comment</CODE>).
1194 <DT><KBD>K</KBD>
1195 <DD>
1196 <A NAME="IDX468"></A>
1197 Save the translator comments on the kill ring, and delete it
1198 (<CODE>po-kill-comment</CODE>).
1200 <DT><KBD>W</KBD>
1201 <DD>
1202 <A NAME="IDX469"></A>
1203 Save the translator comments on the kill ring, without deleting it
1204 (<CODE>po-kill-ring-save-comment</CODE>).
1206 <DT><KBD>Y</KBD>
1207 <DD>
1208 <A NAME="IDX470"></A>
1209 Replace the translator comments, taking the new from the kill ring
1210 (<CODE>po-yank-comment</CODE>).
1212 </DL>
1215 These commands parallel PO mode commands for modifying the translation
1216 strings, and behave much the same way as they do, except that they handle
1217 this part of PO file comments meant for translator usage, rather
1218 than the translation strings. So, if the descriptions given below are
1219 slightly succinct, it is because the full details have already been given.
1220 See section <A HREF="gettext_8.html#SEC67">8.3.9 Modifying Translations</A>.
1222 </P>
1224 <A NAME="IDX471"></A>
1225 <A NAME="IDX472"></A>
1226 The command <KBD>#</KBD> (<CODE>po-edit-comment</CODE>) opens a new Emacs window
1227 containing a copy of the translator comments on the current PO file entry.
1228 If there are no such comments, PO mode understands that the translator wants
1229 to add a comment to the entry, and she is presented with an empty screen.
1230 Comment marks (<CODE>#</CODE>) and the space following them are automatically
1231 removed before edition, and reinstated after. For translator comments
1232 pertaining to obsolete entries, the uncommenting and recommenting operations
1233 are done twice. Once in the editing window, the keys <KBD>C-c C-c</KBD>
1234 allow the translator to tell she is finished with editing the comment.
1235 See section <A HREF="gettext_8.html#SEC69">8.3.11 Details of Sub Edition</A>, for further details.
1237 </P>
1239 <A NAME="IDX473"></A>
1240 Functions found on <CODE>po-subedit-mode-hook</CODE>, if any, are executed after
1241 the string has been inserted in the edit buffer.
1243 </P>
1245 <A NAME="IDX474"></A>
1246 <A NAME="IDX475"></A>
1247 <A NAME="IDX476"></A>
1248 <A NAME="IDX477"></A>
1249 <A NAME="IDX478"></A>
1250 <A NAME="IDX479"></A>
1251 The command <KBD>K</KBD> (<CODE>po-kill-comment</CODE>) gets rid of all
1252 translator comments, while saving those comments on the kill ring.
1253 The command <KBD>W</KBD> (<CODE>po-kill-ring-save-comment</CODE>) takes
1254 a copy of the translator comments on the kill ring, but leaves
1255 them undisturbed in the current entry. The command <KBD>Y</KBD>
1256 (<CODE>po-yank-comment</CODE>) completely replaces the translator comments
1257 by a string taken at the front of the kill ring. When this command
1258 is immediately repeated, the comments just inserted are withdrawn,
1259 and replaced by other strings taken along the kill ring.
1261 </P>
1263 On the kill ring, all strings have the same nature. There is no
1264 distinction between <EM>translation</EM> strings and <EM>translator
1265 comments</EM> strings. So, for example, let's presume the translator
1266 has just finished editing a translation, and wants to create a new
1267 translator comment to document why the previous translation was
1268 not good, just to remember what was the problem. Foreseeing that she
1269 will do that in her documentation, the translator may want to quote
1270 the previous translation in her translator comments. To do so, she
1271 may initialize the translator comments with the previous translation,
1272 still at the head of the kill ring. Because editing already pushed the
1273 previous translation on the kill ring, she merely has to type <KBD>M-w</KBD>
1274 prior to <KBD>#</KBD>, and the previous translation will be right there,
1275 all ready for being introduced by some explanatory text.
1277 </P>
1279 On the other hand, presume there are some translator comments already
1280 and that the translator wants to add to those comments, instead
1281 of wholly replacing them. Then, she should edit the comment right
1282 away with <KBD>#</KBD>. Once inside the editing window, she can use the
1283 regular Emacs commands <KBD>C-y</KBD> (<CODE>yank</CODE>) and <KBD>M-y</KBD>
1284 (<CODE>yank-pop</CODE>) to get the previous translation where she likes.
1286 </P>
1289 <H3><A NAME="SEC69" HREF="gettext_toc.html#TOC69">8.3.11 Details of Sub Edition</A></H3>
1291 <A NAME="IDX480"></A>
1293 </P>
1295 The PO subedit minor mode has a few peculiarities worth being described
1296 in fuller detail. It installs a few commands over the usual editing set
1297 of Emacs, which are described below.
1299 </P>
1300 <DL COMPACT>
1302 <DT><KBD>C-c C-c</KBD>
1303 <DD>
1304 <A NAME="IDX481"></A>
1305 Complete edition (<CODE>po-subedit-exit</CODE>).
1307 <DT><KBD>C-c C-k</KBD>
1308 <DD>
1309 <A NAME="IDX482"></A>
1310 Abort edition (<CODE>po-subedit-abort</CODE>).
1312 <DT><KBD>C-c C-a</KBD>
1313 <DD>
1314 <A NAME="IDX483"></A>
1315 Consult auxiliary PO files (<CODE>po-subedit-cycle-auxiliary</CODE>).
1317 </DL>
1320 <A NAME="IDX484"></A>
1321 <A NAME="IDX485"></A>
1322 <A NAME="IDX486"></A>
1323 The window's contents represents a translation for a given message,
1324 or a translator comment. The translator may modify this window to
1325 her heart's content. Once this is done, the command <KBD>C-c C-c</KBD>
1326 (<CODE>po-subedit-exit</CODE>) may be used to return the edited translation into
1327 the PO file, replacing the original translation, even if it moved out of
1328 sight or if buffers were switched.
1330 </P>
1332 <A NAME="IDX487"></A>
1333 <A NAME="IDX488"></A>
1334 If the translator becomes unsatisfied with her translation or comment,
1335 to the extent she prefers keeping what was existent prior to the
1336 <KBD><KBD>RET</KBD></KBD> or <KBD>#</KBD> command, she may use the command <KBD>C-c C-k</KBD>
1337 (<CODE>po-subedit-abort</CODE>) to merely get rid of edition, while preserving
1338 the original translation or comment. Another way would be for her to exit
1339 normally with <KBD>C-c C-c</KBD>, then type <CODE>U</CODE> once for undoing the
1340 whole effect of last edition.
1342 </P>
1344 <A NAME="IDX489"></A>
1345 <A NAME="IDX490"></A>
1346 The command <KBD>C-c C-a</KBD> (<CODE>po-subedit-cycle-auxiliary</CODE>)
1347 allows for glancing through translations
1348 already achieved in other languages, directly while editing the current
1349 translation. This may be quite convenient when the translator is fluent
1350 at many languages, but of course, only makes sense when such completed
1351 auxiliary PO files are already available to her (see section <A HREF="gettext_8.html#SEC71">8.3.13 Consulting Auxiliary PO Files</A>).
1353 </P>
1355 Functions found on <CODE>po-subedit-mode-hook</CODE>, if any, are executed after
1356 the string has been inserted in the edit buffer.
1358 </P>
1360 While editing her translation, the translator should pay attention to not
1361 inserting unwanted <KBD><KBD>RET</KBD></KBD> (newline) characters at the end of
1362 the translated string if those are not meant to be there, or to removing
1363 such characters when they are required. Since these characters are not
1364 visible in the editing buffer, they are easily introduced by mistake.
1365 To help her, <KBD><KBD>RET</KBD></KBD> automatically puts the character <CODE>&#60;</CODE>
1366 at the end of the string being edited, but this <CODE>&#60;</CODE> is not really
1367 part of the string. On exiting the editing window with <KBD>C-c C-c</KBD>,
1368 PO mode automatically removes such <KBD>&#60;</KBD> and all whitespace added after
1369 it. If the translator adds characters after the terminating <CODE>&#60;</CODE>, it
1370 looses its delimiting property and integrally becomes part of the string.
1371 If she removes the delimiting <CODE>&#60;</CODE>, then the edited string is taken
1372 <EM>as is</EM>, with all trailing newlines, even if invisible. Also, if
1373 the translated string ought to end itself with a genuine <CODE>&#60;</CODE>, then
1374 the delimiting <CODE>&#60;</CODE> may not be removed; so the string should appear,
1375 in the editing window, as ending with two <CODE>&#60;</CODE> in a row.
1377 </P>
1379 <A NAME="IDX491"></A>
1380 When a translation (or a comment) is being edited, the translator may move
1381 the cursor back into the PO file buffer and freely move to other entries,
1382 browsing at will. If, with an edition pending, the translator wanders in the
1383 PO file buffer, she may decide to start modifying another entry. Each entry
1384 being edited has its own subedit buffer. It is possible to simultaneously
1385 edit the translation <EM>and</EM> the comment of a single entry, or to
1386 edit entries in different PO files, all at once. Typing <KBD><KBD>RET</KBD></KBD>
1387 on a field already being edited merely resumes that particular edit. Yet,
1388 the translator should better be comfortable at handling many Emacs windows!
1390 </P>
1392 <A NAME="IDX492"></A>
1393 Pending subedits may be completed or aborted in any order, regardless
1394 of how or when they were started. When many subedits are pending and the
1395 translator asks for quitting the PO file (with the <KBD>q</KBD> command), subedits
1396 are automatically resumed one at a time, so she may decide for each of them.
1398 </P>
1401 <H3><A NAME="SEC70" HREF="gettext_toc.html#TOC70">8.3.12 C Sources Context</A></H3>
1403 <A NAME="IDX493"></A>
1404 <A NAME="IDX494"></A>
1405 <A NAME="IDX495"></A>
1407 </P>
1409 PO mode is particularly powerful when used with PO files
1410 created through GNU <CODE>gettext</CODE> utilities, as those utilities
1411 insert special comments in the PO files they generate.
1412 Some of these special comments relate the PO file entry to
1413 exactly where the untranslated string appears in the program sources.
1415 </P>
1417 When the translator gets to an untranslated entry, she is fairly
1418 often faced with an original string which is not as informative as
1419 it normally should be, being succinct, cryptic, or otherwise ambiguous.
1420 Before choosing how to translate the string, she needs to understand
1421 better what the string really means and how tight the translation has
1422 to be. Most of the time, when problems arise, the only way left to make
1423 her judgment is looking at the true program sources from where this
1424 string originated, searching for surrounding comments the programmer
1425 might have put in there, and looking around for helping clues of
1426 <EM>any</EM> kind.
1428 </P>
1430 Surely, when looking at program sources, the translator will receive
1431 more help if she is a fluent programmer. However, even if she is
1432 not versed in programming and feels a little lost in C code, the
1433 translator should not be shy at taking a look, once in a while.
1434 It is most probable that she will still be able to find some of the
1435 hints she needs. She will learn quickly to not feel uncomfortable
1436 in program code, paying more attention to programmer's comments,
1437 variable and function names (if he dared choosing them well), and
1438 overall organization, than to the program code itself.
1440 </P>
1442 <A NAME="IDX496"></A>
1443 The following commands are meant to help the translator at getting
1444 program source context for a PO file entry.
1446 </P>
1447 <DL COMPACT>
1449 <DT><KBD>s</KBD>
1450 <DD>
1451 <A NAME="IDX497"></A>
1452 Resume the display of a program source context, or cycle through them
1453 (<CODE>po-cycle-source-reference</CODE>).
1455 <DT><KBD>M-s</KBD>
1456 <DD>
1457 <A NAME="IDX498"></A>
1458 Display of a program source context selected by menu
1459 (<CODE>po-select-source-reference</CODE>).
1461 <DT><KBD>S</KBD>
1462 <DD>
1463 <A NAME="IDX499"></A>
1464 Add a directory to the search path for source files
1465 (<CODE>po-consider-source-path</CODE>).
1467 <DT><KBD>M-S</KBD>
1468 <DD>
1469 <A NAME="IDX500"></A>
1470 Delete a directory from the search path for source files
1471 (<CODE>po-ignore-source-path</CODE>).
1473 </DL>
1476 <A NAME="IDX501"></A>
1477 <A NAME="IDX502"></A>
1478 <A NAME="IDX503"></A>
1479 <A NAME="IDX504"></A>
1480 The commands <KBD>s</KBD> (<CODE>po-cycle-source-reference</CODE>) and <KBD>M-s</KBD>
1481 (<CODE>po-select-source-reference</CODE>) both open another window displaying
1482 some source program file, and already positioned in such a way that
1483 it shows an actual use of the string to be translated. By doing
1484 so, the command gives source program context for the string. But if
1485 the entry has no source context references, or if all references
1486 are unresolved along the search path for program sources, then the
1487 command diagnoses this as an error.
1489 </P>
1491 Even if <KBD>s</KBD> (or <KBD>M-s</KBD>) opens a new window, the cursor stays
1492 in the PO file window. If the translator really wants to
1493 get into the program source window, she ought to do it explicitly,
1494 maybe by using command <KBD>O</KBD>.
1496 </P>
1498 When <KBD>s</KBD> is typed for the first time, or for a PO file entry which
1499 is different of the last one used for getting source context, then the
1500 command reacts by giving the first context available for this entry,
1501 if any. If some context has already been recently displayed for the
1502 current PO file entry, and the translator wandered off to do other
1503 things, typing <KBD>s</KBD> again will merely resume, in another window,
1504 the context last displayed. In particular, if the translator moved
1505 the cursor away from the context in the source file, the command will
1506 bring the cursor back to the context. By using <KBD>s</KBD> many times
1507 in a row, with no other commands intervening, PO mode will cycle to
1508 the next available contexts for this particular entry, getting back
1509 to the first context once the last has been shown.
1511 </P>
1513 The command <KBD>M-s</KBD> behaves differently. Instead of cycling through
1514 references, it lets the translator choose a particular reference among
1515 many, and displays that reference. It is best used with completion,
1516 if the translator types <KBD><KBD>TAB</KBD></KBD> immediately after <KBD>M-s</KBD>, in
1517 response to the question, she will be offered a menu of all possible
1518 references, as a reminder of which are the acceptable answers.
1519 This command is useful only where there are really many contexts
1520 available for a single string to translate.
1522 </P>
1524 <A NAME="IDX505"></A>
1525 <A NAME="IDX506"></A>
1526 <A NAME="IDX507"></A>
1527 <A NAME="IDX508"></A>
1528 Program source files are usually found relative to where the PO
1529 file stands. As a special provision, when this fails, the file is
1530 also looked for, but relative to the directory immediately above it.
1531 Those two cases take proper care of most PO files. However, it might
1532 happen that a PO file has been moved, or is edited in a different
1533 place than its normal location. When this happens, the translator
1534 should tell PO mode in which directory normally sits the genuine PO
1535 file. Many such directories may be specified, and all together, they
1536 constitute what is called the <EM>search path</EM> for program sources.
1537 The command <KBD>S</KBD> (<CODE>po-consider-source-path</CODE>) is used to interactively
1538 enter a new directory at the front of the search path, and the command
1539 <KBD>M-S</KBD> (<CODE>po-ignore-source-path</CODE>) is used to select, with completion,
1540 one of the directories she does not want anymore on the search path.
1542 </P>
1545 <H3><A NAME="SEC71" HREF="gettext_toc.html#TOC71">8.3.13 Consulting Auxiliary PO Files</A></H3>
1547 <A NAME="IDX509"></A>
1549 </P>
1551 PO mode is able to help the knowledgeable translator, being fluent in
1552 many languages, at taking advantage of translations already achieved
1553 in other languages she just happens to know. It provides these other
1554 language translations as additional context for her own work. Moreover,
1555 it has features to ease the production of translations for many languages
1556 at once, for translators preferring to work in this way.
1558 </P>
1560 <A NAME="IDX510"></A>
1561 <A NAME="IDX511"></A>
1562 An <EM>auxiliary</EM> PO file is an existing PO file meant for the same
1563 package the translator is working on, but targeted to a different mother
1564 tongue language. Commands exist for declaring and handling auxiliary
1565 PO files, and also for showing contexts for the entry under work.
1567 </P>
1569 Here are the auxiliary file commands available in PO mode.
1571 </P>
1572 <DL COMPACT>
1574 <DT><KBD>a</KBD>
1575 <DD>
1576 <A NAME="IDX512"></A>
1577 Seek auxiliary files for another translation for the same entry
1578 (<CODE>po-cycle-auxiliary</CODE>).
1580 <DT><KBD>C-c C-a</KBD>
1581 <DD>
1582 <A NAME="IDX513"></A>
1583 Switch to a particular auxiliary file (<CODE>po-select-auxiliary</CODE>).
1585 <DT><KBD>A</KBD>
1586 <DD>
1587 <A NAME="IDX514"></A>
1588 Declare this PO file as an auxiliary file (<CODE>po-consider-as-auxiliary</CODE>).
1590 <DT><KBD>M-A</KBD>
1591 <DD>
1592 <A NAME="IDX515"></A>
1593 Remove this PO file from the list of auxiliary files
1594 (<CODE>po-ignore-as-auxiliary</CODE>).
1596 </DL>
1599 <A NAME="IDX516"></A>
1600 <A NAME="IDX517"></A>
1601 <A NAME="IDX518"></A>
1602 <A NAME="IDX519"></A>
1603 Command <KBD>A</KBD> (<CODE>po-consider-as-auxiliary</CODE>) adds the current
1604 PO file to the list of auxiliary files, while command <KBD>M-A</KBD>
1605 (<CODE>po-ignore-as-auxiliary</CODE> just removes it.
1607 </P>
1609 <A NAME="IDX520"></A>
1610 <A NAME="IDX521"></A>
1611 The command <KBD>a</KBD> (<CODE>po-cycle-auxiliary</CODE>) seeks all auxiliary PO
1612 files, round-robin, searching for a translated entry in some other language
1613 having an <CODE>msgid</CODE> field identical as the one for the current entry.
1614 The found PO file, if any, takes the place of the current PO file in
1615 the display (its window gets on top). Before doing so, the current PO
1616 file is also made into an auxiliary file, if not already. So, <KBD>a</KBD>
1617 in this newly displayed PO file will seek another PO file, and so on,
1618 so repeating <KBD>a</KBD> will eventually yield back the original PO file.
1620 </P>
1622 <A NAME="IDX522"></A>
1623 <A NAME="IDX523"></A>
1624 The command <KBD>C-c C-a</KBD> (<CODE>po-select-auxiliary</CODE>) asks the translator
1625 for her choice of a particular auxiliary file, with completion, and
1626 then switches to that selected PO file. The command also checks if
1627 the selected file has an <CODE>msgid</CODE> field identical as the one for
1628 the current entry, and if yes, this entry becomes current. Otherwise,
1629 the cursor of the selected file is left undisturbed.
1631 </P>
1633 For all this to work fully, auxiliary PO files will have to be normalized,
1634 in that way that <CODE>msgid</CODE> fields should be written <EM>exactly</EM>
1635 the same way. It is possible to write <CODE>msgid</CODE> fields in various
1636 ways for representing the same string, different writing would break the
1637 proper behaviour of the auxiliary file commands of PO mode. This is not
1638 expected to be much a problem in practice, as most existing PO files have
1639 their <CODE>msgid</CODE> entries written by the same GNU <CODE>gettext</CODE> tools.
1641 </P>
1643 <A NAME="IDX524"></A>
1644 However, PO files initially created by PO mode itself, while marking
1645 strings in source files, are normalised differently. So are PO
1646 files resulting of the <SAMP>&lsquo;M-x normalize&rsquo;</SAMP> command. Until these
1647 discrepancies between PO mode and other GNU <CODE>gettext</CODE> tools get
1648 fully resolved, the translator should stay aware of normalisation issues.
1650 </P>
1653 <H2><A NAME="SEC72" HREF="gettext_toc.html#TOC72">8.4 Using Translation Compendia</A></H2>
1655 <A NAME="IDX525"></A>
1657 </P>
1659 <A NAME="IDX526"></A>
1660 A <EM>compendium</EM> is a special PO file containing a set of
1661 translations recurring in many different packages. The translator can
1662 use gettext tools to build a new compendium, to add entries to her
1663 compendium, and to initialize untranslated entries, or to update
1664 already translated entries, from translations kept in the compendium.
1666 </P>
1670 <H3><A NAME="SEC73" HREF="gettext_toc.html#TOC73">8.4.1 Creating Compendia</A></H3>
1672 <A NAME="IDX527"></A>
1673 <A NAME="IDX528"></A>
1675 </P>
1677 Basically every PO file consisting of translated entries only can be
1678 declared as a valid compendium. Often the translator wants to have
1679 special compendia; let's consider two cases: <CITE>concatenating PO
1680 files</CITE> and <CITE>extracting a message subset from a PO file</CITE>.
1682 </P>
1685 <H4><A NAME="SEC74" HREF="gettext_toc.html#TOC74">8.4.1.1 Concatenate PO Files</A></H4>
1688 <A NAME="IDX529"></A>
1689 <A NAME="IDX530"></A>
1690 To concatenate several valid PO files into one compendium file you can
1691 use <SAMP>&lsquo;msgcomm&rsquo;</SAMP> or <SAMP>&lsquo;msgcat&rsquo;</SAMP> (the latter preferred):
1693 </P>
1695 <PRE>
1696 msgcat -o compendium.po file1.po file2.po
1697 </PRE>
1700 By default, <CODE>msgcat</CODE> will accumulate divergent translations
1701 for the same string. Those occurrences will be marked as <CODE>fuzzy</CODE>
1702 and highly visible decorated; calling <CODE>msgcat</CODE> on
1703 <TT>&lsquo;file1.po&rsquo;</TT>:
1705 </P>
1707 <PRE>
1708 #: src/hello.c:200
1709 #, c-format
1710 msgid "Report bugs to &#60;%s&#62;.\n"
1711 msgstr "Comunicar `bugs' a &#60;%s&#62;.\n"
1712 </PRE>
1715 and <TT>&lsquo;file2.po&rsquo;</TT>:
1717 </P>
1719 <PRE>
1720 #: src/bye.c:100
1721 #, c-format
1722 msgid "Report bugs to &#60;%s&#62;.\n"
1723 msgstr "Comunicar \"bugs\" a &#60;%s&#62;.\n"
1724 </PRE>
1727 will result in:
1729 </P>
1731 <PRE>
1732 #: src/hello.c:200 src/bye.c:100
1733 #, fuzzy, c-format
1734 msgid "Report bugs to &#60;%s&#62;.\n"
1735 msgstr ""
1736 "#-#-#-#-# file1.po #-#-#-#-#\n"
1737 "Comunicar `bugs' a &#60;%s&#62;.\n"
1738 "#-#-#-#-# file2.po #-#-#-#-#\n"
1739 "Comunicar \"bugs\" a &#60;%s&#62;.\n"
1740 </PRE>
1743 The translator will have to resolve this “conflict” manually; she
1744 has to decide whether the first or the second version is appropriate
1745 (or provide a new translation), to delete the “marker lines”, and
1746 finally to remove the <CODE>fuzzy</CODE> mark.
1748 </P>
1750 If the translator knows in advance the first found translation of a
1751 message is always the best translation she can make use to the
1752 <SAMP>&lsquo;--use-first&rsquo;</SAMP> switch:
1754 </P>
1756 <PRE>
1757 msgcat --use-first -o compendium.po file1.po file2.po
1758 </PRE>
1761 A good compendium file must not contain <CODE>fuzzy</CODE> or untranslated
1762 entries. If input files are “dirty” you must preprocess the input
1763 files or postprocess the result using <SAMP>&lsquo;msgattrib --translated --no-fuzzy&rsquo;</SAMP>.
1765 </P>
1768 <H4><A NAME="SEC75" HREF="gettext_toc.html#TOC75">8.4.1.2 Extract a Message Subset from a PO File</A></H4>
1770 <A NAME="IDX531"></A>
1772 </P>
1774 Nobody wants to translate the same messages again and again; thus you
1775 may wish to have a compendium file containing <TT>&lsquo;getopt.c&rsquo;</TT> messages.
1777 </P>
1779 To extract a message subset (e.g., all <TT>&lsquo;getopt.c&rsquo;</TT> messages) from an
1780 existing PO file into one compendium file you can use <SAMP>&lsquo;msggrep&rsquo;</SAMP>:
1782 </P>
1784 <PRE>
1785 msggrep --location src/getopt.c -o compendium.po file.po
1786 </PRE>
1790 <H3><A NAME="SEC76" HREF="gettext_toc.html#TOC76">8.4.2 Using Compendia</A></H3>
1793 You can use a compendium file to initialize a translation from scratch
1794 or to update an already existing translation.
1796 </P>
1799 <H4><A NAME="SEC77" HREF="gettext_toc.html#TOC77">8.4.2.1 Initialize a New Translation File</A></H4>
1801 <A NAME="IDX532"></A>
1803 </P>
1805 Since a PO file with translations does not exist the translator can
1806 merely use <TT>&lsquo;/dev/null&rsquo;</TT> to fake the “old” translation file.
1808 </P>
1810 <PRE>
1811 msgmerge --compendium compendium.po -o file.po /dev/null file.pot
1812 </PRE>
1816 <H4><A NAME="SEC78" HREF="gettext_toc.html#TOC78">8.4.2.2 Update an Existing Translation File</A></H4>
1818 <A NAME="IDX533"></A>
1820 </P>
1822 Concatenate the compendium file(s) and the existing PO, merge the
1823 result with the POT file and remove the obsolete entries (optional,
1824 here done using <SAMP>&lsquo;sed&rsquo;</SAMP>):
1826 </P>
1828 <PRE>
1829 msgcat --use-first -o update.po compendium1.po compendium2.po file.po
1830 msgmerge update.po file.pot | msgattrib --no-obsolete &#62; file.po
1831 </PRE>
1833 <P><HR><P>
1834 Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_7.html">previous</A>, <A HREF="gettext_9.html">next</A>, <A HREF="gettext_25.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>.
1835 </BODY>
1836 </HTML>