]> wagnertech.de Git - mfinanz.git/blobdiff - locale/de/locales.pl
Probleme durch perltidy. Der sehr pingelige Parser von locales.pl akzeptiert Begriffe...
[mfinanz.git] / locale / de / locales.pl
index a358a905ef6186bf705b7504962c5b4d6f051388..8981e5aeb0272175dce3d69d250794430361808f 100755 (executable)
@@ -218,7 +218,10 @@ sub scanfile {
   my $fh = new FileHandle;
   open $fh, "$file" or die "$! : $file";
 
+  my ($is_submit, $line_no, $sub_line_no) = (0, 0, 0);
+       
   while (<$fh>) {
+    $line_no++;
     # is this another file
     if (/require\s+\W.*\.pl/) {
       my $newfile = $&;
@@ -240,14 +243,27 @@ sub scanfile {
       if (/Locale/) {
        unless (/^use /) {
          my ($null, $country) = split /,/;
-         $country =~ s/^ +["']//;
-         $country =~ s/["'].*//;
+         $country =~ s/^ +[\"\']//;
+         $country =~ s/[\"\'].*//;
        }
       }
 
-      if (/\$locale->text.*?\W\)/) {
+      my $postmatch = "";
+      # is it a submit button before $locale->
+      if (/type\s*=\s*submit/i) {
+        $postmatch = $';
+        if ($` !~ /\$locale->text/) {
+          $is_submit = 1;
+          $sub_line_no = $line_no;
+        }
+      }
+
+      my ($found) = /\$locale->text.*?\W\)/;
+      my $postmatch = $';
+
+      if ($found) {
        my $string = $&;
-       $string =~ s/\$locale->text\(\s*['"(q|qq)]['\/\\\|~]*//;
+       $string =~ s/\$locale->text\(\s*[\'\"(q|qq)][\'\/\\\|~]*//;
        $string =~ s/\W\)+.*$//;
 
         # if there is no $ in the string record it
@@ -259,16 +275,23 @@ sub scanfile {
          $alllocales{$string} = 1;
 
           # is it a submit button before $locale->
-          if (/type=submit/) {
+          if ($is_submit) {
            $submit{$string} = 1;
           }
        }
+      } elsif ($postmatch =~ />/) {
+        $is_submit = 0;
       }
 
       # exit loop if there are no more locales on this line
-      ($rc) = ($' =~ /\$locale->text/);
+      ($rc) = ($postmatch =~ /\$locale->text/);
       # strip text
       s/^.*?\$locale->text.*?\)//;
+
+      if (($postmatch =~ />/) ||
+          (!$found && ($sub_line_no != $line_no) && />/)) {
+        $is_submit = 0;
+      }
     }
   }