transmision: upgrade 2.22 -> 2.31
[tomato.git] / release / src / router / gettext / gettext-tools / doc / gettext_6.html
blobd56ec3d79a30dd71f01cc16cab8df331c25839ea
1 <HTML>
2 <HEAD>
3 <!-- This HTML file has been created by texi2html 1.52a
4 from gettext.texi on 23 May 2005 -->
6 <TITLE>GNU gettext utilities - 6 Updating Existing PO Files</TITLE>
7 </HEAD>
8 <BODY>
9 Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_5.html">previous</A>, <A HREF="gettext_7.html">next</A>, <A HREF="gettext_22.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>.
10 <P><HR><P>
13 <H1><A NAME="SEC40" HREF="gettext_toc.html#TOC40">6 Updating Existing PO Files</A></H1>
17 <H2><A NAME="SEC41" HREF="gettext_toc.html#TOC41">6.1 Invoking the <CODE>msgmerge</CODE> Program</A></H2>
19 <P>
20 <A NAME="IDX295"></A>
21 <A NAME="IDX296"></A>
23 <PRE>
24 msgmerge [<VAR>option</VAR>] <VAR>def</VAR>.po <VAR>ref</VAR>.pot
25 </PRE>
27 <P>
28 The <CODE>msgmerge</CODE> program merges two Uniforum style .po files together.
29 The <VAR>def</VAR>.po file is an existing PO file with translations which will
30 be taken over to the newly created file as long as they still match;
31 comments will be preserved, but extracted comments and file positions will
32 be discarded. The <VAR>ref</VAR>.pot file is the last created PO file with
33 up-to-date source references but old translations, or a PO Template file
34 (generally created by <CODE>xgettext</CODE>); any translations or comments
35 in the file will be discarded, however dot comments and file positions
36 will be preserved. Where an exact match cannot be found, fuzzy matching
37 is used to produce better results.
39 </P>
42 <H3><A NAME="SEC42" HREF="gettext_toc.html#TOC42">6.1.1 Input file location</A></H3>
44 <DL COMPACT>
46 <DT><SAMP>`<VAR>def</VAR>.po&acute;</SAMP>
47 <DD>
48 Translations referring to old sources.
50 <DT><SAMP>`<VAR>ref</VAR>.pot&acute;</SAMP>
51 <DD>
52 References to the new sources.
54 <DT><SAMP>`-D <VAR>directory</VAR>&acute;</SAMP>
55 <DD>
56 <DT><SAMP>`--directory=<VAR>directory</VAR>&acute;</SAMP>
57 <DD>
58 <A NAME="IDX297"></A>
59 <A NAME="IDX298"></A>
60 Add <VAR>directory</VAR> to the list of directories. Source files are
61 searched relative to this list of directories. The resulting <TT>`.po&acute;</TT>
62 file will be written relative to the current directory, though.
64 <DT><SAMP>`-C <VAR>file</VAR>&acute;</SAMP>
65 <DD>
66 <DT><SAMP>`--compendium=<VAR>file</VAR>&acute;</SAMP>
67 <DD>
68 <A NAME="IDX299"></A>
69 <A NAME="IDX300"></A>
70 Specify an additional library of message translations. See section <A HREF="gettext_6.html#SEC59">6.11 Using Translation Compendia</A>.
71 This option may be specified more than once.
73 </DL>
77 <H3><A NAME="SEC43" HREF="gettext_toc.html#TOC43">6.1.2 Operation mode</A></H3>
79 <DL COMPACT>
81 <DT><SAMP>`-U&acute;</SAMP>
82 <DD>
83 <DT><SAMP>`--update&acute;</SAMP>
84 <DD>
85 <A NAME="IDX301"></A>
86 <A NAME="IDX302"></A>
87 Update <VAR>def</VAR>.po. Do nothing if <VAR>def</VAR>.po is already up to date.
89 </DL>
93 <H3><A NAME="SEC44" HREF="gettext_toc.html#TOC44">6.1.3 Output file location</A></H3>
95 <DL COMPACT>
97 <DT><SAMP>`-o <VAR>file</VAR>&acute;</SAMP>
98 <DD>
99 <DT><SAMP>`--output-file=<VAR>file</VAR>&acute;</SAMP>
100 <DD>
101 <A NAME="IDX303"></A>
102 <A NAME="IDX304"></A>
103 Write output to specified file.
105 </DL>
108 <A NAME="IDX305"></A>
109 The results are written to standard output if no output file is specified
110 or if it is <SAMP>`-&acute;</SAMP>.
112 </P>
115 <H3><A NAME="SEC45" HREF="gettext_toc.html#TOC45">6.1.4 Output file location in update mode</A></H3>
118 The result is written back to <VAR>def</VAR>.po.
120 </P>
121 <DL COMPACT>
123 <DT><SAMP>`--backup=<VAR>control</VAR>&acute;</SAMP>
124 <DD>
125 <A NAME="IDX306"></A>
126 <A NAME="IDX307"></A>
127 Make a backup of <VAR>def</VAR>.po
129 <DT><SAMP>`--suffix=<VAR>suffix</VAR>&acute;</SAMP>
130 <DD>
131 <A NAME="IDX308"></A>
132 Override the usual backup suffix.
134 </DL>
137 <A NAME="IDX309"></A>
138 The version control method may be selected via the <CODE>--backup</CODE> option
139 or through the <CODE>VERSION_CONTROL</CODE> environment variable. Here are the
140 values:
142 </P>
143 <DL COMPACT>
145 <DT><SAMP>`none&acute;</SAMP>
146 <DD>
147 <DT><SAMP>`off&acute;</SAMP>
148 <DD>
149 Never make backups (even if <CODE>--backup</CODE> is given).
151 <DT><SAMP>`numbered&acute;</SAMP>
152 <DD>
153 <DT><SAMP>`t&acute;</SAMP>
154 <DD>
155 Make numbered backups.
157 <DT><SAMP>`existing&acute;</SAMP>
158 <DD>
159 <DT><SAMP>`nil&acute;</SAMP>
160 <DD>
161 Make numbered backups if numbered backups for this file already exist,
162 otherwise make simple backups.
164 <DT><SAMP>`simple&acute;</SAMP>
165 <DD>
166 <DT><SAMP>`never&acute;</SAMP>
167 <DD>
168 Always make simple backups.
170 </DL>
173 The backup suffix is <SAMP>`~&acute;</SAMP>, unless set with <CODE>--suffix</CODE> or the
174 <CODE>SIMPLE_BACKUP_SUFFIX</CODE> environment variable.
176 </P>
179 <H3><A NAME="SEC46" HREF="gettext_toc.html#TOC46">6.1.5 Operation modifiers</A></H3>
181 <DL COMPACT>
183 <DT><SAMP>`-m&acute;</SAMP>
184 <DD>
185 <DT><SAMP>`--multi-domain&acute;</SAMP>
186 <DD>
187 <A NAME="IDX310"></A>
188 <A NAME="IDX311"></A>
189 Apply <VAR>ref</VAR>.pot to each of the domains in <VAR>def</VAR>.po.
191 <DT><SAMP>`-N&acute;</SAMP>
192 <DD>
193 <DT><SAMP>`--no-fuzzy-matching&acute;</SAMP>
194 <DD>
195 <A NAME="IDX312"></A>
196 <A NAME="IDX313"></A>
197 Do not use fuzzy matching when an exact match is not found. This may speed
198 up the operation considerably.
199 </DL>
203 <H3><A NAME="SEC47" HREF="gettext_toc.html#TOC47">6.1.6 Input file syntax</A></H3>
205 <DL COMPACT>
207 <DT><SAMP>`-P&acute;</SAMP>
208 <DD>
209 <DT><SAMP>`--properties-input&acute;</SAMP>
210 <DD>
211 <A NAME="IDX314"></A>
212 <A NAME="IDX315"></A>
213 Assume the input files are Java ResourceBundles in Java <CODE>.properties</CODE>
214 syntax, not in PO file syntax.
216 <DT><SAMP>`--stringtable-input&acute;</SAMP>
217 <DD>
218 <A NAME="IDX316"></A>
219 Assume the input files are NeXTstep/GNUstep localized resource files in
220 <CODE>.strings</CODE> syntax, not in PO file syntax.
222 </DL>
226 <H3><A NAME="SEC48" HREF="gettext_toc.html#TOC48">6.1.7 Output details</A></H3>
228 <DL COMPACT>
230 <DT><SAMP>`--force-po&acute;</SAMP>
231 <DD>
232 <A NAME="IDX317"></A>
233 Always write an output file even if it contains no message.
235 <DT><SAMP>`-i&acute;</SAMP>
236 <DD>
237 <DT><SAMP>`--indent&acute;</SAMP>
238 <DD>
239 <A NAME="IDX318"></A>
240 <A NAME="IDX319"></A>
241 Write the .po file using indented style.
243 <DT><SAMP>`--no-location&acute;</SAMP>
244 <DD>
245 <A NAME="IDX320"></A>
246 Do not write <SAMP>`#: <VAR>filename</VAR>:<VAR>line</VAR>&acute;</SAMP> lines.
248 <DT><SAMP>`--add-location&acute;</SAMP>
249 <DD>
250 <A NAME="IDX321"></A>
251 Generate <SAMP>`#: <VAR>filename</VAR>:<VAR>line</VAR>&acute;</SAMP> lines (default).
253 <DT><SAMP>`--strict&acute;</SAMP>
254 <DD>
255 <A NAME="IDX322"></A>
256 Write out a strict Uniforum conforming PO file. Note that this
257 Uniforum format should be avoided because it doesn't support the
258 GNU extensions.
260 <DT><SAMP>`-p&acute;</SAMP>
261 <DD>
262 <DT><SAMP>`--properties-output&acute;</SAMP>
263 <DD>
264 <A NAME="IDX323"></A>
265 <A NAME="IDX324"></A>
266 Write out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax. Note
267 that this file format doesn't support plural forms and silently drops
268 obsolete messages.
270 <DT><SAMP>`--stringtable-output&acute;</SAMP>
271 <DD>
272 <A NAME="IDX325"></A>
273 Write out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
274 Note that this file format doesn't support plural forms.
276 <DT><SAMP>`-w <VAR>number</VAR>&acute;</SAMP>
277 <DD>
278 <DT><SAMP>`--width=<VAR>number</VAR>&acute;</SAMP>
279 <DD>
280 <A NAME="IDX326"></A>
281 <A NAME="IDX327"></A>
282 Set the output page width. Long strings in the output files will be
283 split across multiple lines in order to ensure that each line's width
284 (= number of screen columns) is less or equal to the given <VAR>number</VAR>.
286 <DT><SAMP>`--no-wrap&acute;</SAMP>
287 <DD>
288 <A NAME="IDX328"></A>
289 Do not break long message lines. Message lines whose width exceeds the
290 output page width will not be split into several lines. Only file reference
291 lines which are wider than the output page width will be split.
293 <DT><SAMP>`-s&acute;</SAMP>
294 <DD>
295 <DT><SAMP>`--sort-output&acute;</SAMP>
296 <DD>
297 <A NAME="IDX329"></A>
298 <A NAME="IDX330"></A>
299 <A NAME="IDX331"></A>
300 Generate sorted output. Note that using this option makes it much harder
301 for the translator to understand each message's context.
303 <DT><SAMP>`-F&acute;</SAMP>
304 <DD>
305 <DT><SAMP>`--sort-by-file&acute;</SAMP>
306 <DD>
307 <A NAME="IDX332"></A>
308 <A NAME="IDX333"></A>
309 Sort output by file location.
311 </DL>
315 <H3><A NAME="SEC49" HREF="gettext_toc.html#TOC49">6.1.8 Informative output</A></H3>
317 <DL COMPACT>
319 <DT><SAMP>`-h&acute;</SAMP>
320 <DD>
321 <DT><SAMP>`--help&acute;</SAMP>
322 <DD>
323 <A NAME="IDX334"></A>
324 <A NAME="IDX335"></A>
325 Display this help and exit.
327 <DT><SAMP>`-V&acute;</SAMP>
328 <DD>
329 <DT><SAMP>`--version&acute;</SAMP>
330 <DD>
331 <A NAME="IDX336"></A>
332 <A NAME="IDX337"></A>
333 Output version information and exit.
335 <DT><SAMP>`-v&acute;</SAMP>
336 <DD>
337 <DT><SAMP>`--verbose&acute;</SAMP>
338 <DD>
339 <A NAME="IDX338"></A>
340 <A NAME="IDX339"></A>
341 Increase verbosity level.
343 <DT><SAMP>`-q&acute;</SAMP>
344 <DD>
345 <DT><SAMP>`--quiet&acute;</SAMP>
346 <DD>
347 <DT><SAMP>`--silent&acute;</SAMP>
348 <DD>
349 <A NAME="IDX340"></A>
350 <A NAME="IDX341"></A>
351 <A NAME="IDX342"></A>
352 Suppress progress indicators.
354 </DL>
358 <H2><A NAME="SEC50" HREF="gettext_toc.html#TOC50">6.2 Translated Entries</A></H2>
360 <A NAME="IDX343"></A>
362 </P>
364 Each PO file entry for which the <CODE>msgstr</CODE> field has been filled with
365 a translation, and which is not marked as fuzzy (see section <A HREF="gettext_6.html#SEC51">6.3 Fuzzy Entries</A>),
366 is said to be a <EM>translated</EM> entry. Only translated entries will
367 later be compiled by GNU <CODE>msgfmt</CODE> and become usable in programs.
368 Other entry types will be excluded; translation will not occur for them.
370 </P>
372 <A NAME="IDX344"></A>
373 Some commands are more specifically related to translated entry processing.
375 </P>
376 <DL COMPACT>
378 <DT><KBD>t</KBD>
379 <DD>
380 <A NAME="IDX345"></A>
381 Find the next translated entry (<CODE>po-next-translated-entry</CODE>).
383 <DT><KBD>T</KBD>
384 <DD>
385 <A NAME="IDX346"></A>
386 Find the previous translated entry (<CODE>po-previous-translated-entry</CODE>).
388 </DL>
391 <A NAME="IDX347"></A>
392 <A NAME="IDX348"></A>
393 <A NAME="IDX349"></A>
394 <A NAME="IDX350"></A>
395 The commands <KBD>t</KBD> (<CODE>po-next-translated-entry</CODE>) and <KBD>T</KBD>
396 (<CODE>po-previous-translated-entry</CODE>) move forwards or backwards, chasing
397 for an translated entry. If none is found, the search is extended and
398 wraps around in the PO file buffer.
400 </P>
402 <A NAME="IDX351"></A>
403 Translated entries usually result from the translator having edited in
404 a translation for them, section <A HREF="gettext_6.html#SEC54">6.6 Modifying Translations</A>. However, if the
405 variable <CODE>po-auto-fuzzy-on-edit</CODE> is not <CODE>nil</CODE>, the entry having
406 received a new translation first becomes a fuzzy entry, which ought to
407 be later unfuzzied before becoming an official, genuine translated entry.
408 See section <A HREF="gettext_6.html#SEC51">6.3 Fuzzy Entries</A>.
410 </P>
413 <H2><A NAME="SEC51" HREF="gettext_toc.html#TOC51">6.3 Fuzzy Entries</A></H2>
415 <A NAME="IDX352"></A>
417 </P>
419 <A NAME="IDX353"></A>
420 <A NAME="IDX354"></A>
421 Each PO file entry may have a set of <EM>attributes</EM>, which are
422 qualities given a name and explicitly associated with the translation,
423 using a special system comment. One of these attributes
424 has the name <CODE>fuzzy</CODE>, and entries having this attribute are said
425 to have a fuzzy translation. They are called fuzzy entries, for short.
427 </P>
429 Fuzzy entries, even if they account for translated entries for
430 most other purposes, usually call for revision by the translator.
431 Those may be produced by applying the program <CODE>msgmerge</CODE> to
432 update an older translated PO files according to a new PO template
433 file, when this tool hypothesises that some new <CODE>msgid</CODE> has
434 been modified only slightly out of an older one, and chooses to pair
435 what it thinks to be the old translation for the new modified entry.
436 The slight alteration in the original string (the <CODE>msgid</CODE> string)
437 should often be reflected in the translated string, and this requires
438 the intervention of the translator. For this reason, <CODE>msgmerge</CODE>
439 might mark some entries as being fuzzy.
441 </P>
443 <A NAME="IDX355"></A>
444 Also, the translator may decide herself to mark an entry as fuzzy
445 for her own convenience, when she wants to remember that the entry
446 has to be later revisited. So, some commands are more specifically
447 related to fuzzy entry processing.
449 </P>
450 <DL COMPACT>
452 <DT><KBD>z</KBD>
453 <DD>
454 <A NAME="IDX356"></A>
455 Find the next fuzzy entry (<CODE>po-next-fuzzy-entry</CODE>).
457 <DT><KBD>Z</KBD>
458 <DD>
459 <A NAME="IDX357"></A>
460 Find the previous fuzzy entry (<CODE>po-previous-fuzzy-entry</CODE>).
462 <DT><KBD><KBD>TAB</KBD></KBD>
463 <DD>
464 <A NAME="IDX358"></A>
465 Remove the fuzzy attribute of the current entry (<CODE>po-unfuzzy</CODE>).
467 </DL>
470 <A NAME="IDX359"></A>
471 <A NAME="IDX360"></A>
472 <A NAME="IDX361"></A>
473 <A NAME="IDX362"></A>
474 The commands <KBD>z</KBD> (<CODE>po-next-fuzzy-entry</CODE>) and <KBD>Z</KBD>
475 (<CODE>po-previous-fuzzy-entry</CODE>) move forwards or backwards, chasing for
476 a fuzzy entry. If none is found, the search is extended and wraps
477 around in the PO file buffer.
479 </P>
481 <A NAME="IDX363"></A>
482 <A NAME="IDX364"></A>
483 <A NAME="IDX365"></A>
484 The command <KBD><KBD>TAB</KBD></KBD> (<CODE>po-unfuzzy</CODE>) removes the fuzzy
485 attribute associated with an entry, usually leaving it translated.
486 Further, if the variable <CODE>po-auto-select-on-unfuzzy</CODE> has not
487 the <CODE>nil</CODE> value, the <KBD><KBD>TAB</KBD></KBD> command will automatically chase
488 for another interesting entry to work on. The initial value of
489 <CODE>po-auto-select-on-unfuzzy</CODE> is <CODE>nil</CODE>.
491 </P>
493 The initial value of <CODE>po-auto-fuzzy-on-edit</CODE> is <CODE>nil</CODE>. However,
494 if the variable <CODE>po-auto-fuzzy-on-edit</CODE> is set to <CODE>t</CODE>, any entry
495 edited through the <KBD><KBD>RET</KBD></KBD> command is marked fuzzy, as a way to
496 ensure some kind of double check, later. In this case, the usual paradigm
497 is that an entry becomes fuzzy (if not already) whenever the translator
498 modifies it. If she is satisfied with the translation, she then uses
499 <KBD><KBD>TAB</KBD></KBD> to pick another entry to work on, clearing the fuzzy attribute
500 on the same blow. If she is not satisfied yet, she merely uses <KBD><KBD>SPC</KBD></KBD>
501 to chase another entry, leaving the entry fuzzy.
503 </P>
505 <A NAME="IDX366"></A>
506 <A NAME="IDX367"></A>
507 The translator may also use the <KBD><KBD>DEL</KBD></KBD> command
508 (<CODE>po-fade-out-entry</CODE>) over any translated entry to mark it as being
509 fuzzy, when she wants to easily leave a trace she wants to later return
510 working at this entry.
512 </P>
514 Also, when time comes to quit working on a PO file buffer with the <KBD>q</KBD>
515 command, the translator is asked for confirmation, if fuzzy string
516 still exists.
518 </P>
521 <H2><A NAME="SEC52" HREF="gettext_toc.html#TOC52">6.4 Untranslated Entries</A></H2>
523 <A NAME="IDX368"></A>
525 </P>
527 When <CODE>xgettext</CODE> originally creates a PO file, unless told
528 otherwise, it initializes the <CODE>msgid</CODE> field with the untranslated
529 string, and leaves the <CODE>msgstr</CODE> string to be empty. Such entries,
530 having an empty translation, are said to be <EM>untranslated</EM> entries.
531 Later, when the programmer slightly modifies some string right in
532 the program, this change is later reflected in the PO file
533 by the appearance of a new untranslated entry for the modified string.
535 </P>
537 The usual commands moving from entry to entry consider untranslated
538 entries on the same level as active entries. Untranslated entries
539 are easily recognizable by the fact they end with <SAMP>`msgstr ""&acute;</SAMP>.
541 </P>
543 <A NAME="IDX369"></A>
544 The work of the translator might be (quite naively) seen as the process
545 of seeking for an untranslated entry, editing a translation for
546 it, and repeating these actions until no untranslated entries remain.
547 Some commands are more specifically related to untranslated entry
548 processing.
550 </P>
551 <DL COMPACT>
553 <DT><KBD>u</KBD>
554 <DD>
555 <A NAME="IDX370"></A>
556 Find the next untranslated entry (<CODE>po-next-untranslated-entry</CODE>).
558 <DT><KBD>U</KBD>
559 <DD>
560 <A NAME="IDX371"></A>
561 Find the previous untranslated entry (<CODE>po-previous-untransted-entry</CODE>).
563 <DT><KBD>k</KBD>
564 <DD>
565 <A NAME="IDX372"></A>
566 Turn the current entry into an untranslated one (<CODE>po-kill-msgstr</CODE>).
568 </DL>
571 <A NAME="IDX373"></A>
572 <A NAME="IDX374"></A>
573 <A NAME="IDX375"></A>
574 <A NAME="IDX376"></A>
575 The commands <KBD>u</KBD> (<CODE>po-next-untranslated-entry</CODE>) and <KBD>U</KBD>
576 (<CODE>po-previous-untransted-entry</CODE>) move forwards or backwards,
577 chasing for an untranslated entry. If none is found, the search is
578 extended and wraps around in the PO file buffer.
580 </P>
582 <A NAME="IDX377"></A>
583 <A NAME="IDX378"></A>
584 An entry can be turned back into an untranslated entry by
585 merely emptying its translation, using the command <KBD>k</KBD>
586 (<CODE>po-kill-msgstr</CODE>). See section <A HREF="gettext_6.html#SEC54">6.6 Modifying Translations</A>.
588 </P>
590 Also, when time comes to quit working on a PO file buffer
591 with the <KBD>q</KBD> command, the translator is asked for confirmation,
592 if some untranslated string still exists.
594 </P>
597 <H2><A NAME="SEC53" HREF="gettext_toc.html#TOC53">6.5 Obsolete Entries</A></H2>
599 <A NAME="IDX379"></A>
601 </P>
603 By <EM>obsolete</EM> PO file entries, we mean those entries which are
604 commented out, usually by <CODE>msgmerge</CODE> when it found that the
605 translation is not needed anymore by the package being localized.
607 </P>
609 The usual commands moving from entry to entry consider obsolete
610 entries on the same level as active entries. Obsolete entries are
611 easily recognizable by the fact that all their lines start with
612 <CODE>#</CODE>, even those lines containing <CODE>msgid</CODE> or <CODE>msgstr</CODE>.
614 </P>
616 Commands exist for emptying the translation or reinitializing it
617 to the original untranslated string. Commands interfacing with the
618 kill ring may force some previously saved text into the translation.
619 The user may interactively edit the translation. All these commands
620 may apply to obsolete entries, carefully leaving the entry obsolete
621 after the fact.
623 </P>
625 <A NAME="IDX380"></A>
626 Moreover, some commands are more specifically related to obsolete
627 entry processing.
629 </P>
630 <DL COMPACT>
632 <DT><KBD>o</KBD>
633 <DD>
634 <A NAME="IDX381"></A>
635 Find the next obsolete entry (<CODE>po-next-obsolete-entry</CODE>).
637 <DT><KBD>O</KBD>
638 <DD>
639 <A NAME="IDX382"></A>
640 Find the previous obsolete entry (<CODE>po-previous-obsolete-entry</CODE>).
642 <DT><KBD><KBD>DEL</KBD></KBD>
643 <DD>
644 <A NAME="IDX383"></A>
645 Make an active entry obsolete, or zap out an obsolete entry
646 (<CODE>po-fade-out-entry</CODE>).
648 </DL>
651 <A NAME="IDX384"></A>
652 <A NAME="IDX385"></A>
653 <A NAME="IDX386"></A>
654 <A NAME="IDX387"></A>
655 The commands <KBD>o</KBD> (<CODE>po-next-obsolete-entry</CODE>) and <KBD>O</KBD>
656 (<CODE>po-previous-obsolete-entry</CODE>) move forwards or backwards,
657 chasing for an obsolete entry. If none is found, the search is
658 extended and wraps around in the PO file buffer.
660 </P>
662 PO mode does not provide ways for un-commenting an obsolete entry
663 and making it active, because this would reintroduce an original
664 untranslated string which does not correspond to any marked string
665 in the program sources. This goes with the philosophy of never
666 introducing useless <CODE>msgid</CODE> values.
668 </P>
670 <A NAME="IDX388"></A>
671 <A NAME="IDX389"></A>
672 <A NAME="IDX390"></A>
673 <A NAME="IDX391"></A>
674 However, it is possible to comment out an active entry, so making
675 it obsolete. GNU <CODE>gettext</CODE> utilities will later react to the
676 disappearance of a translation by using the untranslated string.
677 The command <KBD><KBD>DEL</KBD></KBD> (<CODE>po-fade-out-entry</CODE>) pushes the current entry
678 a little further towards annihilation. If the entry is active (it is a
679 translated entry), then it is first made fuzzy. If it is already fuzzy,
680 then the entry is merely commented out, with confirmation. If the entry
681 is already obsolete, then it is completely deleted from the PO file.
682 It is easy to recycle the translation so deleted into some other PO file
683 entry, usually one which is untranslated. See section <A HREF="gettext_6.html#SEC54">6.6 Modifying Translations</A>.
685 </P>
687 Here is a quite interesting problem to solve for later development of
688 PO mode, for those nights you are not sleepy. The idea would be that
689 PO mode might become bright enough, one of these days, to make good
690 guesses at retrieving the most probable candidate, among all obsolete
691 entries, for initializing the translation of a newly appeared string.
692 I think it might be a quite hard problem to do this algorithmically, as
693 we have to develop good and efficient measures of string similarity.
694 Right now, PO mode completely lets the decision to the translator,
695 when the time comes to find the adequate obsolete translation, it
696 merely tries to provide handy tools for helping her to do so.
698 </P>
701 <H2><A NAME="SEC54" HREF="gettext_toc.html#TOC54">6.6 Modifying Translations</A></H2>
703 <A NAME="IDX392"></A>
704 <A NAME="IDX393"></A>
706 </P>
708 PO mode prevents direct modification of the PO file, by the usual
709 means Emacs gives for altering a buffer's contents. By doing so,
710 it pretends helping the translator to avoid little clerical errors
711 about the overall file format, or the proper quoting of strings,
712 as those errors would be easily made. Other kinds of errors are
713 still possible, but some may be caught and diagnosed by the batch
714 validation process, which the translator may always trigger by the
715 <KBD>V</KBD> command. For all other errors, the translator has to rely on
716 her own judgment, and also on the linguistic reports submitted to her
717 by the users of the translated package, having the same mother tongue.
719 </P>
721 When the time comes to create a translation, correct an error diagnosed
722 mechanically or reported by a user, the translators have to resort to
723 using the following commands for modifying the translations.
725 </P>
726 <DL COMPACT>
728 <DT><KBD><KBD>RET</KBD></KBD>
729 <DD>
730 <A NAME="IDX394"></A>
731 Interactively edit the translation (<CODE>po-edit-msgstr</CODE>).
733 <DT><KBD><KBD>LFD</KBD></KBD>
734 <DD>
735 <DT><KBD>C-j</KBD>
736 <DD>
737 <A NAME="IDX395"></A>
738 <A NAME="IDX396"></A>
739 Reinitialize the translation with the original, untranslated string
740 (<CODE>po-msgid-to-msgstr</CODE>).
742 <DT><KBD>k</KBD>
743 <DD>
744 <A NAME="IDX397"></A>
745 Save the translation on the kill ring, and delete it (<CODE>po-kill-msgstr</CODE>).
747 <DT><KBD>w</KBD>
748 <DD>
749 <A NAME="IDX398"></A>
750 Save the translation on the kill ring, without deleting it
751 (<CODE>po-kill-ring-save-msgstr</CODE>).
753 <DT><KBD>y</KBD>
754 <DD>
755 <A NAME="IDX399"></A>
756 Replace the translation, taking the new from the kill ring
757 (<CODE>po-yank-msgstr</CODE>).
759 </DL>
762 <A NAME="IDX400"></A>
763 <A NAME="IDX401"></A>
764 The command <KBD><KBD>RET</KBD></KBD> (<CODE>po-edit-msgstr</CODE>) opens a new Emacs
765 window meant to edit in a new translation, or to modify an already existing
766 translation. The new window contains a copy of the translation taken from
767 the current PO file entry, all ready for edition, expunged of all quoting
768 marks, fully modifiable and with the complete extent of Emacs modifying
769 commands. When the translator is done with her modifications, she may use
770 <KBD>C-c C-c</KBD> to close the subedit window with the automatically requoted
771 results, or <KBD>C-c C-k</KBD> to abort her modifications. See section <A HREF="gettext_6.html#SEC56">6.8 Details of Sub Edition</A>,
772 for more information.
774 </P>
776 <A NAME="IDX402"></A>
777 <A NAME="IDX403"></A>
778 <A NAME="IDX404"></A>
779 The command <KBD><KBD>LFD</KBD></KBD> (<CODE>po-msgid-to-msgstr</CODE>) initializes, or
780 reinitializes the translation with the original string. This command is
781 normally used when the translator wants to redo a fresh translation of
782 the original string, disregarding any previous work.
784 </P>
786 <A NAME="IDX405"></A>
787 It is possible to arrange so, whenever editing an untranslated
788 entry, the <KBD><KBD>LFD</KBD></KBD> command be automatically executed. If you set
789 <CODE>po-auto-edit-with-msgid</CODE> to <CODE>t</CODE>, the translation gets
790 initialised with the original string, in case none exists already.
791 The default value for <CODE>po-auto-edit-with-msgid</CODE> is <CODE>nil</CODE>.
793 </P>
795 <A NAME="IDX406"></A>
796 In fact, whether it is best to start a translation with an empty
797 string, or rather with a copy of the original string, is a matter of
798 taste or habit. Sometimes, the source language and the
799 target language are so different that is simply best to start writing
800 on an empty page. At other times, the source and target languages
801 are so close that it would be a waste to retype a number of words
802 already being written in the original string. A translator may also
803 like having the original string right under her eyes, as she will
804 progressively overwrite the original text with the translation, even
805 if this requires some extra editing work to get rid of the original.
807 </P>
809 <A NAME="IDX407"></A>
810 <A NAME="IDX408"></A>
811 <A NAME="IDX409"></A>
812 <A NAME="IDX410"></A>
813 <A NAME="IDX411"></A>
814 The command <KBD>k</KBD> (<CODE>po-kill-msgstr</CODE>) merely empties the
815 translation string, so turning the entry into an untranslated
816 one. But while doing so, its previous contents is put apart in
817 a special place, known as the kill ring. The command <KBD>w</KBD>
818 (<CODE>po-kill-ring-save-msgstr</CODE>) has also the effect of taking a
819 copy of the translation onto the kill ring, but it otherwise leaves
820 the entry alone, and does <EM>not</EM> remove the translation from the
821 entry. Both commands use exactly the Emacs kill ring, which is shared
822 between buffers, and which is well known already to Emacs lovers.
824 </P>
826 The translator may use <KBD>k</KBD> or <KBD>w</KBD> many times in the course
827 of her work, as the kill ring may hold several saved translations.
828 From the kill ring, strings may later be reinserted in various
829 Emacs buffers. In particular, the kill ring may be used for moving
830 translation strings between different entries of a single PO file
831 buffer, or if the translator is handling many such buffers at once,
832 even between PO files.
834 </P>
836 To facilitate exchanges with buffers which are not in PO mode, the
837 translation string put on the kill ring by the <KBD>k</KBD> command is fully
838 unquoted before being saved: external quotes are removed, multi-line
839 strings are concatenated, and backslash escaped sequences are turned
840 into their corresponding characters. In the special case of obsolete
841 entries, the translation is also uncommented prior to saving.
843 </P>
845 <A NAME="IDX412"></A>
846 <A NAME="IDX413"></A>
847 The command <KBD>y</KBD> (<CODE>po-yank-msgstr</CODE>) completely replaces the
848 translation of the current entry by a string taken from the kill ring.
849 Following Emacs terminology, we then say that the replacement
850 string is <EM>yanked</EM> into the PO file buffer.
851 See section `Yanking' in <CITE>The Emacs Editor</CITE>.
852 The first time <KBD>y</KBD> is used, the translation receives the value of
853 the most recent addition to the kill ring. If <KBD>y</KBD> is typed once
854 again, immediately, without intervening keystrokes, the translation
855 just inserted is taken away and replaced by the second most recent
856 addition to the kill ring. By repeating <KBD>y</KBD> many times in a row,
857 the translator may travel along the kill ring for saved strings,
858 until she finds the string she really wanted.
860 </P>
862 When a string is yanked into a PO file entry, it is fully and
863 automatically requoted for complying with the format PO files should
864 have. Further, if the entry is obsolete, PO mode then appropriately
865 push the inserted string inside comments. Once again, translators
866 should not burden themselves with quoting considerations besides, of
867 course, the necessity of the translated string itself respective to
868 the program using it.
870 </P>
872 Note that <KBD>k</KBD> or <KBD>w</KBD> are not the only commands pushing strings
873 on the kill ring, as almost any PO mode command replacing translation
874 strings (or the translator comments) automatically saves the old string
875 on the kill ring. The main exceptions to this general rule are the
876 yanking commands themselves.
878 </P>
880 <A NAME="IDX414"></A>
881 To better illustrate the operation of killing and yanking, let's
882 use an actual example, taken from a common situation. When the
883 programmer slightly modifies some string right in the program, his
884 change is later reflected in the PO file by the appearance
885 of a new untranslated entry for the modified string, and the fact
886 that the entry translating the original or unmodified string becomes
887 obsolete. In many cases, the translator might spare herself some work
888 by retrieving the unmodified translation from the obsolete entry,
889 then initializing the untranslated entry <CODE>msgstr</CODE> field with
890 this retrieved translation. Once this done, the obsolete entry is
891 not wanted anymore, and may be safely deleted.
893 </P>
895 When the translator finds an untranslated entry and suspects that a
896 slight variant of the translation exists, she immediately uses <KBD>m</KBD>
897 to mark the current entry location, then starts chasing obsolete
898 entries with <KBD>o</KBD>, hoping to find some translation corresponding
899 to the unmodified string. Once found, she uses the <KBD><KBD>DEL</KBD></KBD> command
900 for deleting the obsolete entry, knowing that <KBD><KBD>DEL</KBD></KBD> also <EM>kills</EM>
901 the translation, that is, pushes the translation on the kill ring.
902 Then, <KBD>r</KBD> returns to the initial untranslated entry, and <KBD>y</KBD>
903 then <EM>yanks</EM> the saved translation right into the <CODE>msgstr</CODE>
904 field. The translator is then free to use <KBD><KBD>RET</KBD></KBD> for fine
905 tuning the translation contents, and maybe to later use <KBD>u</KBD>,
906 then <KBD>m</KBD> again, for going on with the next untranslated string.
908 </P>
910 When some sequence of keys has to be typed over and over again, the
911 translator may find it useful to become better acquainted with the Emacs
912 capability of learning these sequences and playing them back under request.
913 See section `Keyboard Macros' in <CITE>The Emacs Editor</CITE>.
915 </P>
918 <H2><A NAME="SEC55" HREF="gettext_toc.html#TOC55">6.7 Modifying Comments</A></H2>
920 <A NAME="IDX415"></A>
921 <A NAME="IDX416"></A>
923 </P>
925 Any translation work done seriously will raise many linguistic
926 difficulties, for which decisions have to be made, and the choices
927 further documented. These documents may be saved within the
928 PO file in form of translator comments, which the translator
929 is free to create, delete, or modify at will. These comments may
930 be useful to herself when she returns to this PO file after a while.
932 </P>
934 Comments not having whitespace after the initial <SAMP>`#&acute;</SAMP>, for example,
935 those beginning with <SAMP>`#.&acute;</SAMP> or <SAMP>`#:&acute;</SAMP>, are <EM>not</EM> translator
936 comments, they are exclusively created by other <CODE>gettext</CODE> tools.
937 So, the commands below will never alter such system added comments,
938 they are not meant for the translator to modify. See section <A HREF="gettext_2.html#SEC9">2.2 The Format of PO Files</A>.
940 </P>
942 The following commands are somewhat similar to those modifying translations,
943 so the general indications given for those apply here. See section <A HREF="gettext_6.html#SEC54">6.6 Modifying Translations</A>.
945 </P>
946 <DL COMPACT>
948 <DT><KBD>#</KBD>
949 <DD>
950 <A NAME="IDX417"></A>
951 Interactively edit the translator comments (<CODE>po-edit-comment</CODE>).
953 <DT><KBD>K</KBD>
954 <DD>
955 <A NAME="IDX418"></A>
956 Save the translator comments on the kill ring, and delete it
957 (<CODE>po-kill-comment</CODE>).
959 <DT><KBD>W</KBD>
960 <DD>
961 <A NAME="IDX419"></A>
962 Save the translator comments on the kill ring, without deleting it
963 (<CODE>po-kill-ring-save-comment</CODE>).
965 <DT><KBD>Y</KBD>
966 <DD>
967 <A NAME="IDX420"></A>
968 Replace the translator comments, taking the new from the kill ring
969 (<CODE>po-yank-comment</CODE>).
971 </DL>
974 These commands parallel PO mode commands for modifying the translation
975 strings, and behave much the same way as they do, except that they handle
976 this part of PO file comments meant for translator usage, rather
977 than the translation strings. So, if the descriptions given below are
978 slightly succinct, it is because the full details have already been given.
979 See section <A HREF="gettext_6.html#SEC54">6.6 Modifying Translations</A>.
981 </P>
983 <A NAME="IDX421"></A>
984 <A NAME="IDX422"></A>
985 The command <KBD>#</KBD> (<CODE>po-edit-comment</CODE>) opens a new Emacs window
986 containing a copy of the translator comments on the current PO file entry.
987 If there are no such comments, PO mode understands that the translator wants
988 to add a comment to the entry, and she is presented with an empty screen.
989 Comment marks (<CODE>#</CODE>) and the space following them are automatically
990 removed before edition, and reinstated after. For translator comments
991 pertaining to obsolete entries, the uncommenting and recommenting operations
992 are done twice. Once in the editing window, the keys <KBD>C-c C-c</KBD>
993 allow the translator to tell she is finished with editing the comment.
994 See section <A HREF="gettext_6.html#SEC56">6.8 Details of Sub Edition</A>, for further details.
996 </P>
998 <A NAME="IDX423"></A>
999 Functions found on <CODE>po-subedit-mode-hook</CODE>, if any, are executed after
1000 the string has been inserted in the edit buffer.
1002 </P>
1004 <A NAME="IDX424"></A>
1005 <A NAME="IDX425"></A>
1006 <A NAME="IDX426"></A>
1007 <A NAME="IDX427"></A>
1008 <A NAME="IDX428"></A>
1009 <A NAME="IDX429"></A>
1010 The command <KBD>K</KBD> (<CODE>po-kill-comment</CODE>) gets rid of all
1011 translator comments, while saving those comments on the kill ring.
1012 The command <KBD>W</KBD> (<CODE>po-kill-ring-save-comment</CODE>) takes
1013 a copy of the translator comments on the kill ring, but leaves
1014 them undisturbed in the current entry. The command <KBD>Y</KBD>
1015 (<CODE>po-yank-comment</CODE>) completely replaces the translator comments
1016 by a string taken at the front of the kill ring. When this command
1017 is immediately repeated, the comments just inserted are withdrawn,
1018 and replaced by other strings taken along the kill ring.
1020 </P>
1022 On the kill ring, all strings have the same nature. There is no
1023 distinction between <EM>translation</EM> strings and <EM>translator
1024 comments</EM> strings. So, for example, let's presume the translator
1025 has just finished editing a translation, and wants to create a new
1026 translator comment to document why the previous translation was
1027 not good, just to remember what was the problem. Foreseeing that she
1028 will do that in her documentation, the translator may want to quote
1029 the previous translation in her translator comments. To do so, she
1030 may initialize the translator comments with the previous translation,
1031 still at the head of the kill ring. Because editing already pushed the
1032 previous translation on the kill ring, she merely has to type <KBD>M-w</KBD>
1033 prior to <KBD>#</KBD>, and the previous translation will be right there,
1034 all ready for being introduced by some explanatory text.
1036 </P>
1038 On the other hand, presume there are some translator comments already
1039 and that the translator wants to add to those comments, instead
1040 of wholly replacing them. Then, she should edit the comment right
1041 away with <KBD>#</KBD>. Once inside the editing window, she can use the
1042 regular Emacs commands <KBD>C-y</KBD> (<CODE>yank</CODE>) and <KBD>M-y</KBD>
1043 (<CODE>yank-pop</CODE>) to get the previous translation where she likes.
1045 </P>
1048 <H2><A NAME="SEC56" HREF="gettext_toc.html#TOC56">6.8 Details of Sub Edition</A></H2>
1050 <A NAME="IDX430"></A>
1052 </P>
1054 The PO subedit minor mode has a few peculiarities worth being described
1055 in fuller detail. It installs a few commands over the usual editing set
1056 of Emacs, which are described below.
1058 </P>
1059 <DL COMPACT>
1061 <DT><KBD>C-c C-c</KBD>
1062 <DD>
1063 <A NAME="IDX431"></A>
1064 Complete edition (<CODE>po-subedit-exit</CODE>).
1066 <DT><KBD>C-c C-k</KBD>
1067 <DD>
1068 <A NAME="IDX432"></A>
1069 Abort edition (<CODE>po-subedit-abort</CODE>).
1071 <DT><KBD>C-c C-a</KBD>
1072 <DD>
1073 <A NAME="IDX433"></A>
1074 Consult auxiliary PO files (<CODE>po-subedit-cycle-auxiliary</CODE>).
1076 </DL>
1079 <A NAME="IDX434"></A>
1080 <A NAME="IDX435"></A>
1081 <A NAME="IDX436"></A>
1082 The window's contents represents a translation for a given message,
1083 or a translator comment. The translator may modify this window to
1084 her heart's content. Once this is done, the command <KBD>C-c C-c</KBD>
1085 (<CODE>po-subedit-exit</CODE>) may be used to return the edited translation into
1086 the PO file, replacing the original translation, even if it moved out of
1087 sight or if buffers were switched.
1089 </P>
1091 <A NAME="IDX437"></A>
1092 <A NAME="IDX438"></A>
1093 If the translator becomes unsatisfied with her translation or comment,
1094 to the extent she prefers keeping what was existent prior to the
1095 <KBD><KBD>RET</KBD></KBD> or <KBD>#</KBD> command, she may use the command <KBD>C-c C-k</KBD>
1096 (<CODE>po-subedit-abort</CODE>) to merely get rid of edition, while preserving
1097 the original translation or comment. Another way would be for her to exit
1098 normally with <KBD>C-c C-c</KBD>, then type <CODE>U</CODE> once for undoing the
1099 whole effect of last edition.
1101 </P>
1103 <A NAME="IDX439"></A>
1104 <A NAME="IDX440"></A>
1105 The command <KBD>C-c C-a</KBD> (<CODE>po-subedit-cycle-auxiliary</CODE>)
1106 allows for glancing through translations
1107 already achieved in other languages, directly while editing the current
1108 translation. This may be quite convenient when the translator is fluent
1109 at many languages, but of course, only makes sense when such completed
1110 auxiliary PO files are already available to her (see section <A HREF="gettext_6.html#SEC58">6.10 Consulting Auxiliary PO Files</A>).
1112 </P>
1114 Functions found on <CODE>po-subedit-mode-hook</CODE>, if any, are executed after
1115 the string has been inserted in the edit buffer.
1117 </P>
1119 While editing her translation, the translator should pay attention to not
1120 inserting unwanted <KBD><KBD>RET</KBD></KBD> (newline) characters at the end of
1121 the translated string if those are not meant to be there, or to removing
1122 such characters when they are required. Since these characters are not
1123 visible in the editing buffer, they are easily introduced by mistake.
1124 To help her, <KBD><KBD>RET</KBD></KBD> automatically puts the character <CODE>&#60;</CODE>
1125 at the end of the string being edited, but this <CODE>&#60;</CODE> is not really
1126 part of the string. On exiting the editing window with <KBD>C-c C-c</KBD>,
1127 PO mode automatically removes such <KBD>&#60;</KBD> and all whitespace added after
1128 it. If the translator adds characters after the terminating <CODE>&#60;</CODE>, it
1129 looses its delimiting property and integrally becomes part of the string.
1130 If she removes the delimiting <CODE>&#60;</CODE>, then the edited string is taken
1131 <EM>as is</EM>, with all trailing newlines, even if invisible. Also, if
1132 the translated string ought to end itself with a genuine <CODE>&#60;</CODE>, then
1133 the delimiting <CODE>&#60;</CODE> may not be removed; so the string should appear,
1134 in the editing window, as ending with two <CODE>&#60;</CODE> in a row.
1136 </P>
1138 <A NAME="IDX441"></A>
1139 When a translation (or a comment) is being edited, the translator may move
1140 the cursor back into the PO file buffer and freely move to other entries,
1141 browsing at will. If, with an edition pending, the translator wanders in the
1142 PO file buffer, she may decide to start modifying another entry. Each entry
1143 being edited has its own subedit buffer. It is possible to simultaneously
1144 edit the translation <EM>and</EM> the comment of a single entry, or to
1145 edit entries in different PO files, all at once. Typing <KBD><KBD>RET</KBD></KBD>
1146 on a field already being edited merely resumes that particular edit. Yet,
1147 the translator should better be comfortable at handling many Emacs windows!
1149 </P>
1151 <A NAME="IDX442"></A>
1152 Pending subedits may be completed or aborted in any order, regardless
1153 of how or when they were started. When many subedits are pending and the
1154 translator asks for quitting the PO file (with the <KBD>q</KBD> command), subedits
1155 are automatically resumed one at a time, so she may decide for each of them.
1157 </P>
1160 <H2><A NAME="SEC57" HREF="gettext_toc.html#TOC57">6.9 C Sources Context</A></H2>
1162 <A NAME="IDX443"></A>
1163 <A NAME="IDX444"></A>
1164 <A NAME="IDX445"></A>
1166 </P>
1168 PO mode is particularly powerful when used with PO files
1169 created through GNU <CODE>gettext</CODE> utilities, as those utilities
1170 insert special comments in the PO files they generate.
1171 Some of these special comments relate the PO file entry to
1172 exactly where the untranslated string appears in the program sources.
1174 </P>
1176 When the translator gets to an untranslated entry, she is fairly
1177 often faced with an original string which is not as informative as
1178 it normally should be, being succinct, cryptic, or otherwise ambiguous.
1179 Before choosing how to translate the string, she needs to understand
1180 better what the string really means and how tight the translation has
1181 to be. Most of the time, when problems arise, the only way left to make
1182 her judgment is looking at the true program sources from where this
1183 string originated, searching for surrounding comments the programmer
1184 might have put in there, and looking around for helping clues of
1185 <EM>any</EM> kind.
1187 </P>
1189 Surely, when looking at program sources, the translator will receive
1190 more help if she is a fluent programmer. However, even if she is
1191 not versed in programming and feels a little lost in C code, the
1192 translator should not be shy at taking a look, once in a while.
1193 It is most probable that she will still be able to find some of the
1194 hints she needs. She will learn quickly to not feel uncomfortable
1195 in program code, paying more attention to programmer's comments,
1196 variable and function names (if he dared choosing them well), and
1197 overall organization, than to the program code itself.
1199 </P>
1201 <A NAME="IDX446"></A>
1202 The following commands are meant to help the translator at getting
1203 program source context for a PO file entry.
1205 </P>
1206 <DL COMPACT>
1208 <DT><KBD>s</KBD>
1209 <DD>
1210 <A NAME="IDX447"></A>
1211 Resume the display of a program source context, or cycle through them
1212 (<CODE>po-cycle-source-reference</CODE>).
1214 <DT><KBD>M-s</KBD>
1215 <DD>
1216 <A NAME="IDX448"></A>
1217 Display of a program source context selected by menu
1218 (<CODE>po-select-source-reference</CODE>).
1220 <DT><KBD>S</KBD>
1221 <DD>
1222 <A NAME="IDX449"></A>
1223 Add a directory to the search path for source files
1224 (<CODE>po-consider-source-path</CODE>).
1226 <DT><KBD>M-S</KBD>
1227 <DD>
1228 <A NAME="IDX450"></A>
1229 Delete a directory from the search path for source files
1230 (<CODE>po-ignore-source-path</CODE>).
1232 </DL>
1235 <A NAME="IDX451"></A>
1236 <A NAME="IDX452"></A>
1237 <A NAME="IDX453"></A>
1238 <A NAME="IDX454"></A>
1239 The commands <KBD>s</KBD> (<CODE>po-cycle-source-reference</CODE>) and <KBD>M-s</KBD>
1240 (<CODE>po-select-source-reference</CODE>) both open another window displaying
1241 some source program file, and already positioned in such a way that
1242 it shows an actual use of the string to be translated. By doing
1243 so, the command gives source program context for the string. But if
1244 the entry has no source context references, or if all references
1245 are unresolved along the search path for program sources, then the
1246 command diagnoses this as an error.
1248 </P>
1250 Even if <KBD>s</KBD> (or <KBD>M-s</KBD>) opens a new window, the cursor stays
1251 in the PO file window. If the translator really wants to
1252 get into the program source window, she ought to do it explicitly,
1253 maybe by using command <KBD>O</KBD>.
1255 </P>
1257 When <KBD>s</KBD> is typed for the first time, or for a PO file entry which
1258 is different of the last one used for getting source context, then the
1259 command reacts by giving the first context available for this entry,
1260 if any. If some context has already been recently displayed for the
1261 current PO file entry, and the translator wandered off to do other
1262 things, typing <KBD>s</KBD> again will merely resume, in another window,
1263 the context last displayed. In particular, if the translator moved
1264 the cursor away from the context in the source file, the command will
1265 bring the cursor back to the context. By using <KBD>s</KBD> many times
1266 in a row, with no other commands intervening, PO mode will cycle to
1267 the next available contexts for this particular entry, getting back
1268 to the first context once the last has been shown.
1270 </P>
1272 The command <KBD>M-s</KBD> behaves differently. Instead of cycling through
1273 references, it lets the translator choose a particular reference among
1274 many, and displays that reference. It is best used with completion,
1275 if the translator types <KBD><KBD>TAB</KBD></KBD> immediately after <KBD>M-s</KBD>, in
1276 response to the question, she will be offered a menu of all possible
1277 references, as a reminder of which are the acceptable answers.
1278 This command is useful only where there are really many contexts
1279 available for a single string to translate.
1281 </P>
1283 <A NAME="IDX455"></A>
1284 <A NAME="IDX456"></A>
1285 <A NAME="IDX457"></A>
1286 <A NAME="IDX458"></A>
1287 Program source files are usually found relative to where the PO
1288 file stands. As a special provision, when this fails, the file is
1289 also looked for, but relative to the directory immediately above it.
1290 Those two cases take proper care of most PO files. However, it might
1291 happen that a PO file has been moved, or is edited in a different
1292 place than its normal location. When this happens, the translator
1293 should tell PO mode in which directory normally sits the genuine PO
1294 file. Many such directories may be specified, and all together, they
1295 constitute what is called the <EM>search path</EM> for program sources.
1296 The command <KBD>S</KBD> (<CODE>po-consider-source-path</CODE>) is used to interactively
1297 enter a new directory at the front of the search path, and the command
1298 <KBD>M-S</KBD> (<CODE>po-ignore-source-path</CODE>) is used to select, with completion,
1299 one of the directories she does not want anymore on the search path.
1301 </P>
1304 <H2><A NAME="SEC58" HREF="gettext_toc.html#TOC58">6.10 Consulting Auxiliary PO Files</A></H2>
1306 <A NAME="IDX459"></A>
1308 </P>
1310 PO mode is able to help the knowledgeable translator, being fluent in
1311 many languages, at taking advantage of translations already achieved
1312 in other languages she just happens to know. It provides these other
1313 language translations as additional context for her own work. Moreover,
1314 it has features to ease the production of translations for many languages
1315 at once, for translators preferring to work in this way.
1317 </P>
1319 <A NAME="IDX460"></A>
1320 <A NAME="IDX461"></A>
1321 An <EM>auxiliary</EM> PO file is an existing PO file meant for the same
1322 package the translator is working on, but targeted to a different mother
1323 tongue language. Commands exist for declaring and handling auxiliary
1324 PO files, and also for showing contexts for the entry under work.
1326 </P>
1328 Here are the auxiliary file commands available in PO mode.
1330 </P>
1331 <DL COMPACT>
1333 <DT><KBD>a</KBD>
1334 <DD>
1335 <A NAME="IDX462"></A>
1336 Seek auxiliary files for another translation for the same entry
1337 (<CODE>po-cycle-auxiliary</CODE>).
1339 <DT><KBD>C-c C-a</KBD>
1340 <DD>
1341 <A NAME="IDX463"></A>
1342 Switch to a particular auxiliary file (<CODE>po-select-auxiliary</CODE>).
1344 <DT><KBD>A</KBD>
1345 <DD>
1346 <A NAME="IDX464"></A>
1347 Declare this PO file as an auxiliary file (<CODE>po-consider-as-auxiliary</CODE>).
1349 <DT><KBD>M-A</KBD>
1350 <DD>
1351 <A NAME="IDX465"></A>
1352 Remove this PO file from the list of auxiliary files
1353 (<CODE>po-ignore-as-auxiliary</CODE>).
1355 </DL>
1358 <A NAME="IDX466"></A>
1359 <A NAME="IDX467"></A>
1360 <A NAME="IDX468"></A>
1361 <A NAME="IDX469"></A>
1362 Command <KBD>A</KBD> (<CODE>po-consider-as-auxiliary</CODE>) adds the current
1363 PO file to the list of auxiliary files, while command <KBD>M-A</KBD>
1364 (<CODE>po-ignore-as-auxiliary</CODE> just removes it.
1366 </P>
1368 <A NAME="IDX470"></A>
1369 <A NAME="IDX471"></A>
1370 The command <KBD>a</KBD> (<CODE>po-cycle-auxiliary</CODE>) seeks all auxiliary PO
1371 files, round-robin, searching for a translated entry in some other language
1372 having an <CODE>msgid</CODE> field identical as the one for the current entry.
1373 The found PO file, if any, takes the place of the current PO file in
1374 the display (its window gets on top). Before doing so, the current PO
1375 file is also made into an auxiliary file, if not already. So, <KBD>a</KBD>
1376 in this newly displayed PO file will seek another PO file, and so on,
1377 so repeating <KBD>a</KBD> will eventually yield back the original PO file.
1379 </P>
1381 <A NAME="IDX472"></A>
1382 <A NAME="IDX473"></A>
1383 The command <KBD>C-c C-a</KBD> (<CODE>po-select-auxiliary</CODE>) asks the translator
1384 for her choice of a particular auxiliary file, with completion, and
1385 then switches to that selected PO file. The command also checks if
1386 the selected file has an <CODE>msgid</CODE> field identical as the one for
1387 the current entry, and if yes, this entry becomes current. Otherwise,
1388 the cursor of the selected file is left undisturbed.
1390 </P>
1392 For all this to work fully, auxiliary PO files will have to be normalized,
1393 in that way that <CODE>msgid</CODE> fields should be written <EM>exactly</EM>
1394 the same way. It is possible to write <CODE>msgid</CODE> fields in various
1395 ways for representing the same string, different writing would break the
1396 proper behaviour of the auxiliary file commands of PO mode. This is not
1397 expected to be much a problem in practice, as most existing PO files have
1398 their <CODE>msgid</CODE> entries written by the same GNU <CODE>gettext</CODE> tools.
1400 </P>
1402 <A NAME="IDX474"></A>
1403 However, PO files initially created by PO mode itself, while marking
1404 strings in source files, are normalised differently. So are PO
1405 files resulting of the the <SAMP>`M-x normalize&acute;</SAMP> command. Until these
1406 discrepancies between PO mode and other GNU <CODE>gettext</CODE> tools get
1407 fully resolved, the translator should stay aware of normalisation issues.
1409 </P>
1412 <H2><A NAME="SEC59" HREF="gettext_toc.html#TOC59">6.11 Using Translation Compendia</A></H2>
1414 <A NAME="IDX475"></A>
1416 </P>
1418 <A NAME="IDX476"></A>
1419 A <EM>compendium</EM> is a special PO file containing a set of
1420 translations recurring in many different packages. The translator can
1421 use gettext tools to build a new compendium, to add entries to her
1422 compendium, and to initialize untranslated entries, or to update
1423 already translated entries, from translations kept in the compendium.
1425 </P>
1429 <H3><A NAME="SEC60" HREF="gettext_toc.html#TOC60">6.11.1 Creating Compendia</A></H3>
1431 <A NAME="IDX477"></A>
1432 <A NAME="IDX478"></A>
1434 </P>
1436 Basically every PO file consisting of translated entries only can be
1437 declared as a valid compendium. Often the translator wants to have
1438 special compendia; let's consider two cases: <CITE>concatenating PO
1439 files</CITE> and <CITE>extracting a message subset from a PO file</CITE>.
1441 </P>
1444 <H4><A NAME="SEC61" HREF="gettext_toc.html#TOC61">6.11.1.1 Concatenate PO Files</A></H4>
1447 <A NAME="IDX479"></A>
1448 <A NAME="IDX480"></A>
1449 To concatenate several valid PO files into one compendium file you can
1450 use <SAMP>`msgcomm&acute;</SAMP> or <SAMP>`msgcat&acute;</SAMP> (the latter preferred):
1452 </P>
1454 <PRE>
1455 msgcat -o compendium.po file1.po file2.po
1456 </PRE>
1459 By default, <CODE>msgcat</CODE> will accumulate divergent translations
1460 for the same string. Those occurences will be marked as <CODE>fuzzy</CODE>
1461 and highly visible decorated; calling <CODE>msgcat</CODE> on
1462 <TT>`file1.po&acute;</TT>:
1464 </P>
1466 <PRE>
1467 #: src/hello.c:200
1468 #, c-format
1469 msgid "Report bugs to &#60;%s&#62;.\n"
1470 msgstr "Comunicar `bugs' a &#60;%s&#62;.\n"
1471 </PRE>
1474 and <TT>`file2.po&acute;</TT>:
1476 </P>
1478 <PRE>
1479 #: src/bye.c:100
1480 #, c-format
1481 msgid "Report bugs to &#60;%s&#62;.\n"
1482 msgstr "Comunicar \"bugs\" a &#60;%s&#62;.\n"
1483 </PRE>
1486 will result in:
1488 </P>
1490 <PRE>
1491 #: src/hello.c:200 src/bye.c:100
1492 #, fuzzy, c-format
1493 msgid "Report bugs to &#60;%s&#62;.\n"
1494 msgstr ""
1495 "#-#-#-#-# file1.po #-#-#-#-#\n"
1496 "Comunicar `bugs' a &#60;%s&#62;.\n"
1497 "#-#-#-#-# file2.po #-#-#-#-#\n"
1498 "Comunicar \"bugs\" a &#60;%s&#62;.\n"
1499 </PRE>
1502 The translator will have to resolve this "conflict" manually; she
1503 has to decide whether the first or the second version is appropriate
1504 (or provide a new translation), to delete the "marker lines", and
1505 finally to remove the <CODE>fuzzy</CODE> mark.
1507 </P>
1509 If the translator knows in advance the first found translation of a
1510 message is always the best translation she can make use to the
1511 <SAMP>`--use-first&acute;</SAMP> switch:
1513 </P>
1515 <PRE>
1516 msgcat --use-first -o compendium.po file1.po file2.po
1517 </PRE>
1520 A good compendium file must not contain <CODE>fuzzy</CODE> or untranslated
1521 entries. If input files are "dirty" you must preprocess the input
1522 files or postprocess the result using <SAMP>`msgattrib --translated --no-fuzzy&acute;</SAMP>.
1524 </P>
1527 <H4><A NAME="SEC62" HREF="gettext_toc.html#TOC62">6.11.1.2 Extract a Message Subset from a PO File</A></H4>
1529 <A NAME="IDX481"></A>
1531 </P>
1533 Nobody wants to translate the same messages again and again; thus you
1534 may wish to have a compendium file containing <TT>`getopt.c&acute;</TT> messages.
1536 </P>
1538 To extract a message subset (e.g., all <TT>`getopt.c&acute;</TT> messages) from an
1539 existing PO file into one compendium file you can use <SAMP>`msggrep&acute;</SAMP>:
1541 </P>
1543 <PRE>
1544 msggrep --location src/getopt.c -o compendium.po file.po
1545 </PRE>
1549 <H3><A NAME="SEC63" HREF="gettext_toc.html#TOC63">6.11.2 Using Compendia</A></H3>
1552 You can use a compendium file to initialize a translation from scratch
1553 or to update an already existing translation.
1555 </P>
1558 <H4><A NAME="SEC64" HREF="gettext_toc.html#TOC64">6.11.2.1 Initialize a New Translation File</A></H4>
1560 <A NAME="IDX482"></A>
1562 </P>
1564 Since a PO file with translations does not exist the translator can
1565 merely use <TT>`/dev/null&acute;</TT> to fake the "old" translation file.
1567 </P>
1569 <PRE>
1570 msgmerge --compendium compendium.po -o file.po /dev/null file.pot
1571 </PRE>
1575 <H4><A NAME="SEC65" HREF="gettext_toc.html#TOC65">6.11.2.2 Update an Existing Translation File</A></H4>
1577 <A NAME="IDX483"></A>
1579 </P>
1581 Concatenate the compendium file(s) and the existing PO, merge the
1582 result with the POT file and remove the obsolete entries (optional,
1583 here done using <SAMP>`sed&acute;</SAMP>):
1585 </P>
1587 <PRE>
1588 msgcat --use-first -o update.po compendium1.po compendium2.po file.po
1589 msgmerge update.po file.pot | sed -e '/^#~/d' &#62; file.po
1590 </PRE>
1592 <P><HR><P>
1593 Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_5.html">previous</A>, <A HREF="gettext_7.html">next</A>, <A HREF="gettext_22.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>.
1594 </BODY>
1595 </HTML>