Commit 2988c81d authored by Michal Čihař's avatar Michal Čihař

Include some statistics in about page.

parent 6d9bcbdc
......@@ -25,6 +25,7 @@ Relased on ? 2012.
* Documentation improvements.
* Support for locking translation by translator.
* Optionally maintain Language-Team header in po file.
* Include some statistics in about page.
weblate 1.1
-----------
......
......@@ -6,6 +6,8 @@
<p>{% blocktrans %}Weblate is web based translation tool with tight Git integration. It features simple and clean user interface, propagation of translations across subprojects, consistency checks or automatic linking to source files.{% endblocktrans %}</p>
<h2>{% trans "Versions" %}</h2>
<p>{% trans "This site is built using following projects:" %}</p>
<table>
......@@ -39,5 +41,30 @@
</tr>
</table>
<h2>{% trans "Statistics" %}</h2>
<table>
<tr>
<th>{% trans "Strings to translate" %}</th>
<td>{{ total_strings }}</td>
</tr>
<tr>
<th>{% trans "Used languages" %}</th>
<td>{{ total_languages }}</td>
</tr>
<tr>
<th>{% trans "Registered users" %}</th>
<td>{{ total_users }}</td>
</tr>
<tr>
<th>{% trans "Suggestions made" %}</th>
<td>{{ total_suggestions }}</td>
</tr>
<tr>
<th>{% trans "Translations made" %}</th>
<td>{{ total_translations }}</td>
</tr>
</table>
{% endblock %}
......@@ -8,7 +8,7 @@ from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required, user_passes_test
from django.contrib.auth.models import AnonymousUser
from django.db.models import Q, Count
from django.db.models import Q, Count, Sum
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.core.urlresolvers import reverse
......@@ -1151,6 +1151,13 @@ def about(request):
import git
import cairo
import south
totals = Profile.objects.aggregate(Sum('translated'), Sum('suggested'))
total_strings = 0
for p in SubProject.objects.iterator():
try:
total_strings += p.translation_set.all()[0].total
except Translation.DoesNotExist:
pass
return render_to_response('about.html', RequestContext(request, {
'title': _('About Weblate'),
'tt_version': translate.__version__.sver,
......@@ -1159,6 +1166,11 @@ def about(request):
'git_version': git.__version__,
'cairo_version': cairo.version,
'south_version': south.__version__,
'total_translations': totals['translated__sum'],
'total_suggestions': totals['suggested__sum'],
'total_users': Profile.objects.count(),
'total_strings': total_strings,
'total_languages': Language.objects.filter(translation__total__gt = 0).distinct().count(),
}))
@user_passes_test(lambda u: u.has_perm('trans.commit_translation') or u.has_perm('trans.update_translation'))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment