5 # This file is part of LyX, the document processor.
6 # Licence details can be found in the file COPYING.
8 # author: Michael Schmitt, michael.schmitt@teststep.org
10 # This script extracts some information from the po file headers (last
11 # translator, revision date), generates the corresponding gmo files
12 # to retrieve the number of translated/fuzzy/untranslated messages,
13 # and generates a PHP web page.
16 # postats.sh po_files > "pathToWebPages"/i18n.php3
19 # *** The PHP header ***
23 // What's the title of the page?
25 // What's the short name of the page in the navigation bar?
28 \$author="Michael Schmitt";
29 // Full name of the file (relative path from LyX home page -- i.e., it should
30 // be "foo.php3" or "bar/foo.php3")
31 \$file_full="i18n.php3";
33 include("start.php3");
35 error_reporting(E_ALL);
39 # *** The po file analysis ***
42 echo "\$podata = array ( "
46 if [ $first = true ] ; then
52 echo "array ( 'langcode' => '$y', "
54 make 2>&1 $y.gmo | grep "^[1-9]" |
55 sed -e 's/\([0-9]*\) translated m[a-z]*[.,]/"msg_tr" => \1,/' |
56 sed -e 's/\([0-9]*\) fuzzy t[a-z]*[.,]/"msg_fu" => \1,/' |
57 sed -e 's/\([0-9]*\) untranslated m[a-z]*./"msg_nt" => \1,/'
58 # Format: "Last-Translator: Michael Schmitt <Michael.Schmitt@teststep.org>\n"
59 grep "Last-Translator" $x |
60 sed -e 's/"Last-Translator: \(.*\)\( *\)<\(.*\)>\\n"/"translator" => "\1", "email" => "\3", /'
61 # Format: "PO-Revision-Date: 2003-01-18 03:00+0100\n"
62 grep "PO-Revision-Date" $x |
63 sed -e 's/"PO-Revision-Date: \(.*\) .*/"date" => "\1" )/'
68 # *** The PHP core part ***
98 \$noOfMsg = \$podata[0]['msg_tr'] + \$podata[0]['msg_fu'] + \$podata[0]['msg_nt'];
100 function cmp (\$a, \$b) {
101 if (\$a['msg_tr'] == \$b['msg_tr']) {
104 return (\$a['msg_tr'] > \$b['msg_tr']) ? -1 : 1;
107 usort (\$podata, "cmp");
111 The following table lists all translations available with the number of messages
112 given for the LyX main development branch (currently 1.3.0cvs).
113 Unfortunately, only a few languages are well-supported.
114 For every release, the LyX development team may decide to exclude some of the
115 translations from the distribution in order not to confuse the user by a strongly
116 mixed-language interface.
122 <li><i>Translated:</i> The number of translated messages</li>
123 <li><i>Fuzzy:</i> The number of fuzzy messages; these are not considered
124 for LyX output but solely serve as a hint for the translators</li>
125 <li><i>Untranslated:</i> The number of untranslated messages; the
126 default language (i.e., English) will be used in the LyX outputs</li>
128 <table class="center" frame="box" rules="all" border="2" cellpadding="5">
134 <td>Untranslated</td>
135 <td>Revision Date</td>
141 while (list(\$foo,\$info) = each(\$podata)) {
144 if ( \$info['msg_tr'] > \$noOfMsg * 2 / 3 ) {
145 \$style="style='background:#009900'";
146 } else if ( \$info['msg_tr'] > \$noOfMsg / 2 ) {
147 \$style="style='background:#AAAA00'";
149 \$style="style='background:#AA3333'";
152 print "<td \$style>" . \$lang[\$info['langcode']] . "</td>";
154 print "<td \$style align=\"right\">" . \$info['msg_tr'] . "</td>";
156 print "<td \$style align=\"right\">";
157 if (isset(\$info['msg_fu'])) {
158 print \$info['msg_fu'];
164 print "<td \$style align=\"right\">";
165 if (isset(\$info['msg_nt'])) {
166 print \$info['msg_nt'];
172 print "<td \$style align=\"center\">" . \$info['date'] . "</td>";
174 print "<td \$style>";
175 if (\$info['email'] == "") {
176 print \$info['translator'];
178 print "<a href=\"mailto:" . \$info['email'] . "\">" .
179 \$info['translator'] . "</a>";