Display links to quick translate
This commit is contained in:
parent
08bb92f8aa
commit
00b1e96153
@ -5,6 +5,17 @@
|
||||
|
||||
{% include "translation_info.html" %}
|
||||
|
||||
{% with object.get_checks as checks%}
|
||||
{% if checks %}
|
||||
<h2>{% trans "Strings to check" %}</h2>
|
||||
<ul>
|
||||
{% for c in checks %}
|
||||
<li><a href="{{ ojbect.get_translate_url }}?type={{ c.0 }}">{{ c.1 }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
from django.db import models
|
||||
from django.db.models import Q
|
||||
from django.conf import settings
|
||||
from lang.models import Language
|
||||
from django.utils.translation import ugettext_lazy, ugettext as _
|
||||
from glob import glob
|
||||
import os
|
||||
import os.path
|
||||
@ -183,6 +185,9 @@ class Translation(models.Model):
|
||||
'lang': self.language.code
|
||||
})
|
||||
|
||||
def get_translate_url(self):
|
||||
return '%stranslate/' % self.get_absolute_url()
|
||||
|
||||
def __unicode__(self):
|
||||
return '%s %s' % (self.language.name, self.subproject.__unicode__())
|
||||
|
||||
@ -261,6 +266,20 @@ class Translation(models.Model):
|
||||
|
||||
return need_save, pounit
|
||||
|
||||
def get_checks(self):
|
||||
'''
|
||||
Returns list of failing checks on current translation.
|
||||
'''
|
||||
result = []
|
||||
nottranslated = self.unit_set.filter(translated = False).count()
|
||||
fuzzy = self.unit_set.filter(fuzzy = True).count()
|
||||
if nottranslated > 0:
|
||||
result.append(('untranslated', _('Not translated strings (%d)') % nottranslated))
|
||||
if fuzzy > 0:
|
||||
result.append(('fuzzy', _('Fuzzy strings (%d)') % fuzzy))
|
||||
return result
|
||||
|
||||
|
||||
class Unit(models.Model):
|
||||
translation = models.ForeignKey(Translation)
|
||||
checksum = models.CharField(max_length = 40, default = '', blank = True, db_index = True)
|
||||
|
Loading…
Reference in New Issue
Block a user