damned-lies r697 - in trunk: . templates



Author: claudep
Date: Sat Jan 12 21:50:39 2008
New Revision: 697
URL: http://svn.gnome.org/viewvc/damned-lies?rev=697&view=rev

Log:
2008-01-12  Claude Paroz  <claude 2xlibre net>

	* module.py: Get the number of figures in a document.
	* templates/module-images.tmpl: Properly i18n-ized.
	* templates/show-stats.tmpl: Add figure count and figure column in
	stats where appropriate.
	Fixes #394862.

Modified:
   trunk/ChangeLog
   trunk/module.py
   trunk/templates/module-images.tmpl
   trunk/templates/show-stats.tmpl

Modified: trunk/module.py
==============================================================================
--- trunk/module.py	(original)
+++ trunk/module.py	Sat Jan 12 21:50:39 2008
@@ -96,6 +96,13 @@
                     #import pprint
                     #print >>sys.stderr, pprint.pformat(here)
                     del module["branch"][branch]["document"][document]
+                else:
+                    #Test if document contains figures
+                    pot = os.path.join(defaults.potdir, module['id']+'.'+branch,'docs',here['potbase']+'.'+branch+'.pot')
+                    command = "grep 'msgid \"@@image:' %(potfile)s | wc -l" % { 'potfile': pot }
+                    (error, output) = commands.getstatusoutput(command)
+                    here['fig_count'] = int(output)
+                    
         self.module = module
         branches = module["branch"].keys()
         branches.sort(compare_branches)
@@ -240,4 +247,5 @@
         self.figures = figures
         self.stats = stats
         self.svnpath = svnpath
+        self.svnwebpath = module['scmweb']+'/'+document[docid]['directory']
         DamnedRequest.render(self, type)

Modified: trunk/templates/module-images.tmpl
==============================================================================
--- trunk/templates/module-images.tmpl	(original)
+++ trunk/templates/module-images.tmpl	Sat Jan 12 21:50:39 2008
@@ -6,7 +6,7 @@
 
 <h1><a href="${webroot}/module/$module.id">$module.description</a> $document.help.description ($language)</h1>
 
-<h2>Figures translation status &mdash; <small>$(stats.prc)% ($stats.translated/$stats.fuzzy/$stats.untranslated)</small></h2>
+<h2>$_("Figures translation status") &mdash; <small>$(stats.prc)% ($stats.translated/$stats.fuzzy/$stats.untranslated)</small></h2>
 
 <table class="stats">
 <thead><tr><th width="50%">$_("Original")</th><th width="50%">$language</th></tr></thead>
@@ -16,27 +16,27 @@
   #set tdclass="fuzzy"
   #end if
 <tr><td valign="top">
-    <span class="path">C/$fig['path']</span><br/>
+    <a href="$svnwebpath/C/$fig['path']"><span class="path">C/$fig['path']</span><br/></a>
     <a href="$svnpath/C/$fig['path']"><img class="screenshot" src="$svnpath/C/$fig['path']"/></a>
     </td>
     <td valign="top" class="$tdclass">
     #if $fig['translated']
       #if $fig['translated_file']
-      <span class="path">$langid/$fig['path']</span><br/>
+      <a href="$svnwebpath/$langid/$fig['path']"><span class="path">$langid/$fig['path']</span></a><br/>
       <a href="$svnpath/$langid/$fig['path']"><img class="screenshot" src="$svnpath/$langid/$fig['path']"/></a>
       #else
-      <p><em>Translated, but uses original one (maybe the figure doesn't contain any string to translate)</em></p>
+      <p><em>$_("Translated, but uses original one (maybe the figure doesn't contain any string to translate)")</em></p>
       #end if
     #elif $fig['fuzzy']
     <em>Fuzzy</em><br/>
       #if $fig['translated_file']
-      <span class="path">$langid/$fig['path']</span><br/>
+      <a href="$svnwebpath/$langid/$fig['path']"><span class="path">$langid/$fig['path']</span></a><br/>
       <a href="$svnpath/$langid/$fig['path']"><img class="screenshot" src="$svnpath/$langid/$fig['path']"/></a>
       #else
-      <p><em><small>No existing file ("Technical" fuzzy)</small></em></p>
+      <p><em><small>$_("No existing file (\"Technical\" fuzzy)")</small></em></p>
       #end if
     #else
-    <em>Not translated</em><br/>
+    <em>$_("Not translated")</em><br/>
     <img src="${webroot}/data/emptyimg.png">
     #end if
     </td>

Modified: trunk/templates/show-stats.tmpl
==============================================================================
--- trunk/templates/show-stats.tmpl	(original)
+++ trunk/templates/show-stats.tmpl	Sat Jan 12 21:50:39 2008
@@ -9,7 +9,13 @@
 <a href="${webdir}.pot">
 <img src="$webroot/data/download.png" alt="Download POT file" />
 #if $domain.has_key('pot_size')
-  ${ngettext("POT file (%(potsize)s message)", "POT file (%(potsize)s messages)", $domain.pot_size),potsize=$domain.pot_size}
+  #set fig_text = ""
+  #if $domain.has_key('fig_count') and $domain.fig_count>0
+    #set fig_text = $ngettext("figure", "figures", $domain.fig_count)
+    ${ngettext("POT file (%(potsize)s message, %(number)s %(figures)s)", "POT file (%(potsize)s messages, %(number)s %(figures)s)", $domain.pot_size),potsize=$domain.pot_size, number=$domain.fig_count, figures=$fig_text}
+  #else
+    ${ngettext("POT file (%(potsize)s message)", "POT file (%(potsize)s messages)", $domain.pot_size),potsize=$domain.pot_size}
+  #end if
 #end if
 </a>
 #if $domain.has_key('updated')
@@ -28,7 +34,11 @@
 
 #if $domain.statistics and len($domain.statistics)
 <table class="stats">
-<thead><tr><th>$_("Language")</th><th>$_("Translated")</th><th>$_("Graph")</th></tr></thead>
+<thead><tr><th>$_("Language")</th><th>$_("Translated")</th>
+#if $domain.has_key('fig_count') and $domain.fig_count>0
+    <th></th>
+#end if
+<th>$_("Graph")</th></tr></thead>
 #for lstat in $domain.statistics
 <tr>
   <td class="leftcell"><a href="${webdir}.${lstat.code}.po">$lstat.language_name ($lstat.code)</a>
@@ -38,6 +48,9 @@
   </td>
   #if $lstat.has_key('supportedness')
   <td>${lstat.supportedness}%&nbsp;($lstat.translated/$lstat.fuzzy/$lstat.untranslated)</td>
+  #if $domain.has_key('fig_count') and $domain.fig_count>0
+  <td><a href="$module.id/$domain.potbase/$branch/$lstat.code/images"><img src="$webroot/data/figure.png" alt="$_("Display document figures")"></a></td>
+  #end if
   <td style="width: 108px; text-align: center;"><div class="graph">
       <div class="translated" style="width: ${lstat.percentages.translated}px;"></div>
       <div class="fuzzy" style="left:${lstat.percentages.translated}px; width:${lstat.percentages.fuzzy}px;"></div>



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