3 @ARGV <= 2 || die "Usage: $0 [<po directory>] [<file pattern>]\n";
5 my $source = shift @ARGV;
6 my $pattern = shift @ARGV || '*.po';
10 my $file = shift || return;
13 open P, "< $file" || die "open(): $!";
14 my $data = readline P;
30 my $file = shift || return;
31 my $head = shift || return;
34 open P, "< $file" || die "open(): $!";
35 my $data = readline P;
46 open P, "> $file" || die "open(): $!";
55 @dirs = glob("./*/*/po/");
62 foreach my $dir (@dirs)
64 if( open F, "find $dir -type f -name '$pattern' |" )
66 while( chomp( my $file = readline F ) )
68 my ( $basename ) = $file =~ m{.+/([^/]+)\.po$};
70 if( -f "$dir/templates/$basename.pot" )
72 my $head = read_header($file);
74 printf "Updating %-40s", $file;
75 system("msgmerge", "-U", "-N", $file, "$dir/templates/$basename.pot");
77 write_header($file, $head);