Show strings with suggestions
This commit is contained in:
parent
69b02bda49
commit
7b16bb1305
@ -42,9 +42,18 @@ class UnitManager(models.Manager):
|
||||
return dbunit
|
||||
|
||||
def filter_type(self, rqtype):
|
||||
import trans.models
|
||||
if rqtype == 'all':
|
||||
return self.all()
|
||||
elif rqtype == 'fuzzy':
|
||||
return self.filter(fuzzy = True)
|
||||
elif rqtype == 'untranslated':
|
||||
return self.filter(translated = False)
|
||||
elif rqtype == 'suggestions':
|
||||
sample = self.all()[0]
|
||||
sugs = trans.models.Suggestion.objects.filter(
|
||||
language = sample.translation.language,
|
||||
project = sample.translation.subproject.project)
|
||||
sugs = sugs.values_list('checksum', flat = True)
|
||||
return self.filter(checksum__in = sugs)
|
||||
|
||||
|
@ -318,10 +318,13 @@ class Translation(models.Model):
|
||||
result = []
|
||||
nottranslated = self.unit_set.filter_type('untranslated').count()
|
||||
fuzzy = self.unit_set.filter_type('fuzzy').count()
|
||||
suggestions = self.unit_set.filter_type('suggestions').count()
|
||||
if nottranslated > 0:
|
||||
result.append(('untranslated', _('Not translated strings (%d)') % nottranslated))
|
||||
if fuzzy > 0:
|
||||
result.append(('fuzzy', _('Fuzzy strings (%d)') % fuzzy))
|
||||
if suggestions > 0:
|
||||
result.append(('suggestions', _('Strings with suggestions (%d)') % suggestions))
|
||||
return result
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user