annotate po/stats.pl @ 7243:136daef154f6

[gaim-migrate @ 7820] adding images of width 0 just didn't sit right with me committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Mon, 13 Oct 2003 00:10:43 +0000
parents 25e78bf033be
children 565b5bca5e8a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7202
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
1 #!/usr/bin/perl
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
2
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
3 # Copyright 2003 Nathan Walp <faceprint@faceprint.com>
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
4 #
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
5 # This program is free software; you can redistribute it and/or modify
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
6 # it under the terms of the GNU General Public License as published by
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
7 # the Free Software Foundation; either version 2 of the License, or
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
8 # (at your option) any later version.
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
9 #
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
10 # This program is distributed in the hope that it will be useful,
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
13 # GNU General Public License for more details.
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
14 #
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
15 # You should have received a copy of the GNU General Public License
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
16 # along with this program; if not, write to the Free Software
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
17 # Foundation, Inc., 50 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
18 #
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
19
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
20
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
21 use Locale::Language;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
22
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
23 $lang{pt_BR} = "Portuguese (Brizillian)";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
24 $lang{pt_PT} = "Portuguese (Portugal)";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
25 $lang{'sr@Latn'} = "Serbian (Latin)";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
26 $lang{zh_CN} = "Chinese (Simplified)";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
27 $lang{zh_TW} = "Chinese (Traditional)";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
28
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
29 opendir(DIR, ".") || die "can't open directory: $!";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
30 @pos = grep { /\.po$/ && -f } readdir(DIR);
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
31 foreach (@pos) { s/\.po$//; };
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
32 closedir DIR;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
33
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
34 @pos = sort @pos;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
35
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
36 $now = `date`;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
37
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
38 system("./update.pl --pot > /dev/null");
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
39
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
40 $_ = `msgfmt --statistics gaim.pot -o /dev/null 2>&1`;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
41
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
42 die "unable to get total: $!" unless (/(\d+) untranslated messages/);
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
43
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
44 $total = $1;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
45
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
46 print "<html>\n";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
47 print "<body>\n";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
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";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
49
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
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>&nbsp;</th></tr>\n";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
51
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
52 foreach $index (0 .. $#pos) {
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
53 $trans = $fuzz = $untrans = 0;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
54 $po = $pos[$index];
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
55 $_ = `msgfmt --statistics $po -o /dev/null 2>&1`;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
56 chomp;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
57 if(/(\d+) translated messages/) { $trans = $1; }
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
58 if(/(\d+) fuzzy translations/) { $fuzz = $1; }
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
59 if(/(\d+) untranslated messages/) { $untrans = $1; }
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
60 $gone = $total - $trans - $fuzz - $untrans;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
61 $gonep = 100 * $gone / $total;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
62 $transp = 100 * $trans / $total;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
63 $fuzzp = 100 * $fuzz / $total;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
64 $untransp = 100 * $untrans / $total;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
65 if($index % 2) {
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
66 $color = " bgcolor='#e0e0e0'";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
67 } else {
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
68 $color = " bgcolor='#d0e0ff'";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
69 }
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
70 $name = "";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
71 $name = $lang{$po};
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
72 $name = code2language($po) unless $name ne "";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
73 $name = "???" unless $name ne "";
7243
136daef154f6 [gaim-migrate @ 7820]
Nathan Walp <nwalp@pidgin.im>
parents: 7202
diff changeset
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>",
136daef154f6 [gaim-migrate @ 7820]
Nathan Walp <nwalp@pidgin.im>
parents: 7202
diff changeset
75 $name, $po, $trans, $transp, $fuzz, $fuzzp, $untrans, $untransp, $gone, $gonep;
136daef154f6 [gaim-migrate @ 7820]
Nathan Walp <nwalp@pidgin.im>
parents: 7202
diff changeset
76 printf "<img src='bar_g.gif' height='15' width='%0.0f' />", $transp*2
136daef154f6 [gaim-migrate @ 7820]
Nathan Walp <nwalp@pidgin.im>
parents: 7202
diff changeset
77 unless $transp*2 < 0.5;
136daef154f6 [gaim-migrate @ 7820]
Nathan Walp <nwalp@pidgin.im>
parents: 7202
diff changeset
78 printf "<img src='bar_b.gif' height='15' width='%0.0f' />", $fuzzp*2
136daef154f6 [gaim-migrate @ 7820]
Nathan Walp <nwalp@pidgin.im>
parents: 7202
diff changeset
79 unless $fuzzp*2 < 0.5;
136daef154f6 [gaim-migrate @ 7820]
Nathan Walp <nwalp@pidgin.im>
parents: 7202
diff changeset
80 printf "<img src='bar_r.gif' height='15' width='%0.0f' />", $untransp*2
136daef154f6 [gaim-migrate @ 7820]
Nathan Walp <nwalp@pidgin.im>
parents: 7202
diff changeset
81 unless $untransp*2 < 0.5;
136daef154f6 [gaim-migrate @ 7820]
Nathan Walp <nwalp@pidgin.im>
parents: 7202
diff changeset
82 printf "<img src='bar_y.gif' height='15' width='%0.0f' />", $gonep*2
136daef154f6 [gaim-migrate @ 7820]
Nathan Walp <nwalp@pidgin.im>
parents: 7202
diff changeset
83 unless $gonep*2 < 0.5;
136daef154f6 [gaim-migrate @ 7820]
Nathan Walp <nwalp@pidgin.im>
parents: 7202
diff changeset
84 print "</tr>\n";
7202
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
85 }
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
86 print "</table></td></tr></table>\n";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
87 print "Latest gaim.pot generated $now: <a href='gaim.pot'>gaim.pot</a><br />\n";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
88 print "</body>\n";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
89 print "</html>\n";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
90