diff options
author | Brendan O'Dea <bod@debian.org> | 2015-11-03 11:19:39 +1100 |
---|---|---|
committer | Brendan O'Dea <bod@debian.org> | 2015-11-03 11:19:39 +1100 |
commit | 2e3fcc2583ed3be623406db40a4fd3c8ee7b6a11 (patch) | |
tree | aac3a14140466750b817954405786ffccd2d0656 /build-aux | |
parent | eef18237e6fc5cf48e6f9b5995606fb4c5001eae (diff) | |
download | help2man-2e3fcc2583ed3be623406db40a4fd3c8ee7b6a11.tar.gz |
Filter more untranslatable texi and add translator notes about cross-refs
Diffstat (limited to 'build-aux')
-rwxr-xr-x | build-aux/fixup-texi-pot | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/build-aux/fixup-texi-pot b/build-aux/fixup-texi-pot index 0e6000b..9ca9ace 100755 --- a/build-aux/fixup-texi-pot +++ b/build-aux/fixup-texi-pot @@ -1,10 +1,11 @@ #!/usr/bin/perl # Post-process the texinfo template to remove some entries which should not be -# translated. +# translated. Add translator notes to cross references. use strict; use warnings; +use Text::Wrap 'wrap'; *OUT = *STDOUT; if (@ARGV and $ARGV[0] =~ /^-o(.*)/) @@ -29,5 +30,39 @@ while (<>) next if /^msgid "\@unmacro/m; next if /^msgid "\\\\text\\\\"/m; + # Options. + next if /^msgid "-[a-zA-Z]"/m; + next if /^msgid "--[a-z-]+"/m; + + # Other untranslatable strings. + next if /^#\. type: author/ and /^msgid "[^@]*\@email\{[^}]*\}"/m; + next if /^msgid "help2man"/m; + next if /^msgid "\@url\{[^}]*\}(\\n)?"/m; + + # Find cross references and add a note to translators. + /^msgid "(.*)/sm or next; + my @refs = $1 =~ /\@(?:p?x)?ref\{([^,}]*)\}/g; + if (@refs) + { + for (@refs) + { + s/"\n"//g; # remove line breaks + $_ = qq/"$_",/; # add quotes and comma + } + + $refs[-1] =~ s/,$//; + my $plural = ''; + if (@refs > 1) + { + $plural = 's'; + splice @refs, -1, 0, 'and'; + } + + my $note = wrap "#. Translators: ", "#. ", + "the translated cross-reference$plural @refs here must match the " . + " target (type: node) translation$plural elsewhere in this file."; + $_ = $note . "\n" . $_; + } + print OUT; } |