[damned-lies] Show a notice when a pot file has not been generated through standard methods
- From: Claude Paroz <claudep src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [damned-lies] Show a notice when a pot file has not been generated through standard methods
- Date: Sun, 17 Jan 2010 21:23:21 +0000 (UTC)
commit a5137c79a830afa850c54ee141586105c48a10d2
Author: Claude Paroz <claude 2xlibre net>
Date: Sun Jan 17 22:20:52 2010 +0100
Show a notice when a pot file has not been generated through standard methods
stats/models.py | 22 ++++++++++++++++++++--
templates/stats_show.html | 4 ++--
templates/vertimus/vertimus_detail.html | 4 ++--
3 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index 658a9c6..8311998 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -1025,6 +1025,9 @@ class Statistics(models.Model):
def is_fake(self):
return False
+ def is_pot_file(self):
+ return self.language is None
+
def tr_percentage(self):
if self.pot_size() == 0:
return 0
@@ -1044,7 +1047,7 @@ class Statistics(models.Model):
return int(100*self.untranslated/self.pot_size())
def get_lang(self):
- if self.language:
+ if not self.is_pot_file():
return _("%(lang_name)s (%(lang_locale)s)") % {
'lang_name': _(self.language.name),
'lang_locale': self.language.locale
@@ -1066,7 +1069,7 @@ class Statistics(models.Model):
return "%d%% (%d/%d/%d)" % (self.tr_percentage(), self.translated, self.fuzzy, self.untranslated)
def filename(self, potfile=False):
- if self.language and not potfile:
+ if not self.is_pot_file() and not potfile:
return "%s.%s.%s.po" % (self.domain.potbase(), self.branch.name, self.language.locale)
else:
return "%s.%s.pot" % (self.domain.potbase(), self.branch.name)
@@ -1163,6 +1166,21 @@ class Statistics(models.Model):
for err in errors:
self.information_set.add(Information(type=err[0], description=err[1]))
+ def informations(self):
+ """ Returns information_set, optionally augmented by domain information """
+ info_set = [i for i in self.information_set.all()]
+ if self.is_pot_file() and self.domain.pot_method:
+ # Add a dynamic (ie not saved) Information
+ info_set.append(Information(
+ statistics = self,
+ type = 'info',
+ description = {
+ 'ui' : ugettext_noop("This POT file has not been generated through the standard intltool method."),
+ 'doc': ugettext_noop("This POT file has not been generated through the standard gnome-doc-utils method."),
+ }.get(self.domain.dtype, ""))
+ )
+ return info_set
+
def most_important_message(self):
""" Return a message of type 1.'error', or 2.'warn, or 3.'warn """
error = None
diff --git a/templates/stats_show.html b/templates/stats_show.html
index b932346..c3f65f6 100644
--- a/templates/stats_show.html
+++ b/templates/stats_show.html
@@ -13,10 +13,10 @@
<a href="{{ pot_stat.po_url }}"><img src="{{ MEDIA_URL }}img/download.png" alt="{% trans "Download POT file" %}" /></a>
{{ pot_stat.pot_text }}
<!-- This is the title of the section that lists notices about a module -->
- {% if pot_stat.information_set.all %}
+ {% if pot_stat.informations %}
<h4>{% trans "Notices" %}</h4>
<table>
- {% for msg in pot_stat.information_set.all %}
+ {% for msg in pot_stat.informations %}
<tr>
<td valign="top"><img src="{{ msg.get_icon }}" alt="{{ msg.type }}" /></td>
<td>{{ msg.get_description|safe }}</td>
diff --git a/templates/vertimus/vertimus_detail.html b/templates/vertimus/vertimus_detail.html
index 46d4d72..3493607 100644
--- a/templates/vertimus/vertimus_detail.html
+++ b/templates/vertimus/vertimus_detail.html
@@ -77,10 +77,10 @@ $(document).ready(function() {
{% endif %}
</div>
-{% if stats.information_set.all %}
+{% if stats.informations %}
<h4>{% trans "Notices" %}</h4>
<table>
- {% for info in stats.information_set.all %}
+ {% for info in stats.informations %}
<tr>
<td valign="top"><img src="{{ info.get_icon }}" alt="{{ info.type }}" /></td>
<td>{{ info.get_description|safe }}</td>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]