diff options
Diffstat (limited to 'bin/devel-tools/extractTranslations.pl')
-rwxr-xr-x | bin/devel-tools/extractTranslations.pl | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/bin/devel-tools/extractTranslations.pl b/bin/devel-tools/extractTranslations.pl index 9bef83c9..eab71f04 100755 --- a/bin/devel-tools/extractTranslations.pl +++ b/bin/devel-tools/extractTranslations.pl @@ -15,6 +15,7 @@ # and modules. # ----------------------------------------------------------------------------- use strict; +use warnings; my $abstract = q[ extractTranslations.pl @@ -32,6 +33,8 @@ use File::Find; use Getopt::Long; use Pod::Usage; +use OpenSLX::Utils; + my ( $helpReq, $show, @@ -86,11 +89,7 @@ sub ExtractTrStrings || $_ eq 'Translations' || $_ eq 'devel-tools'); return if -d; - open(F, "< $_") - or die "could not open file $_ for reading!"; - local $/ = undef; - my $text = <F>; - close(F); + my $text = slurpFile($_); if ($File::Find::name !~ m[\.pm$] && $text !~ m[^#!.+/perl]im) { # ignore anything other than perl-modules and -scripts return; @@ -129,11 +128,7 @@ sub UpdateTrModule print "updating $File::Find::name...\n"; my $trModule = $_; my $useKeyAsTranslation = ($trModule eq 'posix.pm'); - open(F, "< $trModule") - or die "could not open file $trModule for reading!"; - $/ = undef; - my $text = <F>; - close(F); + my $text = slurpFile($trModule); if ($text !~ m[%translations\s*=\s*\(\s*(.+)\s*\);]os) { print "\t*** No translations found - file will be skipped! ***\n"; return; @@ -188,10 +183,7 @@ sub UpdateTrModule [$updatedTranslations);]os; if ($newCount + $delCount) { chomp $text; - open(F, "> $trModule") - or die "could not open file $trModule for writing!"; - print F "$text\n"; - close(F); + spitFile($trModule, $text."\n"); print "\tadded $newCount strings, kept $keepCount and removed $delCount.\n"; } else { print "\tnothing changed\n"; |