#! /bin/sh
# file postats.sh
#
# This file is part of LyX, the document processor.
# Licence details can be found in the file COPYING.
#
# author: Michael Schmitt, michael.schmitt@teststep.org
#
# This script extracts some information from the po file headers (last
# translator, revision date), generates the corresponding gmo files
# to retrieve the number of translated/fuzzy/untranslated messages,
# and generates a PHP web page.
#
# Invocation:
# postats.sh po_files > "pathToWebPages"/i18n.php3
# *** The PHP header ***
cat <
EOF
# *** The po file analysis ***
echo ""
echo "\$podata = array ( "
first=true
for x
do
if [ $first = true ] ; then
first=false ;
else
echo ", " ;
fi
y=`basename $x .po`
echo "array ( 'langcode' => '$y', "
touch $x
make 2>&1 $y.gmo | grep "^[1-9]" |
sed -e 's/\([0-9]*\) translated m[a-z]*[.,]/"msg_tr" => \1,/' |
sed -e 's/\([0-9]*\) fuzzy t[a-z]*[.,]/"msg_fu" => \1,/' |
sed -e 's/\([0-9]*\) untranslated m[a-z]*./"msg_nt" => \1,/'
# Format: "Last-Translator: Michael Schmitt \n"
grep "Last-Translator" $x |
sed -e 's/"Last-Translator: \(.*\)\( *\)<\(.*\)>\\n"/"translator" => "\1", "email" => "\3", /'
# Format: "PO-Revision-Date: 2003-01-18 03:00+0100\n"
grep "PO-Revision-Date" $x |
sed -e 's/"PO-Revision-Date: \(.*\) .*/"date" => "\1" )/'
done
echo ");"
echo "?>"
# *** The PHP core part ***
cat < 'Bulgarian',
'ca' => 'Catalan',
'cs' => 'Czech',
'da' => 'Danish',
'de' => 'German',
'es' => 'Spanish',
'eu' => 'Basque',
'fi' => 'Finnish',
'fr' => 'French',
'he' => 'Hebrew',
'hu' => 'Hungarian',
'it' => 'Italian',
'nl' => 'Dutch',
'no' => 'Norwegian',
'pl' => 'Polish',
'pt' => 'Portuguese',
'ro' => 'Romanian',
'ru' => 'Russian',
'sk' => 'Slovak',
'sl' => 'Slovenian',
'sv' => 'Swedish',
'tr' => 'Turkish',
'wa' => 'Wallon'
);
\$noOfMsg = \$podata[0]['msg_tr'] + \$podata[0]['msg_fu'] + \$podata[0]['msg_nt'];
function cmp (\$a, \$b) {
if (\$a['msg_tr'] == \$b['msg_tr']) {
return 0;
}
return (\$a['msg_tr'] > \$b['msg_tr']) ? -1 : 1;
}
usort (\$podata, "cmp");
?>
The following table lists all translations available with the number of messages
given for the LyX main development branch (currently 1.3.0cvs).
Unfortunately, only a few languages are well-supported.
For every release, the LyX development team may decide to exclude some of the
translations from the distribution in order not to confuse the user by a strongly
mixed-language interface.
Explanation:
- Translated: The number of translated messages
- Fuzzy: The number of fuzzy messages; these are not considered
for LyX output but solely serve as a hint for the translators
- Untranslated: The number of untranslated messages; the
default language (i.e., English) will be used in the LyX outputs
Language |
Translated |
Fuzzy |
Untranslated |
Revision Date |
Translator |
while (list(\$foo,\$info) = each(\$podata)) {
print "";
if ( \$info['msg_tr'] > \$noOfMsg * 2 / 3 ) {
\$style="style='background:#009900'";
} else if ( \$info['msg_tr'] > \$noOfMsg / 2 ) {
\$style="style='background:#AAAA00'";
} else {
\$style="style='background:#AA3333'";
}
print "" . \$lang[\$info['langcode']] . " | ";
print "" . \$info['msg_tr'] . " | ";
print "";
if (isset(\$info['msg_fu'])) {
print \$info['msg_fu'];
} else {
print "0";
}
print " | ";
print "";
if (isset(\$info['msg_nt'])) {
print \$info['msg_nt'];
} else {
print "0";
}
print " | ";
print "" . \$info['date'] . " | ";
print "";
if (\$info['email'] == "") {
print \$info['translator'];
} else {
print "" .
\$info['translator'] . "";
}
print " | ";
print "
\n";
}
?>
EOF
cat <
EOF