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

Let checks properly work on plural translations

parent da5a2b81
......@@ -2,9 +2,21 @@ from django.utils.translation import ugettext_lazy as _
CHECKS = {}
def check_same(sources, targets):
if sources[0] == targets[0]:
return True
return False
def plural_check(f):
def _plural_check(sources, targets):
if f(sources[0], targets[0]):
return True
if len(sources) == 1:
return False
for t in targets[1:]:
if f(sources[1], t):
return True
return False
return _plural_check
@plural_check
def check_same(source, target):
return (source == target)
CHECKS['same'] = (_('Not translated'), check_same, _('Source and translated strings are same'))
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