]> git.lyx.org Git - lyx.git/blobdiff - po/pocheck.pl
Remove unused nopos_ mamber variable.
[lyx.git] / po / pocheck.pl
index c1bb63776687e850c06a7f3648e97bd529610a60..34bd08d8e1ec2ef66449e7589b7314913228d4a8 100755 (executable)
@@ -55,59 +55,66 @@ foreach $pofilename ( @ARGV )
 
         # Check colon at the end of a message
         if ( ( $msgid =~ m/: *(\|.*)?$/ ) != ( $msgstr =~ m/: *(\|.*)?$/ ) ) {
-          print( "Missing or redundant colon:\n" );
+          print( "Missing or unexpected colon:\n" );
           print( "  '$msgid' => '$msgstr'\n" );
           $warn++;
         }
 
         # Check period at the end of a message; uncomment code if you are paranoid
         #if ( ( $msgid =~ m/\. *(\|.*)?$/ ) != ( $msgstr =~ m/\. *(\|.*)?$/ ) ) {
-        #  print( "Missing or redundant period:\n" );
+        #  print( "Missing or unexpected period:\n" );
         #  print( "  '$msgid' => '$msgstr'\n" );
         #  $warn++;
         #}
 
         # Check space at the end of a message
         if ( ( $msgid =~ m/  *?(\|.*)?$/ ) != ( $msgstr =~ m/  *?(\|.*)?$/ ) ) {
-          print( "Missing or redundant space:\n" );
+          print( "Missing or unexpected space:\n" );
           print( "  '$msgid' => '$msgstr'\n" );
           $warn++;
         }
 
         # Check for "&" shortcuts
         if ( ( $msgid =~ m/&[^ ]/ ) != ( $msgstr =~ m/&[^ ]/ ) ) {
-          print( "Missing or redundant QT shortcut:\n" );
+          print( "Missing or unexpected Qt shortcut:\n" );
           print( "  '$msgid' => '$msgstr'\n" );
           $warn++;
         }
 
         # Check for "|..." shortcut(s)
         if ( ( $msgid =~ m/\|[^ ]/ ) != ( $msgstr =~ m/\|[^ ]/ ) ) {
-          print( "Missing or redundant xforms shortcut:\n" );
+          print( "Missing or unexpected xforms shortcut:\n" );
           print( "  '$msgid' => '$msgstr'\n" );
           $warn++;
         }
  
-        $msgid_clean = lc($msgid);
+        $msgid_clean  = lc($msgid);
         $msgstr_clean = lc($msgstr);
 
-        $msgid_clean =~ s/|.*?$//;
-        $msgid_clean =~ s/&([^ ])/$1/;
-        $msgstr_clean =~ s/|.*?$//;
+        $msgid_clean  =~ s/(.*)\|.*?$/$1/;  # strip xforms shortcuts
+        $msgstr_clean =~ s/(.*)\|.*?$/$1/;
+        $msgid_clean  =~ s/&([^ ])/$1/;     # strip Qt shortcuts
         $msgstr_clean =~ s/&([^ ])/$1/; 
 
-        if ( defined( $trans{$msgid_clean} ) && $msgstr_clean ne $trans{$msgid_clean}{'msgstr_clean'} ) {
-          print( "Different translations for '$msgid_clean':\n" );
-          print( "  '$msgid' => '$msgstr'\n" );
-          print( "  '$trans{$msgid_clean}{'msgid'}' => '$trans{$msgid_clean}{'msgstr'}'\n" );
-          $warn++;
-        } else {
-          $trans{$msgid_clean} = { 'msgid' => $msgid, 'msgstr' => $msgstr, 'msgstr_clean' => $msgstr_clean };
-        }
+        $trans{$msgid_clean}{$msgstr_clean} = [ $msgid, $msgstr ];
       }
     } else {
       $i++;
     }
   }
+
+  foreach $msgid ( keys %trans ) {
+    $ref = $trans{$msgid};
+    @msgstrkeys = keys %$ref;
+
+    if ( $#msgstrkeys > 0 ) {
+      print( "Different translations for '$msgid':\n" );
+      foreach $msgstr ( @msgstrkeys ) {
+        print( "  '" . $trans{$msgid}{$msgstr}[0] . "' => '" . $trans{$msgid}{$msgstr}[1] . "'\n" );
+      }
+      $warn++;
+    }
+  }
+
   print( "\nTotal number of warnings: $warn\n\n" );
 }