Commit ac4fbf6e authored by Weblate's avatar Weblate

Merge remote-tracking branch 'origin/master'

parents 5695aa53 9937cf64
...@@ -34,6 +34,7 @@ Released on ? 2015. ...@@ -34,6 +34,7 @@ Released on ? 2015.
* Added quality check for AngularJS interpolation. * Added quality check for AngularJS interpolation.
* Added extensive group based ACLs. * Added extensive group based ACLs.
* Clarified terminology on strings needing review (formerly fuzzy). * Clarified terminology on strings needing review (formerly fuzzy).
* Clarified terminology on strings needing action and not translated strings.
weblate 2.4 weblate 2.4
----------- -----------
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
<div class="panel-body"> <div class="panel-body">
<div class="list-group"> <div class="list-group">
{% for c in object.get_translation_checks %} {% 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 %} {% endfor %}
</div> </div>
</div> </div>
......
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2016 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# 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/>.
#
class TranslationChecklist(list):
"""Simple list wrapper for translation checklist"""
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, words)
def add(self, name, label, count, level, words=None):
"""Adds item to the list"""
if words is not None:
self.append((name, label, count, level, words))
else:
self.append((name, label, count, level))
...@@ -47,6 +47,7 @@ from weblate.trans.mixins import URLMixin, PercentMixin, LoggerMixin ...@@ -47,6 +47,7 @@ from weblate.trans.mixins import URLMixin, PercentMixin, LoggerMixin
from weblate.trans.boolean_sum import BooleanSum from weblate.trans.boolean_sum import BooleanSum
from weblate.accounts.models import notify_new_string, get_author_name from weblate.accounts.models import notify_new_string, get_author_name
from weblate.trans.models.changes import Change from weblate.trans.models.changes import Change
from weblate.trans.checklists import TranslationChecklist
class TranslationManager(models.Manager): class TranslationManager(models.Manager):
...@@ -926,47 +927,41 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin): ...@@ -926,47 +927,41 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
''' '''
Returns list of failing source checks on current subproject. Returns list of failing source checks on current subproject.
''' '''
result = [ result = TranslationChecklist()
( result.add(
'all', 'all',
_('All strings'), _('All strings'),
self.total, self.total,
'success', 'success',
) )
]
# All checks # All checks
sourcechecks = self.unit_set.count_type('sourcechecks', self) result.add_if(
if sourcechecks > 0: 'sourcechecks',
result.append(( _('Strings with any failing checks'),
'sourcechecks', self.unit_set.count_type('sourcechecks', self),
_('Strings with any failing checks'), 'danger',
sourcechecks, )
'danger',
))
# Process specific checks # Process specific checks
for check in CHECKS: for check in CHECKS:
if not CHECKS[check].source: check_obj = CHECKS[check]
if not check_obj.source:
continue continue
cnt = self.unit_set.count_type(check, self) result.add_if(
if cnt > 0: check,
result.append(( check_obj.description,
check, self.unit_set.count_type(check, self),
CHECKS[check].description, check_obj.severity,
cnt, )
CHECKS[check].severity,
))
# Grab comments # Grab comments
sourcecomments = self.unit_set.count_type('sourcecomments', self) result.add_if(
if sourcecomments > 0: 'sourcecomments',
result.append(( _('Strings with comments'),
'sourcecomments', self.unit_set.count_type('sourcecomments', self),
_('Strings with comments'), 'info',
sourcecomments, )
'info',
))
return result return result
...@@ -974,92 +969,88 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin): ...@@ -974,92 +969,88 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
''' '''
Returns list of failing checks on current translation. Returns list of failing checks on current translation.
''' '''
result = [ result = TranslationChecklist()
(
'all', # All strings
_('All strings'), result.add(
self.total, 'all',
'success', _('All strings'),
) self.total,
] 'success',
self.total_words
)
# Count of translated strings # Count of translated strings
if self.translated > 0: result.add_if(
result.append(( 'translated',
'translated', _('Translated strings'),
_('Translated strings'), self.translated,
self.translated, 'success',
'success', self.translated_words,
)) )
# Not translated strings
result.add_if(
'nottranslated',
_('Not translated strings'),
self.total - self.translated - self.fuzzy,
'danger',
self.total_words - self.translated_words - self.fuzzy_words,
)
# Untranslated strings # Untranslated strings
nottranslated = self.total - self.translated result.add_if(
if nottranslated > 0: 'todo',
result.append(( _('Strings needing attention'),
'untranslated', self.total - self.translated,
_('Untranslated strings'), 'danger',
nottranslated, self.total_words - self.translated_words,
'danger', )
))
# Untranslated words, the link is same, just to show number of words
nottranslated = self.total_words - self.translated_words
if nottranslated > 0:
result.append((
'untranslated',
_('Untranslated words'),
nottranslated,
'danger',
))
# Fuzzy strings # Fuzzy strings
if self.fuzzy > 0: result.add_if(
result.append(( 'fuzzy',
'fuzzy', _('Strings needing review'),
_('Strings needing review'), self.fuzzy,
self.fuzzy, 'danger',
'danger', self.fuzzy_words,
)) )
# Translations with suggestions # Translations with suggestions
if self.have_suggestion > 0: result.add_if(
result.append(( 'suggestions',
'suggestions', _('Strings with suggestions'),
_('Strings with suggestions'), self.have_suggestion,
self.have_suggestion, 'info',
'info', )
))
# All checks # All checks
if self.failing_checks > 0: result.add_if(
result.append(( 'allchecks',
'allchecks', _('Strings with any failing checks'),
_('Strings with any failing checks'), self.failing_checks,
self.failing_checks, 'danger',
'danger', )
))
# Process specific checks # Process specific checks
for check in CHECKS: for check in CHECKS:
if not CHECKS[check].target: check_obj = CHECKS[check]
if not check_obj.target:
continue continue
cnt = self.unit_set.count_type(check, self) result.add_if(
if cnt > 0: check,
result.append(( check_obj.description,
check, self.unit_set.count_type(check, self),
CHECKS[check].description, check_obj.severity,
cnt, )
CHECKS[check].severity,
))
# Grab comments # Grab comments
if self.have_comment > 0: result.add_if(
result.append(( 'comments',
'comments', _('Strings with comments'),
_('Strings with comments'), self.have_comment,
self.have_comment, 'info',
'info', )
))
return result return result
......
...@@ -50,6 +50,8 @@ from weblate.trans.util import ( ...@@ -50,6 +50,8 @@ from weblate.trans.util import (
SIMPLE_FILTERS = { SIMPLE_FILTERS = {
'fuzzy': {'fuzzy': True}, 'fuzzy': {'fuzzy': True},
'untranslated': {'translated': False}, 'untranslated': {'translated': False},
'todo': {'translated': False},
'nottranslated': {'translated': False, 'fuzzy': False},
'translated': {'translated': True}, 'translated': {'translated': True},
'suggestions': {'has_suggestion': True}, 'suggestions': {'has_suggestion': True},
'comments': {'has_comment': True}, 'comments': {'has_comment': True},
......
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