10 if (@ARGV == 0 || $ARGV[0] eq '--help') {
11 print STDERR
"Syntax: $0 PO_FILE...\n";
16 for my $po_file (@ARGV) {
18 if (!($todo =~ s/\.po$/.todo/)) {
19 print STDERR
"$po_file: doesn't end '.po'\n";
22 my $po = Locale
::PO
->load_file_asarray($po_file);
24 print STDERR
"$po_file: Bad!\n";
28 open TODO
, '>', $todo or die $!;
29 foreach my $po_entry (@
{$po}) {
30 my $msgid = $po_entry->msgid;
31 my $msgstr = $po_entry->msgstr;
32 ($msgid eq '""' || $msgstr eq '""' || $po_entry->fuzzy) or next;
33 $msgstr =~ s/\\n(..)/\\n"\n"$1/g;
35 print TODO
"msgid $msgid\n";
36 print TODO
"msgstr \"\"\n$msgstr\n";
39 if (defined $po_entry->automatic) {
40 my $automatic = "\n" . $po_entry->automatic;
41 $automatic =~ s/\n/\n#. /g;
42 while ($automatic =~ s/\n#. \n/\n#.\n/g) { }
43 print TODO
$automatic;
45 my $ref = $po_entry->reference;
48 $ref =~ s/\n/\n#: /mg;
51 my $fuzzy = $po_entry->fuzzy;
52 my $c_format = $po_entry->c_format;
53 if ($fuzzy || $c_format) {
55 print TODO
", fuzzy" if $fuzzy;
56 print TODO
", c-format" if $c_format;
59 print TODO
"#~ " if $po_entry->obsolete;
60 print TODO
"msgid $msgid\n";
61 print TODO
"#~ " if $po_entry->obsolete;
62 print TODO
"msgstr $msgstr\n";
67 push @nonempty, $todo;
73 my $host = 'atreus.tartarus.org';
74 my $webpath = '/srv/www/survex.com/software.i18n';
76 print "To update the files on the webserver:\n";
78 print "rsync -av --delete-after *.todo '$host:$webpath/'\n";
80 print "ssh $host rm '$webpath/*.todo'\n";