Mercurial > pidgin.yaz
comparison po/stats.pl @ 7202:25e78bf033be
[gaim-migrate @ 7771]
might as well stick this ugly code in cvs for all to shame me for ;-)
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Thu, 09 Oct 2003 05:57:12 +0000 |
parents | |
children | 136daef154f6 |
comparison
equal
deleted
inserted
replaced
7201:35f92559a4a1 | 7202:25e78bf033be |
---|---|
1 #!/usr/bin/perl | |
2 | |
3 # Copyright 2003 Nathan Walp <faceprint@faceprint.com> | |
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 | |
21 use Locale::Language; | |
22 | |
23 $lang{pt_BR} = "Portuguese (Brizillian)"; | |
24 $lang{pt_PT} = "Portuguese (Portugal)"; | |
25 $lang{'sr@Latn'} = "Serbian (Latin)"; | |
26 $lang{zh_CN} = "Chinese (Simplified)"; | |
27 $lang{zh_TW} = "Chinese (Traditional)"; | |
28 | |
29 opendir(DIR, ".") || die "can't open directory: $!"; | |
30 @pos = grep { /\.po$/ && -f } readdir(DIR); | |
31 foreach (@pos) { s/\.po$//; }; | |
32 closedir DIR; | |
33 | |
34 @pos = sort @pos; | |
35 | |
36 $now = `date`; | |
37 | |
38 system("./update.pl --pot > /dev/null"); | |
39 | |
40 $_ = `msgfmt --statistics gaim.pot -o /dev/null 2>&1`; | |
41 | |
42 die "unable to get total: $!" unless (/(\d+) untranslated messages/); | |
43 | |
44 $total = $1; | |
45 | |
46 print "<html>\n"; | |
47 print "<body>\n"; | |
48 print "<table cellspacing='0' cellpadding='0' border='0' bgcolor='#888888' width='100%'><tr><td><table cellspacing='1' cellpadding='2' border='0' width='100%'>\n"; | |
49 | |
50 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 style='background: yellow;'>missing</th><th style='background: yellow;'>%</th><th> </th></tr>\n"; | |
51 | |
52 foreach $index (0 .. $#pos) { | |
53 $trans = $fuzz = $untrans = 0; | |
54 $po = $pos[$index]; | |
55 $_ = `msgfmt --statistics $po -o /dev/null 2>&1`; | |
56 chomp; | |
57 if(/(\d+) translated messages/) { $trans = $1; } | |
58 if(/(\d+) fuzzy translations/) { $fuzz = $1; } | |
59 if(/(\d+) untranslated messages/) { $untrans = $1; } | |
60 $gone = $total - $trans - $fuzz - $untrans; | |
61 $gonep = 100 * $gone / $total; | |
62 $transp = 100 * $trans / $total; | |
63 $fuzzp = 100 * $fuzz / $total; | |
64 $untransp = 100 * $untrans / $total; | |
65 if($index % 2) { | |
66 $color = " bgcolor='#e0e0e0'"; | |
67 } else { | |
68 $color = " bgcolor='#d0e0ff'"; | |
69 } | |
70 $name = ""; | |
71 $name = $lang{$po}; | |
72 $name = code2language($po) unless $name ne ""; | |
73 $name = "???" unless $name ne ""; | |
74 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>%d</td><td>%0.2f</td><td><img src='bar_g.gif' height='15' width='%0.0f' /><img src='bar_b.gif' height='15' width='%0.0f' /><img src='bar_r.gif' height='15' width='%0.0f' /><img src='bar_y.gif' height='15' width='%0.0f' /></tr>\n", | |
75 $name, $po, $trans, $transp, $fuzz, $fuzzp, $untrans, $untransp, $gone, $gonep, $transp*2, $fuzzp*2, $untransp*2, $gonep*2; | |
76 } | |
77 print "</table></td></tr></table>\n"; | |
78 print "Latest gaim.pot generated $now: <a href='gaim.pot'>gaim.pot</a><br />\n"; | |
79 print "</body>\n"; | |
80 print "</html>\n"; | |
81 |