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{bn_IN
} = "Bengali-India";
31 $lang{en_AU
} = "English (Australian)";
32 $lang{en_CA
} = "English (Canadian)";
33 $lang{en_GB
} = "English (British)";
34 $lang{mai
} = "Maithili";
35 $lang{mhr
} = "Meadow Mari";
36 $lang{ms_MY
} = "Malay";
37 $lang{my_MM
} = "Burmese (Myanmar)";
38 $lang{pt_BR
} = "Portuguese (Brazilian)";
39 $lang{'sr@latin'} = "Serbian (Latin)";
40 $lang{zh_CN
} = "Chinese (Simplified)";
41 $lang{zh_HK
} = "Chinese (Hong Kong)";
42 $lang{zh_TW
} = "Chinese (Traditional)";
44 opendir(DIR
, ".") || die "can't open directory: $!";
45 @pos = grep { /\.po$/ && -f
} readdir(DIR
);
46 foreach (@pos) { s/\.po$//; };
53 system("intltool-update --pot > /dev/null");
55 $_ = `msgfmt --statistics $PACKAGE.pot -o /dev/null 2>&1`;
57 die "unable to get total: $!" unless (/(\d+) untranslated messages/);
60 $generated = strftime
"%Y-%m-%d %H:%M:%S", gmtime;
62 print "<?xml version='1.0'?>\n";
63 print "<?xml-stylesheet type='text/xsl' href='l10n.xsl'?>\n";
64 print "<project version='1.0' xmlns:l10n='http://faceprint.com/code/l10n' name='$PACKAGE' pofile='$PACKAGE.pot' strings='$total' generated='$generated'>\n";
66 foreach $index (0 .. $#pos) {
67 $trans = $fuzz = $untrans = 0;
69 print STDERR
"$po..." if($ARGV[0] eq '-v');
70 system("msgmerge --no-location -U $po.po $PACKAGE.pot 2>/dev/null");
71 if (($?
& 127) == 2) {
72 printf STDERR
"Caught keyboard interrupt--exiting\n";
75 $_ = `msgfmt --statistics $po -o /dev/null 2>&1`;
77 if(/(\d+) translated message/) { $trans = $1; }
78 if(/(\d+) fuzzy translation/) { $fuzz = $1; }
79 if(/(\d+) untranslated message/) { $untrans = $1; }
83 $name = code2language
($po) unless $name ne "";
84 $name = "???" unless $name ne "";
86 print "<lang code='$po' name='$name' translated='$trans' fuzzy='$fuzz' />\n";
87 print STDERR
"done ($untrans untranslated strings).\n" if($ARGV[0] eq '-v');