annotate po/stats.pl @ 8986:8cf32769ba1b

[gaim-migrate @ 9761] " This patch adds a Plugin Actions menu item after the Account Actions menu. The Plugin Actions menu is populated from the added 'actions' slot in GaimPluginInfo. As a demonstration, the Idle Maker plugin has been converted to no longer require GTK code and the Preferences interface just to perform its actions. Instead, it uses a Plugin Action to spawn a Fields Request. There's also a minor fix for consistency in the menu building for buddy actions. The pre-existing method for instructing a menu list to display a separator was to insert a NULL rather than a proto_buddy_menu into the GList of actions. The code for the buddy menus was instead checking for a proto_buddy_menu with a '-' label. This has been fixed, and it now correctly uses NULL to indicate a separator." "Date: 2004-05-16 02:25 Sender: taliesein Logged In: YES user_id=77326 I need to add a callback to this patch to watch for loading/unloading of plugins (to determine when to rebuild the menu). Since the appropriate way to handle Plugin Actions is still mildly up for debate, I'm holding of on correcting the patch until I know for sure whether I should fix this patch, or scrap it and write a new one using a different method." "Date: 2004-05-18 12:26 Sender: taliesein Logged In: YES user_id=77326 I've completed changes to this patch to also add plugin load and unload signals (it looks like plugin.c actually had pre-signal callbacks in place, but they were never used or converted to signals) This patch now will correctly update the Plugin Action menu as plugins load and unload." I'm not entirely sure i like the ui of a plugins actions menu, but i think that having some way for plugins to add actions on an account is a good thing, and i'm not sure that every viable action fits under the accounts actions menu. we may want to merge the two (the existing accounts actions and this plugins actions), but both times it came up in #gaim no one seemed to want to comment, and on one commented to the gaim-devel post either. committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Thu, 20 May 2004 05:11:44 +0000
parents a11807af171e
children 3cabcdc36a73
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
8860
a11807af171e [gaim-migrate @ 9628]
Luke Schierer <lschiere@pidgin.im>
parents: 8168
diff changeset
23 $lang{en_CA} = "English (Canadian)";
8033
c417617ae0cf [gaim-migrate @ 8713]
Nathan Walp <nwalp@pidgin.im>
parents: 7739
diff changeset
24 $lang{en_GB} = "English (British)";
7548
4c75a6bbe5df [gaim-migrate @ 8162]
Nathan Walp <nwalp@pidgin.im>
parents: 7544
diff changeset
25 $lang{pt_BR} = "Portuguese (Brazilian)";
7202
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
26 $lang{'sr@Latn'} = "Serbian (Latin)";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
27 $lang{zh_CN} = "Chinese (Simplified)";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
28 $lang{zh_TW} = "Chinese (Traditional)";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
29
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
30 opendir(DIR, ".") || die "can't open directory: $!";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
31 @pos = grep { /\.po$/ && -f } readdir(DIR);
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
32 foreach (@pos) { s/\.po$//; };
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
33 closedir DIR;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
34
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
35 @pos = sort @pos;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
36
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
37 $now = `date`;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
38
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
39 system("./update.pl --pot > /dev/null");
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
40
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
41 $_ = `msgfmt --statistics gaim.pot -o /dev/null 2>&1`;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
42
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
43 die "unable to get total: $!" unless (/(\d+) untranslated messages/);
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
44
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
45 $total = $1;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
46
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
47 print "<html>\n";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
48 print "<body>\n";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
49 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
50
8168
3d3c2dd28068 [gaim-migrate @ 8881]
Nathan Walp <nwalp@pidgin.im>
parents: 8060
diff changeset
51 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>&nbsp;</th></tr>\n";
7202
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
52
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
53 foreach $index (0 .. $#pos) {
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
54 $trans = $fuzz = $untrans = 0;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
55 $po = $pos[$index];
7739
2850079ad35f [gaim-migrate @ 8384]
Nathan Walp <nwalp@pidgin.im>
parents: 7548
diff changeset
56 print STDERR "$po..." if($ARGV[0] eq '-v');
2850079ad35f [gaim-migrate @ 8384]
Nathan Walp <nwalp@pidgin.im>
parents: 7548
diff changeset
57 system("msgmerge $po.po gaim.pot -o $po.new 2>/dev/null");
2850079ad35f [gaim-migrate @ 8384]
Nathan Walp <nwalp@pidgin.im>
parents: 7548
diff changeset
58 $_ = `msgfmt --statistics $po.new -o /dev/null 2>&1`;
7202
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
59 chomp;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
60 if(/(\d+) translated messages/) { $trans = $1; }
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
61 if(/(\d+) fuzzy translations/) { $fuzz = $1; }
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
62 if(/(\d+) untranslated messages/) { $untrans = $1; }
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
63 $transp = 100 * $trans / $total;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
64 $fuzzp = 100 * $fuzz / $total;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
65 $untransp = 100 * $untrans / $total;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
66 if($index % 2) {
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
67 $color = " bgcolor='#e0e0e0'";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
68 } else {
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
69 $color = " bgcolor='#d0e0ff'";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
70 }
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
71 $name = "";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
72 $name = $lang{$po};
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
73 $name = code2language($po) unless $name ne "";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
74 $name = "???" unless $name ne "";
8168
3d3c2dd28068 [gaim-migrate @ 8881]
Nathan Walp <nwalp@pidgin.im>
parents: 8060
diff changeset
75 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>",
3d3c2dd28068 [gaim-migrate @ 8881]
Nathan Walp <nwalp@pidgin.im>
parents: 8060
diff changeset
76 $name, $po, $trans, $transp, $fuzz, $fuzzp, $untrans, $untransp;
7243
136daef154f6 [gaim-migrate @ 7820]
Nathan Walp <nwalp@pidgin.im>
parents: 7202
diff changeset
77 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
78 unless $transp*2 < 0.5;
136daef154f6 [gaim-migrate @ 7820]
Nathan Walp <nwalp@pidgin.im>
parents: 7202
diff changeset
79 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
80 unless $fuzzp*2 < 0.5;
136daef154f6 [gaim-migrate @ 7820]
Nathan Walp <nwalp@pidgin.im>
parents: 7202
diff changeset
81 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
82 unless $untransp*2 < 0.5;
136daef154f6 [gaim-migrate @ 7820]
Nathan Walp <nwalp@pidgin.im>
parents: 7202
diff changeset
83 print "</tr>\n";
7739
2850079ad35f [gaim-migrate @ 8384]
Nathan Walp <nwalp@pidgin.im>
parents: 7548
diff changeset
84 unlink("$po.new");
8060
b66733e6e6f2 [gaim-migrate @ 8747]
Nathan Walp <nwalp@pidgin.im>
parents: 8033
diff changeset
85 print STDERR "done ($untrans untranslated strings).\n" if($ARGV[0] eq '-v');
7202
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
86 }
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
87 print "</table></td></tr></table>\n";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
88 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
89 print "</body>\n";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
90 print "</html>\n";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
91