X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Flocales.pl;h=9e6a4ae58ecfd6ec4fe91654a9853c2a1f6f79f4;hb=cb3431bcc4eae2bc5a2851cae10f9dfd8f517c4a;hp=8105abd9a76b67fb46dd0c081b0ee72cf695e0fc;hpb=ea974a5a5448c986c50f25a97e4b6b06efa2e299;p=kivitendo-erp.git diff --git a/scripts/locales.pl b/scripts/locales.pl index 8105abd9a..9e6a4ae58 100755 --- a/scripts/locales.pl +++ b/scripts/locales.pl @@ -35,8 +35,6 @@ my $basedir = "../.."; my $locales_dir = "."; my $bindir = "$basedir/bin/mozilla"; my @progdirs = ( "$basedir/SL" ); -my $dbupdir = "$basedir/sql/Pg-upgrade"; -my $dbupdir2 = "$basedir/sql/Pg-upgrade2"; my $menufile = "menu.ini"; my @javascript_dirs = ($basedir .'/js', $basedir .'/templates/webpages'); my $javascript_output_dir = $basedir .'/js'; @@ -45,6 +43,10 @@ our $self = {}; our $missing = {}; our @lost = (); +my %ignore_unused_templates = ( + map { $_ => 1 } qw(common/help_overlay.html ct/testpage.html generic/autocomplete.html oe/periodic_invoices_email.txt part/testpage.html t/render.html t/render.js) +); + my (%referenced_html_files, %locale, %htmllocale, %alllocales, %cached, %submit, %jslocale); my ($ALL_HEADER, $MISSING_HEADER, $LOST_HEADER); @@ -98,11 +100,12 @@ if ($opt_n) { unshift @menufiles, "$basedir/$menufile"; } -tie %dir_h, 'IO::Dir', $dbupdir; -my @dbplfiles = grep { /\.pl$/ } keys %dir_h; - -tie %dir_h, 'IO::Dir', $dbupdir2; -my @dbplfiles2 = grep { /\.pl$/ } keys %dir_h; +my @dbplfiles; +foreach my $sub_dir ("Pg-upgrade", "Pg-upgrade2", "Pg-upgrade2-auth") { + my $dir = "$basedir/sql/$sub_dir"; + tie %dir_h, 'IO::Dir', $dir; + push @dbplfiles, map { [ $_, $dir ] } grep { /\.pl$/ } keys %dir_h; +} # slurp the translations in if (-f "$locales_dir/all") { @@ -123,8 +126,7 @@ chomp $charset; my %old_texts = %{ $self->{texts} || {} }; handle_file(@{ $_ }) for @progfiles; -handle_file($_, $dbupdir) for @dbplfiles; -handle_file($_, $dbupdir2) for @dbplfiles2; +handle_file(@{ $_ }) for @dbplfiles; scanmenu($_) for @menufiles; for my $file_name (map({find_files($_)} @javascript_dirs)) { @@ -166,6 +168,14 @@ close($js_file); my @new_missing = grep { !$self->{texts}{$_} } sort keys %alllocales; if (@new_missing) { + if ($opt_c) { + my %existing_lc = map { (lc $_ => $_) } grep { $self->{texts}->{$_} } keys %{ $self->{texts} }; + foreach my $entry (@new_missing) { + my $other = $existing_lc{lc $entry}; + print "W: No entry for '${entry}' exists, but there is one with different case: '${other}'\n" if $other; + } + } + generate_file( file => "$locales_dir/missing", header => $MISSING_HEADER, @@ -434,8 +444,11 @@ sub scanfile { } } - my ($found) = / (?: locale->text | \b t8 ) \b .*? \(/x; - $postmatch = "$'"; + my $found; + if (/ (?: locale->text | \b t8 ) \b .*? \(/x) { + $found = 1; + $postmatch = "$'"; + } if ($found) { my $string; @@ -649,7 +662,7 @@ sub search_unused_htmlfiles { if (-d $entry) { push @unscanned_dirs, $entry; - } elsif (($entry =~ /_master.html$/) && -f $entry && !$referenced_html_files{$entry}) { + } elsif (!$ignore_unused_templates{strip_base($entry)} && -f $entry && !$referenced_html_files{$entry}) { print "W: unused HTML template: " . strip_base($entry) . "\n"; }