[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/onlinehelp/browser/ Topic title has been made translatable

Dmitry Vasiliev dima at hlabs.spb.ru
Tue Jul 5 09:35:47 EDT 2005


Log message for revision 31004:
  Topic title has been made translatable
  

Changed:
  U   Zope3/trunk/src/zope/app/onlinehelp/browser/helptopic.pt
  D   Zope3/trunk/src/zope/app/onlinehelp/browser/topiclink.pt
  U   Zope3/trunk/src/zope/app/onlinehelp/browser/tree.py

-=-
Modified: Zope3/trunk/src/zope/app/onlinehelp/browser/helptopic.pt
===================================================================
--- Zope3/trunk/src/zope/app/onlinehelp/browser/helptopic.pt	2005-07-05 12:22:26 UTC (rev 31003)
+++ Zope3/trunk/src/zope/app/onlinehelp/browser/helptopic.pt	2005-07-05 13:35:47 UTC (rev 31004)
@@ -8,8 +8,7 @@
 
 <div metal:fill-slot="body">
 
-  <p tal:content="structure view/topicContent"
-      i18n:translate="">Content of Online Help.</p>
+  <p tal:content="structure view/topicContent">Content of Online Help.</p>
 
 </div>
 

Deleted: Zope3/trunk/src/zope/app/onlinehelp/browser/topiclink.pt
===================================================================
--- Zope3/trunk/src/zope/app/onlinehelp/browser/topiclink.pt	2005-07-05 12:22:26 UTC (rev 31003)
+++ Zope3/trunk/src/zope/app/onlinehelp/browser/topiclink.pt	2005-07-05 13:35:47 UTC (rev 31004)
@@ -1,7 +0,0 @@
-<div class="menu" tal:repeat="item view/listHelpItems" i18n:domain="zope">
-    <a href=""
-       tal:attributes="href item/path"
-       tal:content="item/title"
-       i18n:translate="">Title</a>
-   <div tal:replace="structure item/topics">sub topics</div>
-</div>

Modified: Zope3/trunk/src/zope/app/onlinehelp/browser/tree.py
===================================================================
--- Zope3/trunk/src/zope/app/onlinehelp/browser/tree.py	2005-07-05 12:22:26 UTC (rev 31003)
+++ Zope3/trunk/src/zope/app/onlinehelp/browser/tree.py	2005-07-05 13:35:47 UTC (rev 31004)
@@ -17,6 +17,8 @@
 """
 __docformat__ = 'restructuredtext'
 
+from zope.i18n import translate
+
 from zope.app import zapi
 from zope.app.publisher.browser import BrowserView
 
@@ -32,15 +34,15 @@
 
     def getTopicTree(self):
         """Return the tree of help topics.
-        
+
         We build a flat list of tpoics info dict.
         Iterate this dict oan build from the level info
         a navigation tree in the page tmeplate.
         Each time you get a level 0 means this is a subitem of the
         Onlinehelp itself.
-        
+
         info = [('id',{infoDict}),(),()]
-        
+
         <ul class="tree" id="tree">
           <li><a href="#">items</a>
             <ul>
@@ -71,12 +73,10 @@
 
     def renderTree(self, root, request):
         """Reder a unordered list 'ul' tree with a class name 'tree'."""
-        res=[]
+        res = []
         intend = "  "
         res.append('<ul class="tree" id="tree">')
         for topic in root.getSubTopics():
-            title = topic.title
-            url = topic.id
             item = self.renderLink(topic)
 
             # expand if context is in tree
@@ -90,12 +90,12 @@
             res.append('  </li>')
 
         res.append('<ul>')
-    
+
         return '\n'.join(res)
 
     def renderItemList(self, topic, intend):
         """Render a 'ul' elements as childs of the 'ul' tree."""
-        res=[]
+        res = []
         intend = intend + "  "
         res.append('%s<ul>' % intend)
 
@@ -106,36 +106,35 @@
                 res.append('  %s<li class="expand">' % intend)
             else:
                 res.append('  %s<li>' % intend)
-            
+
             res.append(self.renderLink(item))
             if len(item.getSubTopics()) > 0:
                 res.append('    %s%s' % (self.renderItemList(item, intend), 
                     intend))
             res.append('  %s</li>' % intend)
         res.append('%s</ul>' % intend)
-    
+
         return '\n'.join(res)
-    
+
     def renderLink(self, topic):
         """Render a href element."""
-        res = []
-        title = topic.title
+        title = translate(topic.title, context=self.request,
+                default=topic.title)
         if topic.parentPath:
-            url = topic.parentPath +'/'+ topic.id
+            url = zapi.joinPath(topic.parentPath, topic.id)
         else:
             url = topic.id
-    
         return '<a href="/++help++/%s">%s</a>\n' % (url, title)
 
     def isExpanded(self, topic):
         if topic.parentPath:
-            path = topic.parentPath +'/'+ topic.id
+            path = zapi.joinPath(topic.parentPath, topic.id)
         else:
             path = topic.id
         try:
-            if zapi.getPath(self.context).startswith('/'+path):
+            if zapi.getPath(self.context).startswith('/' + path):
                 return True
         except:
-            # TODO: fix it, functioanl test doesn't like zapi.getPath? ri
+            # TODO: fix it, functional test doesn't like zapi.getPath? ri
             pass
         return False



More information about the Zope3-Checkins mailing list