Add debug information to check the completeness of the translation. re #37

This commit is contained in:
Sébastien Lucas 2013-09-30 11:53:46 +02:00
parent 8f2b53f336
commit 4ad1cd693b

View file

@ -60,6 +60,8 @@ sub handleLanguageFile {
my ($file) = @_; my ($file) = @_;
(my $lang = $file) =~ s/Localization_(\w\w)\.json/$1/; (my $lang = $file) =~ s/Localization_(\w\w)\.json/$1/;
my $file = "../lang/" . $file; my $file = "../lang/" . $file;
my $total = 0;
my $translated = 0;
debug ("language file: $file / $lang \n"); debug ("language file: $file / $lang \n");
@ -80,12 +82,16 @@ sub handleLanguageFile {
print OUTPUT "{\n"; print OUTPUT "{\n";
foreach my $name (@strings) { foreach my $name (@strings) {
$total++ if ($name !~ /^languages\.\w{3}$/);
if (not exists ($values{$lang}{$name})) { if (not exists ($values{$lang}{$name})) {
print OUTPUT "\"##TODO##$name\":\"$values{en}{$name}\",\n"; print OUTPUT "\"##TODO##$name\":\"$values{en}{$name}\",\n";
} else { } else {
$translated++ if ($name !~ /^languages\.\w{3}$/);
print OUTPUT "\"$name\":\"$values{$lang}{$name}\",\n"; print OUTPUT "\"$name\":\"$values{$lang}{$name}\",\n";
} }
} }
my $percentage = ($translated * 100) / $total;
debug (" $translated / $total ($percentage %) \n");
print OUTPUT "\"DO_NOT_TRANSLATE\":\"end\"\n"; print OUTPUT "\"DO_NOT_TRANSLATE\":\"end\"\n";
print OUTPUT "}\n"; print OUTPUT "}\n";