Changeset 1034916 in git for lib/extract-msgs.pl


Ignore:
Timestamp:
16/02/15 00:46:23 (5 years ago)
Author:
Olly Betts <olly@…>
Branches:
line_contents, master, stereo, travis-osx
Children:
a7d4233
Parents:
0b8c321
Message:

lib/extract-msgs.pl: Report file:line for issues we spot.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/extract-msgs.pl

    r0b8c321 r1034916  
    1010use integer;
    1111
    12 my (%msgs, @uses, %comment);
     12my (%msgs, @uses, %comment, %loc);
    1313my $translator_comment;
    1414while (<ARGV>) {
     
    3232        $comment =~ s/\n+$//;
    3333        if (defined $translator_comment) {
    34             print STDERR "Ignored TRANSLATORS comment: $translator_comment\n";
     34            print STDERR "$ARGV:$.: Ignored TRANSLATORS comment: $translator_comment\n";
    3535        }
    3636        $translator_comment = $comment;
     
    4444        if (exists $msgs{$msgno}) {
    4545            if ($msgs{$msgno} ne $msg) {
    46                 print STDERR "Mismatch for message number $msgno:\n";
     46                print STDERR "$ARGV:$.: Mismatch for message number $msgno:\n";
    4747                print STDERR "$msgs{$msgno}\n$msg\n";
    4848            }
     
    5353            if (exists $comment{$msgno} && $comment{$msgno} ne $translator_comment) {
    5454                print STDERR "Different TRANSLATOR comments for message #$msgno\n";
    55                 print STDERR "survex.pot: $comment{$msgno}\n";
     55                print STDERR "${$uses[$msgno]}[0]: $comment{$msgno}\n";
    5656                print STDERR "$ARGV:$.: $translator_comment\n";
    5757            }
     
    100100        delete $msgs{$msgno};
    101101    } else {
    102         print STDERR "Message number $msgno is in survex.pot but not found in source - preserving\n" unless $po_entry->obsolete;
     102        print STDERR "../lib/survex.pot:", $po_entry->loaded_line_number, ": Message number $msgno is in survex.pot but not found in source - preserving\n" unless $po_entry->obsolete;
    103103        $msg = $po_entry->dequote($po_entry->msgid);
    104104    }
     
    111111            $new =~ s/\s+/ /g;
    112112            if ($old ne $new) {
    113                 print STDERR "Comment for message #$msgno changed from\n[$old]\nto\n[$new]\n";
     113                print STDERR "Comment for message #$msgno changed:\n";
     114                print STDERR "../lib/survex.pot:", $po_entry->loaded_line_number, ": [$old]\n";
     115                print STDERR "${$uses[$msgno]}[0]: [$new]\n";
    114116            }
    115117        }
     
    119121            my $fake_err = ": Comment for message #$msgno not in source code\n";
    120122            if ($msgno ne '' && exists($uses[$msgno])) {
    121                 print STDERR join($fake_err, @{$uses[$msgno]}), $fake_err if exists($uses[$msgno]);
     123                print STDERR join($fake_err, "../lib/survex.pot:".$po_entry->loaded_line_number, @{$uses[$msgno]}), $fake_err if exists($uses[$msgno]);
    122124                my $x = $po_entry->automatic;
    123125                $x =~ s/\n/\n     * /g;
Note: See TracChangeset for help on using the changeset viewer.