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