diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-08 16:46:58 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-08 16:46:58 +0100 |
commit | fe9ef86750991cfb56ef3030b51e8fd4a02cef86 (patch) | |
tree | 426fd9dfe2114066da11491ebf52c3b206087d4e /build/i18n-update.pl | |
parent | 85e4256a7a41ef0f0578116ceb557e2c278dac5e (diff) |
build: adapt i18n-update.pl to new structure
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'build/i18n-update.pl')
-rwxr-xr-x | build/i18n-update.pl | 38 |
1 files changed, 26 insertions, 12 deletions
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 <po directory> [<file pattern>]\n"; +@ARGV <= 2 || die "Usage: $0 [<po directory>] [<file pattern>]\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; + } } |