Show strings with suggestions
This commit is contained in:
parent
69b02bda49
commit
7b16bb1305
@ -42,9 +42,18 @@ class UnitManager(models.Manager):
|
|||||||
return dbunit
|
return dbunit
|
||||||
|
|
||||||
def filter_type(self, rqtype):
|
def filter_type(self, rqtype):
|
||||||
|
import trans.models
|
||||||
if rqtype == 'all':
|
if rqtype == 'all':
|
||||||
return self.all()
|
return self.all()
|
||||||
elif rqtype == 'fuzzy':
|
elif rqtype == 'fuzzy':
|
||||||
return self.filter(fuzzy = True)
|
return self.filter(fuzzy = True)
|
||||||
elif rqtype == 'untranslated':
|
elif rqtype == 'untranslated':
|
||||||
return self.filter(translated = False)
|
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 = []
|
result = []
|
||||||
nottranslated = self.unit_set.filter_type('untranslated').count()
|
nottranslated = self.unit_set.filter_type('untranslated').count()
|
||||||
fuzzy = self.unit_set.filter_type('fuzzy').count()
|
fuzzy = self.unit_set.filter_type('fuzzy').count()
|
||||||
|
suggestions = self.unit_set.filter_type('suggestions').count()
|
||||||
if nottranslated > 0:
|
if nottranslated > 0:
|
||||||
result.append(('untranslated', _('Not translated strings (%d)') % nottranslated))
|
result.append(('untranslated', _('Not translated strings (%d)') % nottranslated))
|
||||||
if fuzzy > 0:
|
if fuzzy > 0:
|
||||||
result.append(('fuzzy', _('Fuzzy strings (%d)') % fuzzy))
|
result.append(('fuzzy', _('Fuzzy strings (%d)') % fuzzy))
|
||||||
|
if suggestions > 0:
|
||||||
|
result.append(('suggestions', _('Strings with suggestions (%d)') % suggestions))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user