Merge branch 'requirement-specs-custom-variables'
[kivitendo-erp.git] / scripts / locales.pl
index 682efba..eb1d81b 100755 (executable)
@@ -49,7 +49,8 @@ our $missing     = {};
 our @lost        = ();
 
 my %ignore_unused_templates = (
-  map { $_ => 1 } qw(ct/testpage.html generic/autocomplete.html oe/periodic_invoices_email.txt part/testpage.html t/render.html t/render.js task_server/failure_notification_email.txt)
+  map { $_ => 1 } qw(ct/testpage.html generic/autocomplete.html oe/periodic_invoices_email.txt part/testpage.html t/render.html t/render.js task_server/failure_notification_email.txt
+                     failed_background_jobs_report/email.txt)
 );
 
 my (%referenced_html_files, %locale, %htmllocale, %alllocales, %cached, %submit, %jslocale);
@@ -387,7 +388,7 @@ sub scanfile {
     return unless (-f "$file");
 
     my $fh = new FileHandle;
-    open $fh, "$file" or die "$! : $file";
+    open $fh, '<:encoding(utf8)', $file or die "$! : $file";
 
     my ($is_submit, $line_no, $sub_line_no) = (0, 0, 0);
 
@@ -517,7 +518,7 @@ sub scanmenu {
   my $file = shift;
 
   my $fh = new FileHandle;
-  open $fh, "$file" or die "$! : $file";
+  open $fh, '<:encoding(utf8)', $file or die "$! : $file";
 
   my @a = grep m/^\[/, <$fh>;
   close($fh);
@@ -551,7 +552,7 @@ sub scanhtmlfile {
 
   my %plugins = ( 'loaded' => { }, 'needed' => { } );
 
-  if (!open(IN, $file)) {
+  if (!open(IN, '<:encoding(utf8)', $file)) {
     print "E: template file '$file' not found\n";
     return;
   }
@@ -617,9 +618,9 @@ sub scanhtmlfile {
                       \s+           # Mindestens ein Whitespace
                       [\'\"]?       # Anfang des Dateinamens
                       ([^\s]+)      # Beliebig viele Nicht-Whitespaces -- Dateiname
-                      \.html        # Endung ".html", ansonsten kann es der Name eines Blocks sein
+                      \.(html|js)   # Endung ".html" oder ".js", ansonsten kann es der Name eines Blocks sein
                      /ix) {
-      my $new_file_name = "$basedir/templates/webpages/$1.html";
+      my $new_file_name = "$basedir/templates/webpages/$1.$2";
       $cached{$file}{scanh}{$new_file_name} = 1;
       substr $line, $LAST_MATCH_START[1], $LAST_MATCH_END[0] - $LAST_MATCH_START[0], '';
     }
@@ -645,7 +646,7 @@ sub scanhtmlfile {
 sub scan_javascript_file {
   my ($file) = @_;
 
-  open(my $fh, $file) || die('can not open file: '. $file);
+  open(my $fh, '<:encoding(utf8)', $file) || die('can not open file: '. $file);
 
   while( my $line = readline($fh) ) {
     while( $line =~ m/