[otrs-cvs] otrs/bin otrs.CreateTranslationFile.pl,1.35,1.36

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/otrs/bin
In directory lancelot:/tmp/cvs-serv14314/bin

Modified Files:
	otrs.CreateTranslationFile.pl 
Log Message:
Added language translation statistics output.

Author: mg

Index: otrs.CreateTranslationFile.pl
===================================================================
RCS file: /home/cvs/otrs/bin/otrs.CreateTranslationFile.pl,v
retrieving revision 1.35
retrieving revision 1.36
diff -2 -u -d -r1.35 -r1.36
--- otrs.CreateTranslationFile.pl	22 Nov 2012 12:33:58 -0000	1.35
+++ otrs.CreateTranslationFile.pl	13 Dec 2012 14:08:45 -0000	1.36
@@ -126,4 +126,7 @@
     print "Starting...\n\n";
 
+    # Gather some statistics
+    my %Stats;
+
     for my $Language (@Languages) {
         HandleLanguage(
@@ -131,7 +134,18 @@
             Module        => $Opts{m},
             PurgeObsolete => exists $Opts{p} ? 1 : 0,
+            Stats         => \%Stats,
         );
     }
 
+    print "\n\nTranslation statistics:\n";
+    for my $Language ( sort keys %Stats ) {
+        my $Strings = scalar keys %{ $Stats{$Language} };
+        my $Translations = scalar grep {$_} values %{ $Stats{$Language} };
+        print "\t" . sprintf( "%7s", $Language ) . ": ";
+        print sprintf( "%02d", int( ( $Translations / $Strings ) * 100 ) );
+        print "% ($Translations/$Strings)\n";
+
+    }
+
     print "\n\nFinished.\n";
 }
@@ -280,4 +294,7 @@
                     my $Key = $Word;
                     $Key =~ s/'/\\'/g;
+
+                    $Param{Stats}->{$Param{Language}}->{$Word} = $Translation;
+
                     if ($Key !~ /(a href|\$(Text|Quote)\{")/i) {
                         if (length($Key) < $BreakLineAfterChars) {
@@ -302,4 +319,7 @@
                     my $Translation = $UsedWords{$Word} || '';
                     $Translation =~ s/'/\\'/g;
+
+                    $Param{Stats}->{$Param{Language}}->{$Word} = $Translation;
+
                     my $Key = $Word;
                     $Key =~ s/'/\\'/g;
@@ -349,4 +369,7 @@
         my $Translation = $UsedWords{$String} || '';
         $Translation =~ s/'/\\'/g;
+
+        $Param{Stats}->{ $Param{Language} }->{$String} = $Translation;
+
         my $Key = $String;
         $Key =~ s/'/\\'/g;
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.