build: adapt i18n-update.pl to new structure
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
parent
85e4256a7a
commit
fe9ef86750
1 changed files with 32 additions and 18 deletions
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
@ARGV >= 1 || die "Usage: $0 <po directory> [<file pattern>]\n";
|
@ARGV <= 2 || die "Usage: $0 [<po directory>] [<file pattern>]\n";
|
||||||
|
|
||||||
my $source = shift @ARGV;
|
my $source = shift @ARGV;
|
||||||
my $pattern = shift @ARGV || '*.po';
|
my $pattern = shift @ARGV || '*.po';
|
||||||
|
@ -48,22 +48,36 @@ sub write_header
|
||||||
close P;
|
close P;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( open F, "find $source -type f -name '$pattern' |" )
|
my @dirs;
|
||||||
|
|
||||||
|
if( ! $source )
|
||||||
{
|
{
|
||||||
while( chomp( my $file = readline F ) )
|
@dirs = glob("./*/*/po/");
|
||||||
{
|
}
|
||||||
my ( $basename ) = $file =~ m{.+/([^/]+)\.po$};
|
else
|
||||||
|
{
|
||||||
if( -f "$source/templates/$basename.pot" )
|
@dirs = ( $source );
|
||||||
{
|
}
|
||||||
my $head = read_header($file);
|
|
||||||
|
foreach my $dir (@dirs)
|
||||||
printf "Updating %-40s", $file;
|
{
|
||||||
system("msgmerge", "-U", "-N", $file, "$source/templates/$basename.pot");
|
if( open F, "find $dir -type f -name '$pattern' |" )
|
||||||
|
{
|
||||||
write_header($file, $head);
|
while( chomp( my $file = readline F ) )
|
||||||
}
|
{
|
||||||
}
|
my ( $basename ) = $file =~ m{.+/([^/]+)\.po$};
|
||||||
|
|
||||||
close F;
|
if( -f "$dir/templates/$basename.pot" )
|
||||||
|
{
|
||||||
|
my $head = read_header($file);
|
||||||
|
|
||||||
|
printf "Updating %-40s", $file;
|
||||||
|
system("msgmerge", "-U", "-N", $file, "$dir/templates/$basename.pot");
|
||||||
|
|
||||||
|
write_header($file, $head);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
close F;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue