Commit 30baaf18 authored by Michal Čihař's avatar Michal Čihař

Relax checking of space around : in French.

Allow both variants - with and without space after :. The only
requirement is not space before :.

Need to get in touch with some other French speaking people to confirm
whether only one without space after : should be allowed.

Fixes #287.
parent d8a90a18
...@@ -127,13 +127,19 @@ class EndColonCheck(TargetCheck): ...@@ -127,13 +127,19 @@ class EndColonCheck(TargetCheck):
'Source and translation do not both end with a colon ' 'Source and translation do not both end with a colon '
'or colon is not correctly spaced' 'or colon is not correctly spaced'
) )
colon_fr = (' :', ' :', u' :')
def check_single(self, source, target, unit, cache_slot): def check_single(self, source, target, unit, cache_slot):
if self.is_language(unit, ['fr', 'br']): if self.is_language(unit, ['fr', 'br']):
if len(target) == 0 or len(source) == 0: if len(target) == 0 or len(source) == 0:
return False return False
if source[-1] == ':': if source[-1] == ':':
if target[-3:] not in [' : ', ' : ', u' : ']: # Accept variant with trailing space as well
if target[-1] == ' ':
check_string = target[-3:-1]
else:
check_string = target[-2:]
if check_string not in self.colon_fr:
return True return True
return False return False
if self.is_language(unit, ['ja']): if self.is_language(unit, ['ja']):
......
...@@ -105,6 +105,9 @@ class EndColonCheckTest(CheckTestCase): ...@@ -105,6 +105,9 @@ class EndColonCheckTest(CheckTestCase):
def test_french(self): def test_french(self):
self.do_test(False, ('Text:', u'Texte : ', ''), 'fr') self.do_test(False, ('Text:', u'Texte : ', ''), 'fr')
def test_french(self):
self.do_test(False, ('Text:', u'Texte :', ''), 'fr')
def test_french_ignore(self): def test_french_ignore(self):
self.do_test(False, ('Text', u'Texte', ''), 'fr') self.do_test(False, ('Text', u'Texte', ''), 'fr')
......
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