0dd213a5356624a0e7291b3fc89574c6d97bb224
[project/luci.git] / build / i18n-update.pl
1 #!/usr/bin/perl
2
3 @ARGV >= 1 || die "Usage: $0 <po directory> [<file pattern>]\n";
4
5 my $source = shift @ARGV;
6 my $pattern = shift @ARGV || '*.po';
7
8 if( open F, "find $source -type f -name '$pattern' |" )
9 {
10 while( chomp( my $file = readline F ) )
11 {
12 my ( $basename ) = $file =~ m{.+/([^/]+)\.po$};
13
14 if( -f "$source/templates/$basename.pot" )
15 {
16 printf "Updating %-40s", $file;
17 system("msgmerge", "-U", "-N", $file, "$source/templates/$basename.pot");
18 }
19 }
20
21 close F;
22 }