Commit 3c101db5 authored by Michal Čihař's avatar Michal Čihař

Add source check for more failing checks (closes #385)

parent 074ff5d4
...@@ -236,3 +236,15 @@ The string uses three dots (...) instead of an ellipsis character (…). Using ...@@ -236,3 +236,15 @@ The string uses three dots (...) instead of an ellipsis character (…). Using
Unicode character is in most cases better approach and looks better. Unicode character is in most cases better approach and looks better.
.. seealso:: https://en.wikipedia.org/wiki/Ellipsis .. seealso:: https://en.wikipedia.org/wiki/Ellipsis
.. _check-multiple-failures:
Multiple failing checks
~~~~~~~~~~~~~~~~~~~~~~~
More translations of this string have some failed quality checks. This is
usually indication that something could be done about improving the source
string.
This check can be quite often caused by missing full stop at the end of
sentence or similar minor issues which translators tend to fix in translations.
...@@ -55,3 +55,24 @@ class EllipsisCheck(SourceCheck): ...@@ -55,3 +55,24 @@ class EllipsisCheck(SourceCheck):
def check_source(self, source, unit): def check_source(self, source, unit):
return '...' in source[0] return '...' in source[0]
class MultipleFailingCheck(SourceCheck):
'''
Checks whether there are more failing checks on this translation.
'''
check_id = 'multiple_failures'
name = _('Multiple failing checks')
description = _(
'Translation in several languages have failing checks.'
)
def check_source(self, source, unit):
from trans.models.unitdata import Check
related = Check.objects.filter(
contentsum=unit.contentsum,
project=unit.translation.subproject.project
).exclude(
language__isnull=True
)
return related.count() > 2
...@@ -116,6 +116,7 @@ CHECK_LIST = get('CHECK_LIST', ( ...@@ -116,6 +116,7 @@ CHECK_LIST = get('CHECK_LIST', (
'trans.checks.markup.XMLTagsCheck', 'trans.checks.markup.XMLTagsCheck',
'trans.checks.source.OptionalPluralCheck', 'trans.checks.source.OptionalPluralCheck',
'trans.checks.source.EllipsisCheck', 'trans.checks.source.EllipsisCheck',
'trans.checks.source.MultipleFailingCheck',
)) ))
# List of automatic fixups # List of automatic fixups
......
...@@ -449,6 +449,7 @@ WHOOSH_INDEX = os.path.join(WEB_ROOT, 'whoosh-index') ...@@ -449,6 +449,7 @@ WHOOSH_INDEX = os.path.join(WEB_ROOT, 'whoosh-index')
# 'trans.checks.markup.XMLTagsCheck', # 'trans.checks.markup.XMLTagsCheck',
# 'trans.checks.source.OptionalPluralCheck', # 'trans.checks.source.OptionalPluralCheck',
# 'trans.checks.source.EllipsisCheck', # 'trans.checks.source.EllipsisCheck',
# 'trans.checks.source.MultipleFailingCheck',
#) #)
# List of automatic fixups # List of automatic fixups
......
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