123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- %langname = (
- 'bg.po' => 'Bulgarian',
- 'cs.po' => 'Czech',
- 'de.po' => 'German',
- 'en_GB.po' => 'British English',
- 'es.po' => 'Spanish',
- 'fi.po' => 'Finnish',
- 'fr.po' => 'French',
- 'hu.po' => 'Hungarian',
- 'id_ID.po' => 'Indonesian',
- 'lt.po' => 'Lithuanian',
- 'pt_BR.po' => 'Brazilian Portuguese',
- 'ru.po' => 'Russian',
- 'sk.po' => 'Slovak',
- 'sv.po' => 'Swedish',
- 'zh_CN.po' => 'Simplified Chinese',
- 'zh_TW.po' => 'Traditional Chinese',
- );
- %lasttranslator = (
- 'bg.po' => 'Yasen Pramatarov <yasen@lindeas.com>',
- 'cs.po' => 'David Vachulka <david@konstrukce-cad.com>',
- 'de.po' => 'Thomas Bellmann <ThomasBellmann@gmx.net>',
- 'en_GB.po' => 'Paul Mangan <paul@claws-mail.org>',
- 'es.po' => 'Ricardo Mones Lastra <ricardo@mones.org>',
- 'fi.po' => 'Flammie Pirinen <flammie@iki.fi>',
- 'fr.po' => 'Tristan Chabredier <wwp@claws-mail.org>',
- 'hu.po' => 'Páder Rezső <rezso@rezso.net>',
- 'id_ID.po' => 'MSulchan Darmawan <bleketux@gmail.com>',
- 'lt.po' => 'Mindaugas Baranauskas <embar@super.lt>',
- 'pt_BR.po' => 'Frederico Goncalves Guimaraes <fggdebian@yahoo.com.br>',
- 'ru.po' => 'Aleksei Miheev <aleksei@miheev.info>',
- 'sk.po' => 'Slavko <slavino@slavino.sk>',
- 'sv.po' => 'Andreas Rönnquist <gusnan@gusnan.se>',
- 'zh_CN.po' => 'Rob <rbnwmk@gmail.com>',
- 'zh_TW.po' => 'Rob <rbnwmk@gmail.com>',
- );
- %barcolornorm = (
- default => 'white',
- partially => 'lightblue',
- completed => 'blue',
- );
- %barcoloraged = (
- default => 'white',
- partially => 'lightgrey',
- completed => 'grey',
- );
- %barcolorcheat = (
- default => 'white',
- partially => 'yellow',
- completed => 'red',
- );
- $barwidth = 500;
- $barheight = 12;
- $transolddays = 120;
- $transoldmonths = $transolddays / 30;
- $transneedthresold = 0.75;
- $msgfmt = '/usr/bin/msgfmt';
- $averagestr = 'Project average';
- $contactaddress = 'translations@thewildbeast.co.uk';
- sub get_current_date {
- $date = `date --utc`;
- chop $date;
- $date =~ /(\S+)(\s+)(\S+)(\s+)(\S+)(\s+)(\S+)(\D+)(\d+)/;
- $datetimenow = "$5-$3-$9 at $7"."$8";
- }
- sub get_trans_age {
- my ($y, $m, $d) = @_;
- return ($y * 365) + ($m * 31) + $d;
- }
- ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime(time);
- $year += 1900;
- $mon++;
- $cage = get_trans_age($year,$mon,$mday);
- sub print_lang {
- my ($lang, $person, $trans, $fuzzy, $untrans, $tage, $oddeven) = @_;
- $total = $trans + $fuzzy + $untrans;
- if ($tage == 0) { $tage = $cage; }
- print STDERR $cage, " ", $tage, "\n";
- if (($cage - $tage) < 0) {
- $barcolor = \%barcolorcheat;
- } else {
- $barcolor = (($cage - $tage) > $transolddays)? \%barcoloraged : \%barcolornorm ;
- }
- $_ = $person;
- if (/(.+)\s+\<(.+)\>/) { $pname = $1; $pemail = $2; } else { $pname = $pemail = $contactaddress; }
- print "<tr";
- if ($oddeven > 0) { print " bgcolor=#EFEFEF"; }
- print ">\n<td>\n";
- if ($lang eq $averagestr) {
- print "<b>$lang</b>";
- } else {
- print "<a href=\"mailto:%22$pname%22%20<$pemail>\">$lang</a>";
- }
- print "</td>\n";
- print "<td>\n<table style='border: solid 1px black; width: $barwidth' border='0' cellspacing='0' cellpadding='0'><tr>\n";
- $barlen = ($trans / $total) * $barwidth;
- print "<td style='width:$barlen", "px; height:$barheight", "px;' bgcolor=\"$$barcolor{completed}\"></td>\n";
- $barlen2 = ($fuzzy / $total) * $barwidth;
- print "<td style='width:$barlen2", "px' bgcolor=\"$$barcolor{partially}\"></td>\n";
- $barlen3 = $barwidth - $barlen2 - $barlen;
- print "<td style='width:$barlen3", "px' bgcolor=\"$$barcolor{default}\"></td>\n";
- print "</tr>\n</table>\n</td>\n\n<td style='text-align: right'>", int(($trans / $total) * 10000) / 100, "%</td>\n";
- $transtatus = (($trans / $total) < $transneedthresold)? '<font size="+1" color="red"> * </font>': '';
- print "<td>$transtatus</td>\n</tr>\n";
- }
- sub tens {
- my ($i) = @_;
- return (($i > 9)? "$i" : "0$i");
- }
- get_current_date();
- $_ = `head -1 ../ChangeLog`;
- if (/\S+\s+\S+\s+(\S+)/) { $genversion = $1; } else { $genversion = 'Unknown'; }
- $numlang = keys(%langname);
- print qq ~<div class=indent>
- <b>Translation Status (on $datetimenow for $genversion)</b>
- <div class=indent>
- <table cellspacing=0 cellpadding=2>~;
- # table header
- print qq ~<tr bgcolor=#cccccc>
- <th align=left>Language</th>
- <th>Translated|Fuzzy|Untranslated</th>
- <th>Percent</th>
- <th></th>
- </tr>~;
- opendir(PODIR, ".") || die("Error: can't open current directory\n");
- push(@pofiles,(readdir(PODIR)));
- closedir(PODIR);
- @sorted_pofiles = sort(@pofiles);
- $alang = $atran = $afuzz = $auntr = $oddeven = 0;
- foreach $pofile (@sorted_pofiles) {
- $_ = $pofile;
- if (/.+\.po$/ && defined($langname{$pofile}) ) {
- print STDERR "Processing $_\n";
- ++$alang;
- $transage = $tran = $fuzz = $untr = 0;
- $_ = `$msgfmt -c --statistics -o /dev/null $pofile 2>&1`;
- if (/([0-9]+)\s+translated/) {
- $tran = $1;
- }
- if (/([0-9]+)\s+fuzzy/) {
- $fuzz = $1;
- }
- if (/([0-9]+)\s+untranslated/) {
- $untr = $1;
- }
-
- $atran += $tran;
- $afuzz += $fuzz;
- $auntr += $untr;
- if ($pofile eq "en_GB.po") {
- $tran = $tran+$fuzz;
- $untr = "0";
- $fuzz = "0";
- $transage = $cage;
- } else {
- $_ = `grep 'PO-Revision-Date:' $pofile | cut -f2 -d:`;
- if (/\s+(\d+)\-(\d+)\-(\d+)/) {
- $transage = get_trans_age($1,$2,$3);
- }
- }
- print_lang($langname{$pofile},$lasttranslator{$pofile},$tran,$fuzz,$untr,$transage, $oddeven);
- if ($oddeven == 1) { $oddeven = 0 } else { $oddeven++; }
- }
- }
- print "<tr>\n<td colspan=3 height=8></td>\n<tr>";
- print_lang($averagestr,'',$atran,$afuzz,$auntr,0,0);
-
- print "</table>\n";
- print qq ~<p>
- Languages marked with <font size="+1" color="red"> *</font>
- really need your help to be completed.
- <p>
- The ones with grey bars are <i>probably unmaintained</i> because
- translation is more than $transoldmonths months old, anyway, trying
- to contact current translator first is usually a good idea before
- submitting an updated one.<p><b>NOTE</b>: if you are the translator
- of one of them and don't want to see your language bar in grey you
- should manually update the <tt>PO-Revision-Date</tt> field in the .po
- file header (or, alternatively, use a tool which does it for you).
- <br>
- </div>
- </div>~;
|