damned-lies r1166 - in trunk: . languages
- From: claudep svn gnome org
- To: svn-commits-list gnome org
- Subject: damned-lies r1166 - in trunk: . languages
- Date: Thu, 13 Nov 2008 21:29:53 +0000 (UTC)
Author: claudep
Date: Thu Nov 13 21:29:53 2008
New Revision: 1166
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1166&view=rev
Log:
2008-11-13 Claude Paroz <claude 2xlibre net>
* languages/urls.py:
* languages/views.py: Restore previous damned-lies XML functionality for
parsing with external apps like Vertimus.
Modified:
trunk/ChangeLog
trunk/languages/urls.py
trunk/languages/views.py
Modified: trunk/languages/urls.py
==============================================================================
--- trunk/languages/urls.py (original)
+++ trunk/languages/urls.py Thu Nov 13 21:29:53 2008
@@ -3,6 +3,7 @@
urlpatterns = patterns('',
url(r'^$', 'languages.views.languages', name='languages'),
url(r'^(?P<locale>[\w\- ]+)/(?P<release_name>[\w-]+)/$', 'languages.views.language_release', name='language_release'),
+ (r'^(?P<locale>[\w\- ]+)/(?P<release_name>[\w-]+).xml$', 'languages.views.language_release_xml'),
(r'^(?P<locale>[\w\- ]+)/(?P<release_name>[\w-]+)/(?P<dtype>(ui|doc)+).tar.gz$', 'languages.views.language_release_tar'),
url(r'^(?P<team_slug>[\w\- ]+)/$', 'teams.views.team', name='team_slug'),
)
Modified: trunk/languages/views.py
==============================================================================
--- trunk/languages/views.py (original)
+++ trunk/languages/views.py Thu Nov 13 21:29:53 2008
@@ -23,7 +23,7 @@
import tarfile
from datetime import datetime
from django.shortcuts import render_to_response
-from django.http import HttpResponseRedirect
+from django.http import HttpResponse, HttpResponseRedirect
from stats.conf import settings
from common import utils
from languages.models import Language
@@ -68,3 +68,59 @@
return HttpResponseRedirect("/POT/tar/%s" % tar_filename)
+def language_release_xml(request, locale, release_name):
+ """ This view create the same XML output than the previous Damned-Lies, so as
+ apps which depend on it (like Vertimus) don't break.
+ This view may be suppressed when Vertimus will be integrated in D-L. """
+ language = Language.objects.get(locale=Language.unslug_locale(locale))
+ release = Release.objects.get(name=release_name)
+ stats = release.get_lang_stats(language)
+ content = "<stats language=\"%s\" release=\"%s\">\n" % (locale, release_name)
+ for catname, categ in stats['ui']['categs'].items():
+ if catname != 'default':
+ content += "<category id=\"%s\">" % catname
+ # totals for category
+ if stats['doc']['categs'].has_key(catname):
+ content += "<doctranslated>%s</doctranslated>" % stats['doc']['categs'][catname]['cattrans']
+ content += "<docfuzzy>%s</docfuzzy>" % stats['doc']['categs'][catname]['catfuzzy']
+ content += "<docuntranslated>%s</docuntranslated>" % stats['doc']['categs'][catname]['catuntrans']
+ content += "<translated>%s</translated>" % categ['cattrans']
+ content += "<fuzzy>%s</fuzzy>" % categ['catfuzzy']
+ content += "<untranslated>%s</untranslated>" % categ['catuntrans']
+ # Modules
+ for modname, mod in categ['modules']:
+ content += "<module id=\"%s\" branch=\"%s\">" % (modname, mod[1][1].branch.name)
+ # find and iterate doc domains
+ if stats['doc']['categs'].has_key(catname) and stats['doc']['categs'][catname]['modules']:
+ for docmod in stats['doc']['categs'][catname]['modules']:
+ if docmod[0] == modname:
+ for doc_dom in docmod[1]:
+ if doc_dom[0] == ' fake':
+ continue
+ stat = doc_dom[1]
+ content += "<document id=\"%s\">" % stat.domain.name
+ content += "<translated>%s</translated>" % stat.translated
+ content += "<fuzzy>%s</fuzzy>" % stat.fuzzy
+ content += "<untranslated>%s</untranslated>" % stat.untranslated
+ content += "<pofile>%s</pofile>" % stat.po_url()
+ content += "<svnpath>%s</svnpath>" % stat.vcs_path()
+ content += "</document>"
+ # iterate ui domains
+ for ui_dom in mod:
+ if ui_dom[0] == ' fake':
+ continue
+ stat = ui_dom[1]
+ content += "<domain id=\"%s\">" % stat.domain.name
+ content += "<translated>%s</translated>" % stat.translated
+ content += "<fuzzy>%s</fuzzy>" % stat.fuzzy
+ content += "<untranslated>%s</untranslated>" % stat.untranslated
+ content += "<pofile>%s</pofile>" % stat.po_url()
+ content += "<svnpath>%s</svnpath>" % stat.vcs_path()
+ content += "</domain>"
+ content += "</module>"
+
+ if catname != 'default':
+ content += "</category>"
+ content += "</stats>"
+ return HttpResponse(content, content_type='text/xml')
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]