[damned-lies] Show POT total words next to total strings
- From: Gil Forcada Codinachs <gforcada src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Show POT total words next to total strings
- Date: Fri, 21 Oct 2011 14:41:46 +0000 (UTC)
commit 9e41bf95847c5c2203a210cc4366db0d0afb9ff5
Author: Gil Forcada <gforcada gnome org>
Date: Sat Oct 15 20:50:52 2011 +0200
Show POT total words next to total strings
stats/models.py | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index d5a76e2..840c327 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -1224,8 +1224,11 @@ class PoFile(models.Model):
def filename(self):
return os.path.basename(self.path)
- def pot_size(self):
- return self.translated + self.fuzzy + self.untranslated
+ def pot_size(self, words=False):
+ if words:
+ return self.translated_words + self.fuzzy_words + self.untranslated_words
+ else:
+ return self.translated + self.fuzzy + self.untranslated
def fig_count(self):
""" If stat of a document type, get the number of figures in the document """
@@ -1362,6 +1365,7 @@ class Statistics(models.Model):
if not self.full_po:
return _("POT file unavailable")
pot_size = self.full_po.pot_size()
+ pot_words_size = self.full_po.pot_size(words=True)
fig_count = self.full_po.fig_count()
""" Return stat table header: 'POT file (n messages) - updated on ??-??-???? tz' """
msg_text = ungettext(u"%(count)s message", "%(count)s messages", pot_size) % {'count': pot_size}
@@ -1369,13 +1373,14 @@ class Statistics(models.Model):
# Date format syntax is similar to PHP http://www.php.net/date
'date': dateformat.format(self.full_po.updated, _("Y-m-d g:i a O"))
}
+ words_text = ungettext(u"%(count)s word", "%(count)s words", pot_words_size) % {'count': pot_words_size}
if fig_count:
fig_text = ungettext(u"%(count)s figure", "%(count)s figures", fig_count) % {'count': fig_count}
- text = _(u"POT file (%(messages)s, %(figures)s) â %(updated)s") % \
- {'messages': msg_text, 'figures': fig_text, 'updated': upd_text}
+ text = _(u"POT file (%(messages)s â %(words)s, %(figures)s) â %(updated)s") % \
+ {'messages': msg_text, 'figures': fig_text, 'updated': upd_text, 'words': words_text }
else:
- text = _(u"POT file (%(messages)s) â %(updated)s") % \
- {'messages': msg_text, 'updated': upd_text}
+ text = _(u"POT file (%(messages)s â %(words)s) â %(updated)s") % \
+ {'messages': msg_text, 'updated': upd_text, 'words': words_text }
return text
def has_figures(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]