Revision 9f1199c4
Von Moritz Bunkus vor fast 17 Jahren hinzugefügt
locale/de/locales.pl | ||
---|---|---|
19 | 19 |
$menufile = "menu.ini"; |
20 | 20 |
$submitsearch = qr/type\s*=\s*[\"\']?submit/i; |
21 | 21 |
|
22 |
%referenced_html_files = (); |
|
23 |
|
|
24 |
# Arguments: |
|
25 |
# -v verbose |
|
26 |
# -n no custom files |
|
27 |
# -h extended checks on HTML templates |
|
28 |
|
|
22 | 29 |
foreach $item (@ARGV) { |
23 | 30 |
$item =~ s/-//g; |
24 | 31 |
$arg{$item} = 1; |
... | ... | |
242 | 249 |
$trlanguage = $language[0]; |
243 | 250 |
chomp $trlanguage; |
244 | 251 |
|
252 |
if ($arg{h}) { |
|
253 |
search_unused_htmlfiles(); |
|
254 |
search_translated_htmlfiles_wo_master(); |
|
255 |
} |
|
256 |
|
|
245 | 257 |
$per = sprintf("%.1f", ($count - $notext) / $count * 100); |
246 | 258 |
print "\n$trlanguage - ${per}%"; |
247 | 259 |
print " - $notext missing" if $notext; |
... | ... | |
343 | 355 |
# &converthtmlfile($newfile); |
344 | 356 |
$cached{$file}{scanh}{$newfile} = 1; |
345 | 357 |
print "." if $arg{v}; |
346 |
} else {
|
|
347 |
print "W: missing HTML template: $newfile (referenced from $file)\n";
|
|
358 |
} elsif ($arg{h}) {
|
|
359 |
print "W: missing HTML template: " . strip_base($newfile) . " (referenced from " . strip_base($file) . ")\n";
|
|
348 | 360 |
} |
349 | 361 |
} |
350 | 362 |
|
... | ... | |
429 | 441 |
map { &scanfile($_, 0, $scanned_files) } keys %{$cached{$file}{scan}}; |
430 | 442 |
map { &scanfile($_, 1, $scanned_files) } keys %{$cached{$file}{scannosubs}}; |
431 | 443 |
map { &scanhtmlfile($_) } keys %{$cached{$file}{scanh}}; |
444 |
|
|
445 |
@referenced_html_files{keys %{$cached{$file}{scanh}}} = (1) x scalar keys %{$cached{$file}{scanh}}; |
|
432 | 446 |
} |
433 | 447 |
|
434 | 448 |
sub scanmenu { |
... | ... | |
574 | 588 |
close(IN); |
575 | 589 |
close(OUT); |
576 | 590 |
} |
591 |
|
|
592 |
sub search_unused_htmlfiles { |
|
593 |
my @unscanned_dirs = ('../../templates/webpages'); |
|
594 |
|
|
595 |
while (scalar @unscanned_dirs) { |
|
596 |
my $dir = shift @unscanned_dirs; |
|
597 |
|
|
598 |
foreach my $entry (<$dir/*>) { |
|
599 |
if (-d $entry) { |
|
600 |
push @unscanned_dirs, $entry; |
|
601 |
|
|
602 |
} elsif (($entry =~ /_master.html$/) && -f $entry && !$referenced_html_files{$entry}) { |
|
603 |
print "W: unused HTML template: " . strip_base($entry) . "\n"; |
|
604 |
|
|
605 |
} |
|
606 |
} |
|
607 |
} |
|
608 |
} |
|
609 |
|
|
610 |
sub search_translated_htmlfiles_wo_master { |
|
611 |
my @unscanned_dirs = ('../../templates/webpages'); |
|
612 |
|
|
613 |
while (scalar @unscanned_dirs) { |
|
614 |
my $dir = shift @unscanned_dirs; |
|
615 |
|
|
616 |
foreach my $entry (<$dir/*>) { |
|
617 |
if (-d $entry) { |
|
618 |
push @unscanned_dirs, $entry; |
|
619 |
|
|
620 |
} elsif (($entry =~ /_[a-z]+\.html$/) && ($entry !~ /_master.html$/) && -f $entry) { |
|
621 |
my $master = $entry; |
|
622 |
$master =~ s/[a-z]+\.html$/master.html/; |
|
623 |
if (! -f $master) { |
|
624 |
print "W: translated HTML template without master: " . strip_base($entry) . "\n"; |
|
625 |
} |
|
626 |
} |
|
627 |
} |
|
628 |
} |
|
629 |
} |
|
630 |
|
|
631 |
sub strip_base { |
|
632 |
$_[0] =~ s|^../../||; |
|
633 |
$_[0] =~ s|templates/webpages/||; |
|
634 |
|
|
635 |
return $_[0]; |
|
636 |
} |
Auch abrufbar als: Unified diff
1. Erweiterte HTML-Template-Checks nur durchführen, wenn Parameter "-h" angegeben wird.
2. Weitere Checks für HTML-Templates: Suche nach Master-Templates, die von keiner anderen Datei referenziert wurden und Suche nach übersetzten Templates, für die es keinen Master gibt.
3. Anzeige der Namen um unwichtige Prefixe gekürzt.