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-1301 USA
20 use POSIX
qw(strftime);
28 $lang{'ca@valencia'} = "Catalan (Valencian)";
29 $lang{'be@latin'} = "Belarusian (Latin)";
30 $lang{en_AU
} = "English (Australian)";
31 $lang{en_CA
} = "English (Canadian)";
32 $lang{en_GB
} = "English (British)";
33 $lang{mai
} = "Maithili";
34 $lang{ms_MY
} = "Malay";
35 $lang{my_MM
} = "Burmese (Myanmar)";
36 $lang{pt_BR
} = "Portuguese (Brazilian)";
37 $lang{'sr@latin'} = "Serbian (Latin)";
38 $lang{zh_CN
} = "Chinese (Simplified)";
39 $lang{zh_HK
} = "Chinese (Hong Kong)";
40 $lang{zh_TW
} = "Chinese (Traditional)";
42 opendir(DIR
, ".") || die "can't open directory: $!";
43 @pos = grep { /\.po$/ && -f
} readdir(DIR
);
44 foreach (@pos) { s/\.po$//; };
51 system("intltool-update --pot > /dev/null");
53 $_ = `msgfmt --statistics $PACKAGE.pot -o /dev/null 2>&1`;
55 die "unable to get total: $!" unless (/(\d+) untranslated messages/);
58 $generated = strftime
"%Y-%m-%d %H:%M:%S", gmtime;
60 print "<?xml version='1.0'?>\n";
61 print "<?xml-stylesheet type='text/xsl' href='l10n.xsl'?>\n";
62 print "<project version='1.0' xmlns:l10n='http://faceprint.com/code/l10n' name='$PACKAGE' pofile='$PACKAGE.pot' strings='$total' generated='$generated'>\n";
64 foreach $index (0 .. $#pos) {
65 $trans = $fuzz = $untrans = 0;
67 print STDERR
"$po..." if($ARGV[0] eq '-v');
68 system("msgmerge --no-location -U $po.po $PACKAGE.pot 2>/dev/null");
69 if (($?
& 127) == 2) {
70 printf STDERR
"Caught keyboard interrupt--exiting\n";
73 $_ = `msgfmt --statistics $po -o /dev/null 2>&1`;
75 if(/(\d+) translated message/) { $trans = $1; }
76 if(/(\d+) fuzzy translation/) { $fuzz = $1; }
77 if(/(\d+) untranslated message/) { $untrans = $1; }
81 $name = code2language
($po) unless $name ne "";
82 $name = "???" unless $name ne "";
84 print "<lang code='$po' name='$name' translated='$trans' fuzzy='$fuzz' />\n";
85 print STDERR
"done ($untrans untranslated strings).\n" if($ARGV[0] eq '-v');