3 @ARGV >= 1 || 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;
17 $data =~ s/("Language-Team: .*?\\n"\n)(.+?)("Language: .*?\\n"\n)/$1$3$2/s;
19 open P, "> $file" || die "open(): $!";
24 if( open F, "find $source -type f -name '$pattern' |" )
26 while( chomp( my $file = readline F ) )
28 my ( $basename ) = $file =~ m{.+/([^/]+)\.po$};
30 if( -f "$source/templates/$basename.pot" )
32 printf "Updating %-40s", $file;
33 system("msgmerge", "-U", "-N", $file, "$source/templates/$basename.pot");
34 fixup_header_order($file);