annotate po/stats.pl @ 32151:b1cceb8699fa

Let's do a quick bugfix release on Thursday. I have a patch pending that will add API, which is why I bumped the version to 2.9.0. Also, I'll need to cut tarballs Tuesday night, so please have all changes checked in by then. Please avoid string changes, and please only commit critical bug fixes!
author Mark Doliner <mark@kingant.net>
date Mon, 20 Jun 2011 05:37:11 +0000
parents 6caa1318af63
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22015
72f90ea7ae34 Don't assume perl is at /usr/bin/perl, use /usr/bin/env instead. This is not
Richard Laager <rlaager@wiktel.com>
parents: 20738
diff changeset
1 #!/usr/bin/env perl
7202
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
2
11466
eaa10266cd96 [gaim-migrate @ 13706]
Nathan Walp <nwalp@pidgin.im>
parents: 11361
diff changeset
3 # Copyright 2003-2005 Nathan Walp <faceprint@faceprint.com>
7202
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
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 17836
diff changeset
17 # Foundation, Inc., 50 Temple Place, Suite 330, Boston, MA 02111-1301 USA
7202
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
11466
eaa10266cd96 [gaim-migrate @ 13706]
Nathan Walp <nwalp@pidgin.im>
parents: 11361
diff changeset
20 use POSIX qw(strftime);
eaa10266cd96 [gaim-migrate @ 13706]
Nathan Walp <nwalp@pidgin.im>
parents: 11361
diff changeset
21
7202
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
22
15768
ed29bd084eb5 l10n updates
Nathan Walp <nwalp@pidgin.im>
parents: 13799
diff changeset
23 my $PACKAGE="pidgin";
9412
3cabcdc36a73 [gaim-migrate @ 10227]
Nathan Walp <nwalp@pidgin.im>
parents: 8860
diff changeset
24
3cabcdc36a73 [gaim-migrate @ 10227]
Nathan Walp <nwalp@pidgin.im>
parents: 8860
diff changeset
25
7202
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
26 use Locale::Language;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
27
13799
c9ce13a3d934 [gaim-migrate @ 16212]
Nathan Walp <nwalp@pidgin.im>
parents: 13185
diff changeset
28 $lang{'ca@valencia'} = "Catalan (Valencian)";
20235
6d15c55ef3cd applied changes from f6deeedd3d31f0863466fff4c81816aee12122a6
Richard Laager <rlaager@wiktel.com>
parents: 20234
diff changeset
29 $lang{'be@latin'} = "Belarusian (Latin)";
31077
1d5f8e977b54 I just noticed I didn't differentiate bn_IN from bn when I added this translation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31055
diff changeset
30 $lang{bn_IN} = "Bengali-India";
10058
514768e1db90 [gaim-migrate @ 11025]
Nathan Walp <nwalp@pidgin.im>
parents: 9765
diff changeset
31 $lang{en_AU} = "English (Australian)";
8860
a11807af171e [gaim-migrate @ 9628]
Luke Schierer <lschiere@pidgin.im>
parents: 8168
diff changeset
32 $lang{en_CA} = "English (Canadian)";
8033
c417617ae0cf [gaim-migrate @ 8713]
Nathan Walp <nwalp@pidgin.im>
parents: 7739
diff changeset
33 $lang{en_GB} = "English (British)";
31055
96f07cef738d Stu says adding this will make the l10n page show the language name for the code mai.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29016
diff changeset
34 $lang{mai} = "Maithili";
31522
6caa1318af63 Include the name for 'Meadow Mari' in the stats script so the page shows it.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31077
diff changeset
35 $lang{mhr} = "Meadow Mari";
29016
f5e31099a351 Added Malay translation from Muhammad Najmi bin Ahmad Zabidi. Closes #10578.
Paul Aurich <paul@darkrain42.org>
parents: 24169
diff changeset
36 $lang{ms_MY} = "Malay";
11472
6aa833b18a05 [gaim-migrate @ 13713]
Nathan Walp <nwalp@pidgin.im>
parents: 11466
diff changeset
37 $lang{my_MM} = "Burmese (Myanmar)";
7548
4c75a6bbe5df [gaim-migrate @ 8162]
Nathan Walp <nwalp@pidgin.im>
parents: 7544
diff changeset
38 $lang{pt_BR} = "Portuguese (Brazilian)";
20738
54fa708ba54f sr@Latn changed to sr@latin
Luke Schierer <lschiere@pidgin.im>
parents: 20237
diff changeset
39 $lang{'sr@latin'} = "Serbian (Latin)";
7202
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
40 $lang{zh_CN} = "Chinese (Simplified)";
17836
ae3c3de19ba8 Teach stats.pl about zh_HK
Stu Tomlinson <stu@nosnilmot.com>
parents: 15768
diff changeset
41 $lang{zh_HK} = "Chinese (Hong Kong)";
7202
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
42 $lang{zh_TW} = "Chinese (Traditional)";
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 opendir(DIR, ".") || die "can't open directory: $!";
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
45 @pos = grep { /\.po$/ && -f } readdir(DIR);
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
46 foreach (@pos) { s/\.po$//; };
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
47 closedir DIR;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
48
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
49 @pos = sort @pos;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
50
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
51 $now = `date`;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
52
13185
87d9db90bf6e [gaim-migrate @ 15548]
Richard Laager <rlaager@wiktel.com>
parents: 11472
diff changeset
53 system("intltool-update --pot > /dev/null");
7202
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
54
9412
3cabcdc36a73 [gaim-migrate @ 10227]
Nathan Walp <nwalp@pidgin.im>
parents: 8860
diff changeset
55 $_ = `msgfmt --statistics $PACKAGE.pot -o /dev/null 2>&1`;
7202
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
56
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
57 die "unable to get total: $!" unless (/(\d+) untranslated messages/);
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
58
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
59 $total = $1;
11466
eaa10266cd96 [gaim-migrate @ 13706]
Nathan Walp <nwalp@pidgin.im>
parents: 11361
diff changeset
60 $generated = strftime "%Y-%m-%d %H:%M:%S", gmtime;
7202
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
61
11361
e4868370c433 [gaim-migrate @ 13585]
Nathan Walp <nwalp@pidgin.im>
parents: 10058
diff changeset
62 print "<?xml version='1.0'?>\n";
e4868370c433 [gaim-migrate @ 13585]
Nathan Walp <nwalp@pidgin.im>
parents: 10058
diff changeset
63 print "<?xml-stylesheet type='text/xsl' href='l10n.xsl'?>\n";
11466
eaa10266cd96 [gaim-migrate @ 13706]
Nathan Walp <nwalp@pidgin.im>
parents: 11361
diff changeset
64 print "<project version='1.0' xmlns:l10n='http://faceprint.com/code/l10n' name='$PACKAGE' pofile='$PACKAGE.pot' strings='$total' generated='$generated'>\n";
7202
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
65
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
66 foreach $index (0 .. $#pos) {
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
67 $trans = $fuzz = $untrans = 0;
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
68 $po = $pos[$index];
7739
2850079ad35f [gaim-migrate @ 8384]
Nathan Walp <nwalp@pidgin.im>
parents: 7548
diff changeset
69 print STDERR "$po..." if($ARGV[0] eq '-v');
24169
f79b6c9b82a5 Pass --no-location to msgmerge when generating the stats at
Mark Doliner <mark@kingant.net>
parents: 22015
diff changeset
70 system("msgmerge --no-location -U $po.po $PACKAGE.pot 2>/dev/null");
20234
a02994afdb43 applied changes from 4dd446ee59f869036e9065d0f45270444f319f1d
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
71 if (($? & 127) == 2) {
a02994afdb43 applied changes from 4dd446ee59f869036e9065d0f45270444f319f1d
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
72 printf STDERR "Caught keyboard interrupt--exiting\n";
a02994afdb43 applied changes from 4dd446ee59f869036e9065d0f45270444f319f1d
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
73 exit
a02994afdb43 applied changes from 4dd446ee59f869036e9065d0f45270444f319f1d
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
74 }
20237
b1d14929fda1 applied changes from 71a27720e49364f4f24fc09309442fc3a2c17bc9
Richard Laager <rlaager@wiktel.com>
parents: 20235
diff changeset
75 $_ = `msgfmt --statistics $po -o /dev/null 2>&1`;
7202
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
76 chomp;
9765
5130709f3066 [gaim-migrate @ 10633]
Mark Doliner <mark@kingant.net>
parents: 9413
diff changeset
77 if(/(\d+) translated message/) { $trans = $1; }
5130709f3066 [gaim-migrate @ 10633]
Mark Doliner <mark@kingant.net>
parents: 9413
diff changeset
78 if(/(\d+) fuzzy translation/) { $fuzz = $1; }
5130709f3066 [gaim-migrate @ 10633]
Mark Doliner <mark@kingant.net>
parents: 9413
diff changeset
79 if(/(\d+) untranslated message/) { $untrans = $1; }
11361
e4868370c433 [gaim-migrate @ 13585]
Nathan Walp <nwalp@pidgin.im>
parents: 10058
diff changeset
80
11472
6aa833b18a05 [gaim-migrate @ 13713]
Nathan Walp <nwalp@pidgin.im>
parents: 11466
diff changeset
81 $name = "";
6aa833b18a05 [gaim-migrate @ 13713]
Nathan Walp <nwalp@pidgin.im>
parents: 11466
diff changeset
82 $name = $lang{$po};
6aa833b18a05 [gaim-migrate @ 13713]
Nathan Walp <nwalp@pidgin.im>
parents: 11466
diff changeset
83 $name = code2language($po) unless $name ne "";
6aa833b18a05 [gaim-migrate @ 13713]
Nathan Walp <nwalp@pidgin.im>
parents: 11466
diff changeset
84 $name = "???" unless $name ne "";
6aa833b18a05 [gaim-migrate @ 13713]
Nathan Walp <nwalp@pidgin.im>
parents: 11466
diff changeset
85
6aa833b18a05 [gaim-migrate @ 13713]
Nathan Walp <nwalp@pidgin.im>
parents: 11466
diff changeset
86 print "<lang code='$po' name='$name' translated='$trans' fuzzy='$fuzz' />\n";
8060
b66733e6e6f2 [gaim-migrate @ 8747]
Nathan Walp <nwalp@pidgin.im>
parents: 8033
diff changeset
87 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
88 }
25e78bf033be [gaim-migrate @ 7771]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
89
11361
e4868370c433 [gaim-migrate @ 13585]
Nathan Walp <nwalp@pidgin.im>
parents: 10058
diff changeset
90 print "</project>\n";
e4868370c433 [gaim-migrate @ 13585]
Nathan Walp <nwalp@pidgin.im>
parents: 10058
diff changeset
91