[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/ Internationalized apidoc modules description.

Dmitry Vasiliev dima at hlabs.spb.ru
Tue Sep 7 08:48:22 EDT 2004


Log message for revision 27462:
  Internationalized apidoc modules description.
  
  (Merged from trunk revisions 27410, 27421)
  


Changed:
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/browser/apidoc.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/classmodule/__init__.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/ifacemodule/__init__.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/servicemodule/__init__.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/utilitymodule/__init__.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/viewmodule/__init__.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/zcmlmodule/__init__.py


-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/browser/apidoc.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/browser/apidoc.py	2004-09-07 12:46:01 UTC (rev 27461)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/browser/apidoc.py	2004-09-07 12:48:21 UTC (rev 27462)
@@ -17,6 +17,8 @@
 """
 __docformat__ = 'restructuredtext'
 
+from zope.i18n import translate
+from zope.security.proxy import removeSecurityProxy
 from zope.app.apidoc.utilities import renderText
 
 class APIDocumentationView(object):
@@ -28,8 +30,10 @@
         Example::
 
           >>> from zope.app.apidoc import APIDocumentation
+          >>> from zope.publisher.browser import TestRequest
           
           >>> view = APIDocumentationView()
+          >>> view.request = TestRequest()
           >>> view.context = APIDocumentation(None, '++apidoc++')
           >>> info = view.getModuleList()
           >>> info = [(i['name'], i['title']) for i in info]
@@ -38,8 +42,15 @@
         """
         items = list(self.context.items())
         items.sort()
-        return [{'name': name,
-                 'title': module.title,
-                 'description': renderText(module.description,
-                                           module.__class__.__module__)}
-                for name, module in items ]
+        result = []
+        for name, module in items:
+            description = removeSecurityProxy(module.description)
+            description = translate(description, context=self.request,
+                                    default=description)
+            description = renderText(description, module.__class__.__module__)
+            if not isinstance(description, unicode):
+                description = unicode(description, "utf-8")
+            result.append({'name': name,
+                           'title': module.title,
+                           'description': description})
+        return result

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/classmodule/__init__.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/classmodule/__init__.py	2004-09-07 12:46:01 UTC (rev 27461)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/classmodule/__init__.py	2004-09-07 12:48:21 UTC (rev 27462)
@@ -549,7 +549,7 @@
     title = _('Classes')
 
     # See zope.app.apidoc.interfaces.IDocumentationModule
-    description = """
+    description = _("""
     This module allows you to get an overview of the modules and classes
     defined in the Zope 3 framework and its supporting packages. There are
     two methods to navigate through the modules to find the classes you are
@@ -569,7 +569,7 @@
     implemented interfaces, attributes and methods, but it also lists the
     interface that requires a method or attribute to be implemented and the
     permissions required to access it.
-    """
+    """)
     rootModules = ['ZConfig', 'ZODB', 'transaction', 'zdaemon', 'zope']
 
     def __init__(self):

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/ifacemodule/__init__.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/ifacemodule/__init__.py	2004-09-07 12:46:01 UTC (rev 27461)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/ifacemodule/__init__.py	2004-09-07 12:48:21 UTC (rev 27462)
@@ -75,7 +75,7 @@
     title = _('Interfaces')
 
     # See zope.app.apidoc.interfaces.IDocumentationModule
-    description = """
+    description = _("""
     All used and important interfaces are registered through the interface
     service. While it would be possible to just list all attributes, it is
     hard on the user to read such an overfull list. Therefore, interfaces that
@@ -85,7 +85,7 @@
     information, including of course the declared attributes/fields and
     methods, but also available adapters, services and utilities that provide
     this interface.
-    """
+    """)
 
     def get(self, key, default=None):
         """See zope.app.interfaces.container.IReadContainer"""

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/servicemodule/__init__.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/servicemodule/__init__.py	2004-09-07 12:46:01 UTC (rev 27461)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/servicemodule/__init__.py	2004-09-07 12:48:21 UTC (rev 27462)
@@ -73,23 +73,24 @@
     title = _('Services')
 
     # See zope.app.apidoc.interfaces.IDocumentationModule
-    description = """
+    description = _("""
     The services module let's the reader browse through all defined
     services. It uses the service name as a key. In general services can be
     queried using::
 
       >>> from zope.app import zapi
-      >>> service = zapi.getGlobalService('ServiceName')
+      >>> service = zapi.getService('ServiceName')
 
-    Here we used 'None' as the location, which means that always a global
-    service is returned. If you use an object that has a location in the
-    traversal tree, you will generally get the closest service, which includes
-    the local ones. The second argument is the service name, which you can
-    replace with any name listed in this module's menu.
+    Here we used 'None' as the context by default, which means that
+    always a global service is returned. If you use an object that has
+    a location in the traversal tree, you will generally get the closest
+    service, which includes the local ones. The first argument is the
+    service name, which you can replace with any name listed in this
+    module's menu.
 
     For each service, the attributes and methods of the service interface are
     presented. At the end a list of implementations is given.
-    """
+    """)
 
     def get(self, key, default=None):
         """See zope.app.container.interfaces.IReadContainer"""

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/utilitymodule/__init__.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/utilitymodule/__init__.py	2004-09-07 12:46:01 UTC (rev 27461)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/utilitymodule/__init__.py	2004-09-07 12:48:21 UTC (rev 27462)
@@ -127,7 +127,7 @@
     title = _('Utilities')
 
     # See zope.app.apidoc.interfaces.IDocumentationModule
-    description = """
+    description = _("""
     Utilities are also nicely registered in a service, so that it is easy to
     create a listing of available utilities. A utility is identified by the
     providing interface and a name, which can be empty. The menu provides you
@@ -136,7 +136,7 @@
 
     Again, the documentation of a utility lists all the attributes/fields and
     methods the utility provides and provides a link to the implementation. 
-    """
+    """)
 
     def get(self, key, default=None):
         parts = key.split('.')

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/viewmodule/__init__.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/viewmodule/__init__.py	2004-09-07 12:46:01 UTC (rev 27461)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/viewmodule/__init__.py	2004-09-07 12:48:21 UTC (rev 27462)
@@ -65,7 +65,7 @@
     title = _('Presentations')
 
     # See zope.app.apidoc.interfaces.IDocumentationModule
-    description = """
+    description = _("""
     The Presentations (or Views) module is somewhat crazy, since a view or
     resource cannot be identified by a single interface or name, but of four
     to five pieces of information. Conclusively, the menu lets you select an
@@ -87,7 +87,7 @@
     Completely independent of all this, there is a link "Show Skins, Layers
     and Usages" that brings you to a simple screen that shows the mapping of
     the layers to skins and provides a list of available usages.
-    """
+    """)
 
     def getSkins(self):
         """Get the names of all available skins.

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/zcmlmodule/__init__.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/zcmlmodule/__init__.py	2004-09-07 12:46:01 UTC (rev 27461)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/zcmlmodule/__init__.py	2004-09-07 12:48:21 UTC (rev 27462)
@@ -192,7 +192,7 @@
     title = _('ZCML Reference')
 
     # See zope.app.apidoc.interfaces.IDocumentationModule
-    description = """
+    description = _("""
     This module presents you with a complete list of ZCML directives and
     serves therefore well as reference. The menu provides you with a tree that
     organizes the directives by namespaces.
@@ -203,7 +203,7 @@
     file the directive was declared in. At the end a list of available
     subdirectives is given, also listing the implemented interface and
     available attributes.
-    """
+    """)
 
     def _makeDocStructure(self):
         # Some trivial caching



More information about the Zope3-Checkins mailing list