7202
|
1 #!/usr/bin/perl
|
|
2
|
9412
|
3 # Copyright 2003-2004 Nathan Walp <faceprint@faceprint.com>
|
7202
|
4 #
|
|
5 # This program is free software; you can redistribute it and/or modify
|
|
6 # it under the terms of the GNU General Public License as published by
|
|
7 # the Free Software Foundation; either version 2 of the License, or
|
|
8 # (at your option) any later version.
|
|
9 #
|
|
10 # This program is distributed in the hope that it will be useful,
|
|
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 # GNU General Public License for more details.
|
|
14 #
|
|
15 # You should have received a copy of the GNU General Public License
|
|
16 # along with this program; if not, write to the Free Software
|
|
17 # Foundation, Inc., 50 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
18 #
|
|
19
|
|
20
|
9413
|
21 my $PACKAGE="gaim";
|
9412
|
22
|
|
23
|
7202
|
24 use Locale::Language;
|
|
25
|
8860
|
26 $lang{en_CA} = "English (Canadian)";
|
8033
|
27 $lang{en_GB} = "English (British)";
|
7548
|
28 $lang{pt_BR} = "Portuguese (Brazilian)";
|
7202
|
29 $lang{'sr@Latn'} = "Serbian (Latin)";
|
|
30 $lang{zh_CN} = "Chinese (Simplified)";
|
|
31 $lang{zh_TW} = "Chinese (Traditional)";
|
|
32
|
|
33 opendir(DIR, ".") || die "can't open directory: $!";
|
|
34 @pos = grep { /\.po$/ && -f } readdir(DIR);
|
|
35 foreach (@pos) { s/\.po$//; };
|
|
36 closedir DIR;
|
|
37
|
|
38 @pos = sort @pos;
|
|
39
|
|
40 $now = `date`;
|
|
41
|
|
42 system("./update.pl --pot > /dev/null");
|
|
43
|
9412
|
44 $_ = `msgfmt --statistics $PACKAGE.pot -o /dev/null 2>&1`;
|
7202
|
45
|
|
46 die "unable to get total: $!" unless (/(\d+) untranslated messages/);
|
|
47
|
|
48 $total = $1;
|
|
49
|
|
50 print "<html>\n";
|
|
51 print "<body>\n";
|
|
52 print "<table cellspacing='0' cellpadding='0' border='0' bgcolor='#888888' width='100%'><tr><td><table cellspacing='1' cellpadding='2' border='0' width='100%'>\n";
|
|
53
|
8168
|
54 print"<tr bgcolor='#e0e0e0'><th>language</th><th style='background: #339933;'>trans</th><th style='background: #339933;'>%</th><th style='background: #333399;'>fuzzy</th><th style='background: #333399;'>%</th><th style='background: #dd3333;'>untrans</th><th style='background: #dd3333;'>%</th><th> </th></tr>\n";
|
7202
|
55
|
|
56 foreach $index (0 .. $#pos) {
|
|
57 $trans = $fuzz = $untrans = 0;
|
|
58 $po = $pos[$index];
|
7739
|
59 print STDERR "$po..." if($ARGV[0] eq '-v');
|
9412
|
60 system("msgmerge $po.po $PACKAGE.pot -o $po.new 2>/dev/null");
|
7739
|
61 $_ = `msgfmt --statistics $po.new -o /dev/null 2>&1`;
|
7202
|
62 chomp;
|
|
63 if(/(\d+) translated messages/) { $trans = $1; }
|
|
64 if(/(\d+) fuzzy translations/) { $fuzz = $1; }
|
|
65 if(/(\d+) untranslated messages/) { $untrans = $1; }
|
|
66 $transp = 100 * $trans / $total;
|
|
67 $fuzzp = 100 * $fuzz / $total;
|
|
68 $untransp = 100 * $untrans / $total;
|
|
69 if($index % 2) {
|
|
70 $color = " bgcolor='#e0e0e0'";
|
|
71 } else {
|
|
72 $color = " bgcolor='#d0e0ff'";
|
|
73 }
|
|
74 $name = "";
|
|
75 $name = $lang{$po};
|
|
76 $name = code2language($po) unless $name ne "";
|
|
77 $name = "???" unless $name ne "";
|
8168
|
78 printf "<tr$color><td>%s(%s.po)</td><td>%d</td><td>%0.2f</td><td>%d</td><td>%0.2f</td><td>%d</td><td>%0.2f</td><td>",
|
|
79 $name, $po, $trans, $transp, $fuzz, $fuzzp, $untrans, $untransp;
|
7243
|
80 printf "<img src='bar_g.gif' height='15' width='%0.0f' />", $transp*2
|
|
81 unless $transp*2 < 0.5;
|
|
82 printf "<img src='bar_b.gif' height='15' width='%0.0f' />", $fuzzp*2
|
|
83 unless $fuzzp*2 < 0.5;
|
|
84 printf "<img src='bar_r.gif' height='15' width='%0.0f' />", $untransp*2
|
|
85 unless $untransp*2 < 0.5;
|
|
86 print "</tr>\n";
|
7739
|
87 unlink("$po.new");
|
8060
|
88 print STDERR "done ($untrans untranslated strings).\n" if($ARGV[0] eq '-v');
|
7202
|
89 }
|
|
90 print "</table></td></tr></table>\n";
|
9412
|
91 print "Latest $PACKAGE.pot generated $now: <a href='$PACKAGE.pot'>$PACKAGE.pot</a><br />\n";
|
7202
|
92 print "</body>\n";
|
|
93 print "</html>\n";
|
|
94
|