From fe9ef86750991cfb56ef3030b51e8fd4a02cef86 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 8 Jan 2015 16:46:58 +0100 Subject: [PATCH] build: adapt i18n-update.pl to new structure Signed-off-by: Jo-Philipp Wich --- build/i18n-update.pl | 50 ++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/build/i18n-update.pl b/build/i18n-update.pl index 4106c6da4c..c82b4fe3dd 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 ) { - while( chomp( my $file = readline F ) ) - { - my ( $basename ) = $file =~ m{.+/([^/]+)\.po$}; - - if( -f "$source/templates/$basename.pot" ) - { - my $head = read_header($file); - - printf "Updating %-40s", $file; - system("msgmerge", "-U", "-N", $file, "$source/templates/$basename.pot"); - - write_header($file, $head); - } - } - - close F; + @dirs = glob("./*/*/po/"); +} +else +{ + @dirs = ( $source ); +} + +foreach my $dir (@dirs) +{ + if( open F, "find $dir -type f -name '$pattern' |" ) + { + while( chomp( my $file = readline F ) ) + { + 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, "$dir/templates/$basename.pot"); + + write_header($file, $head); + } + } + + close F; + } }