3 # Post-process the texinfo template to remove some entries which should not be
4 # translated. Add translator notes to cross references.
11 if (@ARGV and $ARGV[0] =~ /^-o(.*)/)
14 my $out = $1 || shift || die "$0: missing output file\n";
15 open OUT, '>', $out or die "$0: can't open $out ($!)\n";
18 $/ = ''; # read paragraphs
21 # Path name for dir entry. Corrected by fixup-texi-trans.
22 next if /^#\. type: menuentry/m
23 and /^msgid "help2man: \(help2man\)"/m;
25 # "Top" node is special to texinfo.
26 next if /^#\. type: node/m
29 # Macro commands, and parameters.
30 next if /^msgid "\@unmacro/m;
31 next if /^msgid "\\\\text\\\\"/m;
34 next if /^msgid "-[a-zA-Z]"/m;
35 next if /^msgid "--[a-z-]+"/m;
37 # Other untranslatable strings.
38 next if /^#\. type: author/ and /^msgid "[^@]*\@email\{[^}]*\}"/m;
39 next if /^msgid "help2man"/m;
40 next if /^msgid "\@url\{[^}]*\}(\\n)?"/m;
42 # Find cross references and add a note to translators.
43 /^msgid "(.*)/sm or next;
44 my @refs = $1 =~ /\@(?:p?x)?ref\{([^,}]*)\}/g;
49 s/"\n"//g; # remove line breaks
50 $_ = qq/"$_",/; # add quotes and comma
58 splice @refs, -1, 0, 'and';
61 my $note = wrap "#. Translators: ", "#. ",
62 "the translated cross-reference$plural @refs here must match the " .
63 " target (type: node) translation$plural elsewhere in this file.";
64 $_ = $note . "\n" . $_;