X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Flocales.pl;h=baf0dc6615fc0cdd12aa5b2ea376a2b2b6739f5d;hb=bb8964ddfc59e40b62f6e65f5dd38cea9b7323d0;hp=0c96006f460cfb04ae76d8ed08fbd10f364ef8c1;hpb=008c2e1529744e195616ac2cbf7736f06a90816e;p=kivitendo-erp.git diff --git a/scripts/locales.pl b/scripts/locales.pl index 0c96006f4..baf0dc661 100755 --- a/scripts/locales.pl +++ b/scripts/locales.pl @@ -358,17 +358,32 @@ sub scanfile { $cached{$file}{scannosubs}{"../../SL/${module}.pm"} = 1; } + # Some calls to render() are split over multiple lines. Deal + # with that. + while (/(?:parse_html_template2?|render)\s*\( *$/) { + $_ .= <$fh>; + chomp; + } + # is this a template call? if (/(?:parse_html_template2?|render)\s*\(\s*[\"\']([\w\/]+)\s*[\"\']/) { - my $newfile = "$basedir/templates/webpages/$1.html"; + my $new_file_base = "$basedir/templates/webpages/$1."; if (/parse_html_template2/) { - print "E: " . strip_base($file) . " is still using 'parse_html_template2' for " . strip_base($newfile) . ".\n"; + print "E: " . strip_base($file) . " is still using 'parse_html_template2' for " . strip_base("${new_file_base}html") . ".\n"; } - if (-f $newfile) { - $cached{$file}{scanh}{$newfile} = 1; - print "." if $opt_v; - } elsif ($opt_c) { - print "W: missing HTML template: " . strip_base($newfile) . " (referenced from " . strip_base($file) . ")\n"; + + my $found_one = 0; + foreach my $ext (qw(html js json)) { + my $new_file = "${new_file_base}${ext}"; + if (-f $new_file) { + $cached{$file}{scanh}{$new_file} = 1; + print "." if $opt_v; + $found_one = 1; + } + } + + if ($opt_c && !$found_one) { + print "W: missing HTML template: " . strip_base($new_file_base) . "{html,json,js} (referenced from " . strip_base($file) . ")\n"; } } @@ -421,7 +436,7 @@ sub scanfile { } # exit loop if there are no more locales on this line - ($rc) = ($postmatch =~ /locale->text/); + ($rc) = ($postmatch =~ /locale->text | \b t8/x); if ( ($postmatch =~ />/) || (!$found && ($sub_line_no != $line_no) && />/)) { @@ -496,9 +511,11 @@ sub scanhtmlfile { while ($line =~ m/\[\%[^\w]*(\w+)\.\w+\(/g) { my $plugin = $1; - $plugins{needed}->{$plugin} = 1 if (first { $_ eq $plugin } qw(HTML LxERP JavaScript MultiColumnIterator L)); + $plugins{needed}->{$plugin} = 1 if (first { $_ eq $plugin } qw(HTML LxERP JavaScript JSON L P)); } + $plugins{needed}->{T8} = 1 if $line =~ m/\[\%.*\|.*\$T8/; + while ($line =~ m/(?: # Start von Variante 1: LxERP.t8('...'); ohne darumliegende [% ... %]-Tags (LxERP\.t8)\( # LxERP.t8( ::Parameter $1:: ([\'\"]) # Anfang des zu übersetzenden Strings ::Parameter $2::