Commit 715ad816 authored by Michal Čihař's avatar Michal Čihař

There should be space before ! and ?

parent 48823c9f
...@@ -160,18 +160,20 @@ checked in various language variants (Chinese or Japanese). ...@@ -160,18 +160,20 @@ checked in various language variants (Chinese or Japanese).
Trailing question Trailing question
+++++++++++++++++ +++++++++++++++++
Source and translated do not both end with question mark. Question mark is Source and translated do not both end with question mark or it is not
also checked in various language variants (Armenian, Arabic, Chinese, Korean, correctly spaced. This includes spacing rules for French or Breton. Question
Japanese, Ethiopic, Vai or Coptic). mark is also checked in various language variants (Armenian, Arabic, Chinese,
Korean, Japanese, Ethiopic, Vai or Coptic).
.. _check-end_exclamation: .. _check-end_exclamation:
Trailing exclamation Trailing exclamation
++++++++++++++++++++ ++++++++++++++++++++
Source and translated do not both end with exclamation mark. Exclamation mark Source and translated do not both end with exclamation mark or it is not
is also check in various langauge variants (Chinese, Japanese, Korean, correctly spaced. This includes spacing rules for French or Breton.
Armenian, Limbu, Myanmar or Nko). Exclamation mark is also check in various langauge variants (Chinese,
Japanese, Korean, Armenian, Limbu, Myanmar or Nko).
.. _check-python_format: .. _check-python_format:
......
...@@ -120,15 +120,29 @@ CHECKS['end_colon'] = (_('Trailing colon'), check_end_colon, _('Source and trans ...@@ -120,15 +120,29 @@ CHECKS['end_colon'] = (_('Trailing colon'), check_end_colon, _('Source and trans
@plural_check @plural_check
def check_end_question(source, target, flags, language): def check_end_question(source, target, flags, language):
if language.code.split('_')[0] in ['fr', 'br']:
if len(target) == 0:
return False
if source[-1] == ':':
if target[-2:] not in [' ?', ' ?', u' ?']:
return True
return False
return check_chars(source, target, -1, [u'?', u'՞', u'؟', u'⸮', u'?', u'፧', u'꘏', u'⳺']) return check_chars(source, target, -1, [u'?', u'՞', u'؟', u'⸮', u'?', u'፧', u'꘏', u'⳺'])
CHECKS['end_question'] = (_('Trailing question'), check_end_question, _('Source and translated do not both end with a question mark')) CHECKS['end_question'] = (_('Trailing question'), check_end_question, _('Source and translated do not both end with a question mark or it is not correctly spaced'))
@plural_check @plural_check
def check_end_exclamation(source, target, flags, language): def check_end_exclamation(source, target, flags, language):
if language.code.split('_')[0] in ['fr', 'br']:
if len(target) == 0:
return False
if source[-1] == ':':
if target[-2:] not in [' !', ' !', u' !']:
return True
return False
return check_chars(source, target, -1, [u'!', u'!', u'՜', u'᥄', u'႟', u'߹']) return check_chars(source, target, -1, [u'!', u'!', u'՜', u'᥄', u'႟', u'߹'])
CHECKS['end_exclamation'] = (_('Trailing exclamation'), check_end_exclamation, _('Source and translated do not both end with an exclamation mark')) CHECKS['end_exclamation'] = (_('Trailing exclamation'), check_end_exclamation, _('Source and translated do not both end with an exclamation mark or it is not correctly spaced'))
# For now all format string checks use generic implementation, but # For now all format string checks use generic implementation, but
# it should be switched to language specific # it should be switched to language specific
......
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