X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Flocales.pl;h=bdc3852af59fb6c0dd86538a8512dc64eaf3d8e8;hb=c8c6d1e8cc86565fb0e0fd290317f28e76bbff3b;hp=25579c3ea5e9f57f84368aa3639df7428f45660e;hpb=8d011bee4d01444862f49a083f9e47b2b07f0a9c;p=kivitendo-erp.git diff --git a/scripts/locales.pl b/scripts/locales.pl index 25579c3ea..bdc3852af 100755 --- a/scripts/locales.pl +++ b/scripts/locales.pl @@ -31,6 +31,7 @@ parse_args(); my $basedir = "../.."; my $locales_dir = "."; my $bindir = "$basedir/bin/mozilla"; +my @progdirs = ( "$basedir/SL/Controller", "$basedir/SL/Template/Plugin" ); my $dbupdir = "$basedir/sql/Pg-upgrade"; my $dbupdir2 = "$basedir/sql/Pg-upgrade2"; my $menufile = "menu.ini"; @@ -42,11 +43,17 @@ my ($ALL_HEADER, $MISSING_HEADER, $LOST_HEADER); init(); opendir DIR, "$bindir" or die "$!"; -my @progfiles = grep { /\.pl$/ && !/(_custom|^\.)/ } readdir DIR; +my @progfiles = map { [ $_, $bindir ] } grep { /\.pl$/ && !/(_custom|^\.)/ } readdir DIR; seekdir DIR, 0; my @customfiles = grep /_custom/, readdir DIR; closedir DIR; +foreach my $dir (@progdirs) { + opendir DIR, $dir or die "$!"; + push @progfiles, map { [ $_, $dir ] } grep { /\.pm$/ } readdir DIR; + closedir DIR; +} + # put customized files into @customfiles my @menufiles; @@ -91,7 +98,7 @@ chomp $charset; my %old_texts = %{ $self->{texts} || {} }; -map({ handle_file($_, $bindir); } @progfiles); +map({ handle_file(@{ $_ }); } @progfiles); map({ handle_file($_, $dbupdir); } @dbplfiles); map({ handle_file($_, $dbupdir2); } @dbplfiles2); @@ -283,11 +290,11 @@ sub extract_text_between_parenthesis { } else { if ($quote_next) { + $text .= '\\' unless $cur_char eq "'"; $text .= $cur_char; $quote_next = 0; } elsif ($cur_char eq '\\') { - $text .= $cur_char; $quote_next = 1; } elsif ($cur_char eq $inside_string) { @@ -339,7 +346,7 @@ sub scanfile { } # is this a template call? - if (/parse_html_template2?\s*\(\s*[\"\']([\w\/]+)\s*[\"\']/) { + if (/(?:parse_html_template2?|render)\s*\(\s*[\"\']([\w\/]+)\s*[\"\']/) { my $newfile = "$basedir/templates/webpages/$1.html"; if (/parse_html_template2/) { print "E: " . strip_base($file) . " is still using 'parse_html_template2' for " . strip_base($newfile) . ".\n"; @@ -600,12 +607,12 @@ sub generate_file { my $data_name = $params{data_name}; my @delim = split //, ($params{delim} || '{}'); - open my $fh, '>', $file or die "$! : $file"; + open my $fh, '>:encoding(utf8)', $file or die "$! : $file"; $charset =~ s/\r?\n//g; my $emacs_charset = lc $charset; - print $fh "#!/usr/bin/perl\n# -*- coding: $emacs_charset; -*-\n# vim: fenc=$charset\n\n"; + print $fh "#!/usr/bin/perl\n# -*- coding: $emacs_charset; -*-\n# vim: fenc=$charset\n\nuse utf8;\n\n"; print $fh $header, "\n" if $header; print $fh "$data_name = $delim[0]\n" if $data_name;