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

Make same check better behave on different source languages

- do not run it on template strings
- do not run it on translation to source language
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent db97cdae
...@@ -178,11 +178,21 @@ class SameCheck(TargetCheck): ...@@ -178,11 +178,21 @@ class SameCheck(TargetCheck):
return result return result
def check_single(self, source, target, unit): def check_single(self, source, target, unit):
translation = unit.translation
# Ignore this on templates
if translation.is_template():
return False
# English variants will have most things not translated # English variants will have most things not translated
# Interlingua is also quite often similar to English # Interlingua is also quite often similar to English
if self.is_language(unit, ('en', 'ia')): if self.is_language(unit, ('en', 'ia')):
return False return False
# Ignore the check for source language
if (translation.language ==
translation.subproject.project.source_language):
return False
# One letter things are usually labels or decimal/thousand separators # One letter things are usually labels or decimal/thousand separators
if len(source) <= 1 and len(target) <= 1: if len(source) <= 1 and len(target) <= 1:
return False return False
......
...@@ -61,6 +61,9 @@ class MockTranslation(object): ...@@ -61,6 +61,9 @@ class MockTranslation(object):
self.language = MockLanguage(code) self.language = MockLanguage(code)
self.subproject = MockSubProject() self.subproject = MockSubProject()
def is_template(self):
return False
class MockUnit(object): class MockUnit(object):
''' '''
......
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