Commit ed2fa5d0 authored by Michal Čihař's avatar Michal Čihař

Wrap some long lines

parent 27beda9e
......@@ -135,7 +135,12 @@ class EndColonCheck(TargetCheck):
# Japanese sentence might need to end with full stop
# in case it's used before list.
if source[-1] in [':', ';']:
return self.check_chars(source, target, -1, [u':', u':', u'.', u'。'])
return self.check_chars(
source,
target,
-1,
[u':', u':', u'.', u'。']
)
return False
return self.check_chars(source, target, -1, [u':', u':'])
......
......@@ -54,9 +54,10 @@ class ConsistencyCheck(TargetCheck):
# Do not check consistency if user asked not to have it
if not unit.translation.subproject.allow_translation_propagation:
return False
project = unit.translation.subproject.project,
related = Unit.objects.filter(
translation__language=language,
translation__subproject__project=unit.translation.subproject.project,
translation__subproject__project=project,
checksum=unit.checksum,
).exclude(
id=unit.id,
......
......@@ -81,19 +81,54 @@ class BaseFormatCheck(TargetCheck):
return False
# Special case languages with single plural form
if len(sources) > 1 and len(targets) == 1:
return self.check_format(sources[1], targets[0], flags, language, unit, 1, False)
return self.check_format(
sources[1],
targets[0],
flags,
language,
unit,
1,
False
)
# Check singular
if self.check_format(sources[0], targets[0], flags, language, unit, 0, len(sources) > 1):
singular_check = self.check_format(
sources[0],
targets[0],
flags,
language,
unit,
0,
len(sources) > 1
)
if singular_check:
if len(sources) == 1:
return True
if self.check_format(sources[1], targets[0], flags, language, unit, 1, True):
plural_check = self.check_format(
sources[1],
targets[0],
flags,
language,
unit,
1,
True
)
if plural_check:
return True
# Do we have more to check?
if len(sources) == 1:
return False
# Check plurals against plural from source
for target in targets[1:]:
if self.check_format(sources[1], target, flags, language, unit, 1, False):
plural_check = self.check_format(
sources[1],
target,
flags,
language,
unit,
1,
False
)
if plural_check:
return True
# Check did not fire
return False
......
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