Use consistent description for img sources
[survex.git] / msg.pl
blob544b6f03b0a55c811cedd95a881dab83bf98b977
1 #!/usr/bin/perl -w
2 my @msgs;
3 my $exitcode = 0;
4 use strict;
5 while (<>) {
6 while (m!/\*(.*?)\*/([0-9]+)\b!g) {
7 if (defined $msgs[$2] && $msgs[$2] ne $1) {
8 print STDERR "Message $2 has two different versions:\n";
9 print STDERR "\"$msgs[$2]\"\n\"$1\"\n";
10 $exitcode = 1;
12 $msgs[$2] = $1;
15 my $i = 0;
16 my $xxx;
17 for my $msg (@msgs) {
18 if (!defined $msg) {
19 if (!defined $xxx) {
20 $xxx = $i;
22 } else {
23 if (defined $xxx) {
24 print "# XXX $xxx";
25 print "-", ($i - 1) if ($i - 1 > $xxx);
26 print "\n";
27 $xxx = undef;
29 printf "en:%3d ", $i;
30 if ($msg =~ /^\s/ || $msg =~ /\s$/) {
31 print "\"$msg\"\n";
32 } else {
33 print "$msg\n";
36 ++$i;
38 if (defined $xxx) {
39 print "# XXX $xxx";
40 print "-", ($i - 1) if ($i - 1 > $xxx);
41 print "\n";
42 $xxx = undef;
44 exit $exitcode;