#!/usr/bin/perl

# Author:  pravi.a@gmail.com
# License: GPLv3+

use strict;
use warnings;
no warnings 'uninitialized';
use Fatal qw(open close);

my $translated;
my $fuzzy;
my $percentage;
my $kdebase_total=10519;
system('for i in *.po; do echo -n "$i: "; msgfmt -c --statistics $i; done >status.txt 2>&1');
open my $status, 'status.txt';
while ( <$status> ) {
	if (/(\d+) translated messages/) {
		$translated+=$1;
	}
	if (/(\d+) fuzzy translations,/) {
		$fuzzy+=$1;
	}
}
$percentage=$translated*100/$kdebase_total;
print "$translated ($percentage %) translated messages.\n";	
print "total strings in kdebase is $kdebase_total\n";
close $status;
