Commit 853eb810 authored by Michal Čihař's avatar Michal Čihař

Fold words count display into main checklist

This way we do not have to duplicate all items.
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 1d806322
......@@ -116,7 +116,7 @@
<div class="panel-body">
<div class="list-group">
{% for c in object.get_translation_checks %}
<a class="list-group-item list-group-item-{{ c.3 }}" href="{{ object.get_translate_url }}?type={{ c.0 }}"><span class="badge">{{ c.2 }}</span>{{ c.1 }}</a>
<a class="list-group-item list-group-item-{{ c.3 }}" href="{{ object.get_translate_url }}?type={{ c.0 }}">{% if c.4 %}<span class="badge">{% blocktrans count c.4 as count %}{{ count }} word{% plural %}{{ count }} words{% endblocktrans %}</span>{% endif %}<span class="badge">{{ c.2 }}</span>{{ c.1 }}</a>
{% endfor %}
</div>
</div>
......
......@@ -22,11 +22,14 @@
class TranslationChecklist(list):
"""Simple list wrapper for translation checklist"""
def add_if(self, name, label, count, level):
def add_if(self, name, label, count, level, words=None):
"""Add to list if there are matches"""
if count > 0:
self.add(name, label, count, level)
self.add(name, label, count, level, words)
def add(self, name, label, count, level):
def add(self, name, label, count, level, words=None):
"""Adds item to the list"""
self.append((name, label, count, level))
if words is not None:
self.append((name, label, count, level, words))
else:
self.append((name, label, count, level))
......@@ -978,7 +978,13 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
result = TranslationChecklist()
# All strings
result.add('all', _('All strings'), self.total, 'success')
result.add(
'all',
_('All strings'),
self.total,
'success',
self.total_words
)
# Count of translated strings
result.add_if(
......@@ -986,6 +992,7 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
_('Translated strings'),
self.translated,
'success',
self.translated_words,
)
# Not translated strings
......@@ -994,14 +1001,7 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
_('Not translated strings'),
self.total - self.translated - self.fuzzy,
'danger',
)
# Not translated strings
result.add_if(
'nottranslated',
_('Not translated words'),
self.total_words - self.translated_words - self.fuzzy_words,
'danger',
)
# Untranslated strings
......@@ -1010,14 +1010,7 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
_('Strings needing attention'),
self.total - self.translated,
'danger',
)
# Untranslated words, the link is same, just to show number of words
result.add_if(
'todo',
_('Words needing attention'),
self.total_words - self.translated_words,
'danger',
)
# Fuzzy strings
......@@ -1026,6 +1019,7 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
_('Strings needing review'),
self.fuzzy,
'danger',
self.fuzzy_words,
)
# Translations with suggestions
......
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