Browse Source

Update statistics script.

master
Andrius Štikonas 1 year ago
parent
commit
ae27570b60
9 changed files with 78 additions and 1458 deletions
  1. BIN
      images/blue.png
  2. BIN
      images/green.png
  3. BIN
      images/headerbg.jpg
  4. +0
    -1150
      images/main.css
  5. BIN
      images/navbg.png
  6. +0
    -233
      images/old.css
  7. BIN
      images/red.png
  8. BIN
      images/wesnoth-logo.jpg
  9. +78
    -75
      statistics

BIN
images/blue.png View File

Before After
Width: 1  |  Height: 15  |  Size: 131B

BIN
images/green.png View File

Before After
Width: 1  |  Height: 15  |  Size: 130B

BIN
images/headerbg.jpg View File

Before After
Width: 295  |  Height: 84  |  Size: 7.0KB

+ 0
- 1150
images/main.css
File diff suppressed because it is too large
View File


BIN
images/navbg.png View File

Before After
Width: 10  |  Height: 13  |  Size: 318B

+ 0
- 233
images/old.css View File

@@ -1,233 +0,0 @@
body {
margin: 0;
padding: 0;
background: #FFFBF0;
color: #111;
font: 0.88em sans-serif;
}

p {
margin: 0 0 1em 0;
}

table.main {
background: #8b898b;
}

table.title {
background: #ececec;
}

tr.row-0 {
background: #ececec;
}

tr.row-1{
background: #ccecec;
}

tr.header {
background: #dddddd;
}

td.title {
font-weight: bold;
}

td.percentage-0 {
background: #f5f5f5;
}

td.percentage-1 {
background: #e0f5f5;
}

td.translated {
color: #05a505;
text-align: center;
font-weight: bold;
}

td.fuzzy {
color: #0505a5;
text-align: center;
font-weight: bold;
}

td.untranslated {
color: #a50505;
text-align: center;
}

h4 {
margin: 1em 0 0 0;
}

a {
color: #A48736;
}

hr {
display: none;
}

/**
* Main
*/
#main {
padding: 0 8% 0 8%;
color: #333;
font-size: 0.8em;
text-align: left;
line-height: 1.6em;
/* ie5win damn hack */
width: 100%;
}

html>body #main {
width: 84%;
}

/* -------- homepage layout start -------- */

#main #left {
position: relative;
float: left;
width: 49%;
}

#main #right {
position: relative;
float: right;
width: 50%;
}

/* -------- homepage layout end -------- */

#main div.container {
margin: 15px 3px 15px 3px;
padding: 15px;
background: #EEE;
border: 2px solid #AAA;
-moz-border-radius: 4px 4px 4px 4px;
}

#main div.new {
margin: 14px 0 0 0;
}

#main div.new div.new-title {
font-weight: bold;
}

#main div.new div.new-date {
font-size: 0.9em;
}

#main div.new p {
margin: 4px 0 4px 0;
}

#main div.sshots {
text-align: center;
}
#main #sshots a:hover {
border: none;
}

#main div.sshots a {
text-decoration: none;
font-size: 0.7em;
}

#main img {
border: none;
margin: 2px 2px 6px 2px;
padding: 3px;
background: #A48736;
}

#main h3 {
margin: 0;
padding: 0;
}

#main p {
margin: 0px 0 1.2em 0;
}

#main code {
font-size: 1.1em;
}

#main form {
margin: 0 0 15px 0;
}


/**
* Footer
*/

#footer {
clear: both;
margin: 0;
padding: 0 8% 0 8%;
color: #BBB;
font-size: 0.8em;
/* ie5win damn hack */
width: 100%;
}
html>body #footer {
width: 84%;
}

/**
* Languages
*/

#languages {
margin: 0;
padding: 0;
float: left;
text-align: left;
width: 60%;
}

#languages div.container {
margin: 0 0 12px 0;
}

#languages h3 {
margin: 0;
padding: 0;
color: #CCC;
font-size: 1.0em;
font-weight: normal;
}

#languages ul {
margin: 0;
padding: 0;
list-style: none;
}

#languages li {
display: inline;
margin: 0;
padding: 0 5px 0 0;
list-style: none;
}

/**
* Footnotes
*/

#footnote {
margin: 0 0 12px 0;
padding: 0;
float: right;
text-align: right;
width: 40%;
}

BIN
images/red.png View File

Before After
Width: 1  |  Height: 15  |  Size: 124B

BIN
images/wesnoth-logo.jpg View File

Before After
Width: 280  |  Height: 74  |  Size: 12KB

+ 78
- 75
statistics View File

@@ -14,9 +14,9 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <https://www.gnu.org/licenses/>.

source "`dirname $0`/variables"
source "$(dirname $0)/variables"

LC_ALL=C
ODD_CHARS='�'
@@ -35,60 +35,61 @@ for BRANCH in $BRANCHES; do
<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">
<head>
<meta http-equiv=\"content-type\" content=\"application/xhtml+xml; charset=utf-8\" />
<link rel=\"shortcut icon\" type=\"image/png\" href=\"http://www.wesnoth.org/mw/skins/glamdrol/ico.png\" />
<title>Battle for Wesnoth</title>
<style type=\"text/css\">@import url('images/main.css');</style>
<link rel=\"stylesheet\" type=\"text/css\" href=\"images/old.css\" />
<link rel=\"stylesheet\" type=\"text/css\" href=\"https://www.wesnoth.org/wesmere/css/wesmere-1.1.0.css\" />
<link rel=\"stylesheet\" type=\"text/css\" href=\"https://www.wesnoth.org/wesmere/css/gettext-1.1.0.css\" />
</head>
<body>
<div id=\"global\">
<div id=\"header\">

<div id=\"main\">

<div id=\"nav\" role=\"banner\">
<div class=\"centerbox\">
<div id=\"logo\">
<a href=\"http://www.wesnoth.org/\"><img alt=\"Wesnoth logo\" src=\"images/wesnoth-logo.jpg\" /></a>
<a href=\"https://www.wesnoth.org/\" aria-label=\"Wesnoth logo\"></a>
</div>
</div>

<div id=\"nav\">
<ul>
<li><a href=\"http://www.wesnoth.org/\">Home</a></li>
<li><a href=\"http://www.wesnoth.org/wiki/Play\">Play</a></li>
<li><a href=\"https://www.wesnoth.org/\">Home</a></li>
<li><a href=\"https://www.wesnoth.org/wiki/Play\">Play</a></li>

<li><a href=\"http://www.wesnoth.org/wiki/Create\">Create</a></li>
<li><a href=\"http://www.wesnoth.org/forum/\">Forums</a></li>
<li><a href=\"http://www.wesnoth.org/wiki/Support\">Support</a></li>
<li><a href=\"http://www.wesnoth.org/wiki/Project\">Project</a></li>
<li><a href=\"http://www.wesnoth.org/wiki/Credits\">Credits</a></li>
<li><a href=\"https://www.wesnoth.org/wiki/Create\">Create</a></li>
<li><a href=\"https://www.wesnoth.org/forum/\">Forums</a></li>
<li><a href=\"https://www.wesnoth.org/wiki/Support\">Support</a></li>
<li><a href=\"https://www.wesnoth.org/wiki/Project\">Project</a></li>
<li><a href=\"https://www.wesnoth.org/wiki/Credits\">Credits</a></li>
</ul>
</div>
</div>
</div>
</div>

<h2 style=\"display:inline\">Wesnoth translation stats</h2>
<h1 style=\"display:inline\">Wesnoth translation stats</h1>
<div> <br/> </div><p style=\"display:inline\">Last update: <strong>
`LC_TIME="en_US.UTF-8" date`
$(LC_TIME="en_US.UTF-8" date)
</strong></p>
<div> <br/> </div>
<table class=\"main\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\"><tr><td>
<table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" width=\"100%\">
<tr class=\"header\">
<td class=\"title\">File</td>
<td class=\"title\" align=\"center\">Status</td>
<td class=\"translated\">translated</td>
<td class=\"translated\"><strong>%</strong></td>

<td class=\"fuzzy\"><strong>fuzzy</strong></td>
<td class=\"fuzzy\"><strong>%</strong></td>
<td class=\"untranslated\"><strong>untranslated</strong></td>
<td class=\"untranslated\"><strong>%</strong></td>
<td class=\"title\">total</td>
<td class=\"title\">graph</td>
</tr>" >> $STATSFILE
<table class=\"gettext-stats\">
<thead><thead><tr>
<th class=\"title\" scope=\"col\">Textdomain</th>
<th scope=\"col\">Status</th>
<th class=\"translated\" scope=\"col\">Translated</th>
<th class=\"translated percent\" scope=\"col\">%</th>
<th class=\"fuzzy\" scope=\"col\">Fuzzy</th>
<th class=\"fuzzy percent\" scope=\"col\">%</th>
<th class=\"untranslated\" scope=\"col\">Untranslated</th>
<th class=\"untranslated percent\" scope=\"col\">%</th>
<th class=\"strcount\" scope=\"col\">Total</th>
<th class=\"graph\" scope=\"col\">Graph</th></tr></thead>
<tbody><tr>" >> $STATSFILE

for files in $BRANCH/*.po; do
file=`basename $files`
filename=`basename $file .po`
file=$(basename $files)
filename=$(basename $file .po)
npo=$(($npo + 1)); has_errors="no"; has_warnings="no";
# Extract the declared charset, may be we use this in future.
charset=`sed -n '/^"Content-Type:/ s/.*charset=\([a-zA-Z0-9_-]*\).*/\1/p' "$BRANCH/$file"`
charset=$(sed -n '/^"Content-Type:/ s/.*charset=\([a-zA-Z0-9_-]*\).*/\1/p' "$BRANCH/$file")
echo -n "Checking $file for UTF-8 inconsistencies... "
if $ISUTF8 < "$BRANCH/$file" > /dev/null 2>&1; then
@@ -140,22 +141,22 @@ for BRANCH in $BRANCHES; do
STATUS="Error"
fi
else
stat=`LC_MESSAGES=C $MSGFMT --statistics -o /dev/null "$BRANCH/$file" 2>&1`
t=`echo "$stat" | sed -ne 's/\([0-9]\+\) translated .*/\1/p'`; t=${t:-0}
u=`echo "$stat" | sed -ne 's/.* \([0-9]\+\) untranslated .*/\1/p'`; u=${u:-0}
f=`echo "$stat" | sed -ne 's/.* \([0-9]\+\) fuzzy translation.*/\1/p'`; f=${f:-0}
stat=$(LC_MESSAGES=C $MSGFMT --statistics -o /dev/null "$BRANCH/$file" 2>&1)
t=$(echo "$stat" | sed -ne 's/\([0-9]\+\) translated .*/\1/p'); t=${t:-0}
u=$(echo "$stat" | sed -ne 's/.* \([0-9]\+\) untranslated .*/\1/p'); u=${u:-0}
f=$(echo "$stat" | sed -ne 's/.* \([0-9]\+\) fuzzy translation.*/\1/p'); f=${f:-0}
sum=$(($t + $f + $u))
if [ ! "$sum" -eq 0 ]; then
rt=`printf '%s%d%s%d\n' "scale=2; 100*" $t "/" $sum | bc`
rt=$(printf '%s%d%s%d\n' "scale=2; 100*" $t "/" $sum | bc)
fi
if [ ! "$sum" -eq 0 ]; then
rf=`printf '%s%d%s%d\n' "scale=2; 100*" $f "/" $sum | bc`
rf=$(printf '%s%d%s%d\n' "scale=2; 100*" $f "/" $sum | bc)
fi
if [ ! "$sum" -eq 0 ]; then
ru=`printf '%s%d%s%d\n' "scale=2; 100*" $u "/" $sum | bc`
ru=$(printf '%s%d%s%d\n' "scale=2; 100*" $u "/" $sum | bc)
fi
nt=$(($nt + $t)); nu=$(($nu + $u)); nf=$(($nf + $f))
@@ -172,19 +173,19 @@ for BRANCH in $BRANCHES; do

echo "<tr class=\"row-$CL\">" >> $STATSFILE
CL=$(( ($CL+1)%2 ))
echo " <td align=\"left\"><strong><a href=\""$BRANCH/$filename.po"\">`basename $filename`</a></strong></td>
<td class=\"percentage-$CL\" align=\"center\">$st</td>
<td class=\"row-$CL\" align=\"right\">$t</td>" >> $STATSFILE
printf '%s%d%s%.2f%s\n' " <td class=\"percentage-" $CL "\" align=\"right\">" $rt "</td>" >> $STATSFILE
echo " <td class=\"row-$CL\" align=\"right\">$f</td>" >> $STATSFILE
printf '%s%d%s%.2f%s\n' " <td class=\"percentage-" $CL "\" align=\"right\">" $rf "</td>" >> $STATSFILE
echo " <td class=\"row-$CL\" align=\"right\">$u</td>" >> $STATSFILE
printf '%s%d%s%.2f%s\n' " <td class=\"percentage-" $CL "\" align=\"right\">" $ru "</td>" >> $STATSFILE
echo " <td class=\"row-$CL\" align=\"right\">$sum</td>" >> $STATSFILE
n4=`printf '%s%f\n' "scale=2; 3*" $rt | bc`
n6=`printf '%s%f\n' "scale=2; 3*" $rf | bc`
n8=`printf '%s%f\n' "scale=2; 3*" $ru | bc`
printf '%s%.2f%s%.2f%s%.2f%s\n' " <td><img src=\"images/green.png\" height=\"15\" width=\"" $n4 "\" alt=\"translated\"/><img src=\"images/blue.png\" height=\"15\" width=\"" $n6 "\" alt=\"fuzzy\"/><img src=\"images/red.png\" height=\"15\" width=\"" $n8 "\" alt=\"untranslated\"/></td>" >> $STATSFILE
echo " <td class=\"textdomain-name\" align=\"left\"><strong><a href=\""$BRANCH/$filename.po"\">$(basename $filename)</a></strong></td>
<td align=\"center\">$st</td>
<td class=\"translated\" align=\"right\">$t</td>" >> $STATSFILE
printf '%s%.2f%s\n' " <td class=\"percent\" align=\"right\">" $rt "</td>" >> $STATSFILE
echo " <td class=\"fuzzy\" align=\"right\">$f</td>" >> $STATSFILE
printf '%s%.2f%s\n' " <td class=\"percent\" align=\"right\">" $rf "</td>" >> $STATSFILE
echo " <td class=\"untranslated\" align=\"right\">$u</td>" >> $STATSFILE
printf '%s%.2f%s\n' " <td class=\"percent\" align=\"right\">" $ru "</td>" >> $STATSFILE
echo " <td class=\"strcount\" align=\"right\">$sum</td>" >> $STATSFILE
n4=$(printf '%s%f\n' "scale=2; 9*" $rt | bc)
n6=$(printf '%s%f\n' "scale=2; 9*" $rf | bc)
n8=$(printf '%s%f\n' "scale=2; 9*" $ru | bc)
printf '%s%.2f%s%.2f%s%.2f%s\n' " <td class=\"graph\"><span class=\"stats-bar green-bar\" style=\"width:" $n4 "px\"></span><span class=\"stats-bar blue-bar\" style=\"width:" $n6 "px\"></span><span class=\"stats-bar red-bar\" style=\"width:" $n8 "px\"></span></td>" >> $STATSFILE
echo "</tr>" >> $STATSFILE
done
@@ -217,26 +218,27 @@ for BRANCH in $BRANCHES; do
echo ""
else
sum=$((${nt} + ${nf} + ${nu}))
nrt=`printf '%s%d%s%d\n' "scale=2; 100*" $nt "/" $sum | bc`
nrf=`printf '%s%d%s%d\n' "scale=2; 100*" $nf "/" $sum | bc`
nru=`printf '%s%d%s%d\n' "scale=2; 100*" $nu "/" $sum | bc`
nrt=$(printf '%s%d%s%d\n' "scale=2; 100*" $nt "/" $sum | bc)
nrf=$(printf '%s%d%s%d\n' "scale=2; 100*" $nf "/" $sum | bc)
nru=$(printf '%s%d%s%d\n' "scale=2; 100*" $nu "/" $sum | bc)
echo "<tr class=\"title\">
<td align=\"left\"><strong>Total</strong></td>
<td align=\"center\"><strong>$STATUS</strong></td>
<td align=\"right\"><strong>$nt</strong></td>" >> $STATSFILE
printf '%s%.2f%s\n' "<td align=\"right\"><strong>" $nrt "</strong></td>" >> $STATSFILE
echo "<td align=\"right\"><strong>$nf</strong></td>" >> $STATSFILE
printf '%s%.2f%s\n' "<td align=\"right\"><strong>" $nrf "</strong></td>" >> $STATSFILE
echo "<td align=\"right\"><strong>$nu</strong></td>" >> $STATSFILE
printf '%s%.2f%s\n' "<td align=\"right\"><strong>" $nru "</strong></td>" >> $STATSFILE
echo "<td align=\"right\"><strong>$((${nt} + ${nf} + ${nu}))</strong></td>" >> $STATSFILE
echo "<tfoot><tr class=\"teamstats\">
<th class=\"title\" scope=\"row\">Total</th>
<td align=\"center\">$STATUS</td>
<td class=\"translated\">$nt</td>" >> $STATSFILE
printf '%s%.2f%s\n' "<td align=\"right\">" $nrt "</td>" >> $STATSFILE
echo "<td class=\"fuzzy\">$nf</td>" >> $STATSFILE
printf '%s%.2f%s\n' "<td align=\"right\">" $nrf "</td>" >> $STATSFILE
echo "<td class=\"untranslated\">$nu</td>" >> $STATSFILE
printf '%s%.2f%s\n' "<td align=\"right\">" $nru "</td>" >> $STATSFILE
echo "<td class=\"strcount\">$((${nt} + ${nf} + ${nu}))</td>" >> $STATSFILE
nrt=`printf '%s%f\n' "scale=2; 3*" $nrt | bc`
nrf=`printf '%s%f\n' "scale=2; 3*" $nrf | bc`
nru=`printf '%s%f\n' "scale=2; 3*" $nru | bc`
nrt=$(printf '%s%f\n' "scale=2; 9*" $nrt | bc)
nrf=$(printf '%s%f\n' "scale=2; 9*" $nrf | bc)
nru=$(printf '%s%f\n' "scale=2; 9*" $nru | bc)
printf '%s%.2f%s%.2f%s%.2f%s\n' "<td><img src=\"images/green.png\" height=\"15\" width=\"" $nrt "\" alt=\"translated\"/><img src=\"images/blue.png\" height=\"15\" width=\"" $nrf "\" alt=\"fuzzy\"/><img src=\"images/red.png\" height=\"15\" width=\"" $nru "\" alt=\"untranslated\"/></td>" >> $STATSFILE
printf '%s%.2f%s%.2f%s%.2f%s\n' " <td class=\"graph\"><span class=\"stats-bar green-bar\" style=\"width:" $nrt "px\"></span><span class=\"stats-bar blue-bar\" style=\"width:" $nrf "px\"></span><span class=\"stats-bar red-bar\" style=\"width:" $nru "px\"></span></td>" >> $STATSFILE
echo "</tr>
</table>
</td>
@@ -245,7 +247,8 @@ for BRANCH in $BRANCHES; do
<div><br/></div>
<div id=\"footer\">
<div id=\"footnote\">
&copy; 2003-"`date +%Y`" The Battle for Wesnoth<br/>
&copy; 2003-"$(date +%Y)" The Battle for Wesnoth<br/>
Site design Copyright © 2017–2018 by Iris Morelle.
<br/>
</div>
</div>

Loading…
Cancel
Save