[damned-lies] Allow to display a release with C locale (language=None)



commit 28b45b9c7435c938d45958fcaee1c81f1ff18721
Author: Claude Paroz <claude 2xlibre net>
Date:   Fri Apr 17 20:30:11 2009 +0200

    Allow to display a release with C locale (language=None)
    
    language_release view should accept the C locale, which does not
    correspond to any real language, but allows for displaying the release
    details page with all POT files. This resolves partially bug #571771, so
    as to be able to see POT errors for a whole release at once.
---
 languages/views.py                              |    6 +++++-
 templates/languages/language_release.html       |    8 +++++---
 templates/languages/language_release_stats.html |    4 ++++
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/languages/views.py b/languages/views.py
index a5d1849..292c9f8 100644
--- a/languages/views.py
+++ b/languages/views.py
@@ -55,12 +55,16 @@ def language_all(request, locale, dtype):
                               context_instance=RequestContext(request))
 
 def language_release(request, locale, release_name, dtype):
-    language = get_object_or_404(Language, locale=locale)
+    if locale == 'C':
+        language = None
+    else:
+        language = get_object_or_404(Language, locale=locale)
     release = get_object_or_404(Release, name=release_name)
     stats = Statistics.get_lang_stats_by_type(language, dtype, release)
     context = {
         'pageSection': "languages",
         'language': language,
+        'language_name': language and language.get_name() or _("Original strings"),
         'release': release,
         'stats_title': {'ui':  _("UI Translations"),
                         'doc': _("Documentation")}.get(dtype),
diff --git a/templates/languages/language_release.html b/templates/languages/language_release.html
index 87df105..ccea027 100644
--- a/templates/languages/language_release.html
+++ b/templates/languages/language_release.html
@@ -1,7 +1,7 @@
 {% extends "base.html" %}
 {% load i18n %}
 
-{% block title %} {% trans release.description %} - {% trans language.name %}{% endblock %}
+{% block title %} {% trans release.description %} - {{ language_name }}{% endblock %}
 {% block extrahead %}
 <script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.tablesorter.min.js"></script>
 <script type="text/javascript">
@@ -19,7 +19,7 @@ $(document).ready(function()
 {% block content %}
 <div class="mainpage">
 
-<h2>{% trans release.description %} - <a href="{{ language.get_team_url }}">{{ language.get_name }}</a></h2>
+<h2>{% trans release.description %} - <a href="{{ language.get_team_url }}">{{ language_name }}</a></h2>
 
 <p id="hide">
    <a href="#" onclick="return showHideCompleted();">{% trans "Hide completed modules" %}</a>
@@ -30,7 +30,7 @@ $(document).ready(function()
 </p>
 
 {% ifequal release.status "xternal" %}
-<p><i>{% trans "The modules of this release are not part of the GNOME SVN repository. Please check each module's web page to see where to send translations." %}</i></p>
+<p><i>{% trans "The modules of this release are not part of the GNOME git repository. Please check each module's web page to see where to send translations." %}</i></p>
 {% endifequal %}
 
 <h3>{{ stats_title }}</h3>
@@ -38,8 +38,10 @@ $(document).ready(function()
   {% include "languages/language_release_stats.html" %}
 {% endwith %}
 
+{% if language %}
 <hr />
 <p><a href="{% url languages.views.language_release_tar locale=language.locale release_name=release.name dtype=stats.dtype %}"><img src="{{ MEDIA_URL }}img/download.png" /> {% trans "Download all po files" %}</a></p>
+{% endif %}
 
 </div>
 {% endblock %}
diff --git a/templates/languages/language_release_stats.html b/templates/languages/language_release_stats.html
index d9c5ade..4b22d33 100644
--- a/templates/languages/language_release_stats.html
+++ b/templates/languages/language_release_stats.html
@@ -48,7 +48,11 @@
           <tr>
         {% endifequal %}
         <td class="leftcell">
+          {% if language %}
           <a href="{% url vertimus-names-view modname branch stat.domain.name language.locale %}">{{ stat.module_description }}
+          {% else %}
+          <a href="{% url stats.views.module modname %}">{{ stat.module_description }}
+          {% endif %}
           {% if stat.partial_po %}
             {# For a partial po, domain description is appended #}
             &bull; {{ domname }}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]