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

Wrap some long lines

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