X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=build%2Fi18n-update.pl;h=c82b4fe3dd610b53dcd5160400faa8fd1d915c3e;hp=4106c6da4c1c5a1cb06294ef87129c2b8497c3c5;hb=94ea9077076d98374a331131fb7c9fc57df370a6;hpb=91ac51d693bb9480a9747b969947546b0d8f6470 diff --git a/build/i18n-update.pl b/build/i18n-update.pl index 4106c6da4..c82b4fe3d 100755 --- a/build/i18n-update.pl +++ b/build/i18n-update.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -@ARGV >= 1 || die "Usage: $0 []\n"; +@ARGV <= 2 || die "Usage: $0 [] []\n"; my $source = shift @ARGV; my $pattern = shift @ARGV || '*.po'; @@ -48,22 +48,36 @@ sub write_header close P; } -if( open F, "find $source -type f -name '$pattern' |" ) +my @dirs; + +if( ! $source ) +{ + @dirs = glob("./*/*/po/"); +} +else +{ + @dirs = ( $source ); +} + +foreach my $dir (@dirs) { - while( chomp( my $file = readline F ) ) + if( open F, "find $dir -type f -name '$pattern' |" ) { - my ( $basename ) = $file =~ m{.+/([^/]+)\.po$}; - - if( -f "$source/templates/$basename.pot" ) + while( chomp( my $file = readline F ) ) { - my $head = read_header($file); + my ( $basename ) = $file =~ m{.+/([^/]+)\.po$}; + + if( -f "$dir/templates/$basename.pot" ) + { + my $head = read_header($file); - printf "Updating %-40s", $file; - system("msgmerge", "-U", "-N", $file, "$source/templates/$basename.pot"); + printf "Updating %-40s", $file; + system("msgmerge", "-U", "-N", $file, "$dir/templates/$basename.pot"); - write_header($file, $head); + write_header($file, $head); + } } - } - close F; + close F; + } }