Fix a typo in xas.1 (thanks to Marcell)
[amule.git] / src / utils / scripts / stats.pl
blob9e34de91ec47533ffa3e700c53f5597917179cb5
1 #!/usr/bin/perl
3 # Copyright 2003-2005 Nathan Walp <faceprint@faceprint.com>
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.
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.
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
20 # Taken from the Gaim project, modified by Angel Vidal (Kry) for the aMule project.
22 use POSIX qw(strftime);
25 my $PACKAGE="aMule";
26 my $DOMAIN="amule";
29 use Locale::Language;
31 $lang{gl} = "Galician (Galiza)";
32 $lang{en_AU} = "English (Australian)";
33 $lang{en_CA} = "English (Canadian)";
34 $lang{en_GB} = "English (British)";
35 $lang{en_US} = "English (USA)";
36 $lang{es_MX} = "Spanish (Mexico)";
37 $lang{et_EE} = "Estonian (Estonia)";
38 $lang{it_CH} = "Italian (Switzerland)";
39 $lang{ko_KR} = "Korean (Korea)";
40 $lang{my_MM} = "Burmese (Myanmar)";
41 $lang{pt_BR} = "Portuguese (Brazilian)";
42 $lang{pt_PT} = "Portuguese (Portugal)";
43 $lang{'sr@Latn'} = "Serbian (Latin)";
44 $lang{zh_CN} = "Chinese (Simplified)";
45 $lang{zh_TW} = "Chinese (Traditional)";
47 opendir(DIR, ".") || die "can't open directory: $!";
48 @pos = grep { /\.po$/ && -f } readdir(DIR);
49 foreach (@pos) { s/\.po$//; };
50 closedir DIR;
52 @pos = sort @pos;
54 $now = `date`;
56 system("intltool-update --pot > /dev/null");
58 $_ = `msgfmt --statistics $DOMAIN.pot -o /dev/null 2>&1`;
60 die "unable to get total: $!" unless (/(\d+) untranslated messages/);
62 $total = $1;
63 $generated = strftime "%Y-%m-%d %H:%M:%S", gmtime;
64 $stats_generated = `date`;
65 chomp($stats_generated);
67 print "<?xml version='1.0'?>\n";
68 print "<?xml-stylesheet type='text/xsl' href='l10n.xsl'?>\n";
69 print "<project version='1.0' xmlns:l10n='http://faceprint.com/code/l10n' name='$PACKAGE' pofile='$DOMAIN.pot' strings='$total' generated='$generated' stats_generated='$stats_generated'>\n";
71 foreach $index (0 .. $#pos) {
72 $trans = $fuzz = $untrans = 0;
73 $po = $pos[$index];
74 print STDERR "$po..." if($ARGV[0] eq '-v');
75 system("msgmerge $po.po $DOMAIN.pot -o $po.new 2>$po.po.warnings");
76 $_ = `msgfmt --statistics $po.new -o /dev/null 2>&1`;
77 chomp;
78 if(/(\d+) translated message/) { $trans = $1; }
79 if(/(\d+) fuzzy translation/) { $fuzz = $1; }
80 if(/(\d+) untranslated message/) { $untrans = $1; }
81 unlink("$po.new");
83 $warnings = `cat $po.po.warnings | grep -v done | wc -l | cut -d" " -f 1`;
84 chop($warnings);
85 unlink("$po.po.warnings") if $warnings eq "0";
87 $name = "";
88 $name = $lang{$po};
89 $name = code2language($po) unless $name ne "";
90 $name = "???" unless $name ne "";
92 print "<lang code='$po' name='$name' translated='$trans' fuzzy='$fuzz' warnings='$warnings' />\n" unless $po eq "en_GB";
93 print STDERR "done ($untrans untranslated strings).\n" if($ARGV[0] eq '-v');
96 print "</project>\n";