Translate Toolkit & Pootle

Tools to help you make your software local

User Tools


This information is about an old Pootle version. Pootle 2.0 supports user contribution statistics so this is not needed anymore.

Here is a script that can analise a Pootle log file and print some basic statistics about the number of contributions each user has made.

#!/usr/bin/perl
#
#Create Pootle Translation Stats
#Author: Philipp Meng
#Created: 2007-07-27
#If you find some errors, please mail me: "p DOT meng AT gmx.at"
#########Config
#Inputfile (Usually the pootle logfile)
#This value will be overridden if an argument has been passed to the script
 
$inputfile = "/var/log/pootle";
 
#########End of Config
 
#Check if an Argument has been passed
#If yes => file to extract from is specfied in @ARGV
 
if (exists($ARGV[0])) {
$inputfile = $ARGV[0];
}
 
#Open Input file
open(INPUT, "<" , "$inputfile") or die "Opening input file failed";
#Read the Content into an array
my @content = <INPUT>;
 
foreach my $line (@content) {
 
if (($line =~ /translate=1/) && ($line =~ /POST/)) {
 
#Split line in cols, set delimiter to a blank space
my @cols = split(' ', $line);
 
#The columns we need are 5 and 9 - they provide all information we need: the username and the language
my $username = $cols[4];
my $language = $cols[8];
 
my @language_code = split('/', $language);
$language = $language_code[1];
 
$h{$username}{$language}++;
}
}
close(INPUT);
 
print "\nHere are the statistics:\n";
print "Username \t Language-Code \t Number translated\n";
print "==================================================\n";
foreach $k1 (keys %h) {
        foreach $k2 (keys %{$h{$k1}}) {
 
if (length($k1) >= 8) {
 
print "$k1 \t $k2 \t\t $h{$k1}{$k2} \n";
} else {
print "$k1 \t\t $k2 \t\t $h{$k1}{$k2} \n";
}
 
}
}