From c53853cf426224437612e916e8cc33aa07bb7520 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Thu, 25 Oct 2018 15:04:46 +0200 Subject: [PATCH] Bug 15395: Do not process template files that do not use i18n.inc It should make the string extraction process a little faster For the record, I timed some parts of the process to see why it was so slow, and without surprises the most time-consuming task is the Perl code analysis by PPI with an average time of 50ms by "template block" on my machine. Multiply that by the number of template blocks (approximatively 900), that gives us 45 seconds just for this task. --- misc/translator/LangInstaller.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/misc/translator/LangInstaller.pm b/misc/translator/LangInstaller.pm index deff3abf2d..b8a6ee64ae 100644 --- a/misc/translator/LangInstaller.pm +++ b/misc/translator/LangInstaller.pm @@ -527,6 +527,10 @@ sub extract_messages_from_templates { foreach my $file (@files) { say "Extract messages from $file" if $self->{verbose}; my $template = read_file("$intranetdir/$file"); + + # No need to process a file that doesn't use the i18n.inc file. + next unless $template =~ /i18n\.inc/; + my $data = $parser->parse($template); unless ($data) { warn "Error at $file : " . $parser->error(); -- 2.17.1