[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/component/metadirectives.py add missing I18N support for titles and descriptions

Fred L. Drake, Jr. fdrake at gmail.com
Wed Oct 20 21:20:03 EDT 2004


Log message for revision 28223:
  add missing I18N support for titles and descriptions

Changed:
  U   Zope3/trunk/src/zope/app/component/metadirectives.py

-=-
Modified: Zope3/trunk/src/zope/app/component/metadirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/component/metadirectives.py	2004-10-20 19:43:47 UTC (rev 28222)
+++ Zope3/trunk/src/zope/app/component/metadirectives.py	2004-10-21 01:20:02 UTC (rev 28223)
@@ -24,20 +24,23 @@
 import zope.app.security.fields
 import zope.app.component.fields
 
+from zope.app.i18n import ZopeMessageIDFactory as _
+
+
 class IBasicComponentInformation(zope.interface.Interface):
 
     component = zope.configuration.fields.GlobalObject(
-        title=u"Component to be used",
+        title=_("Component to be used"),
         required=False
         )
 
     permission = zope.app.security.fields.Permission(
-        title=u"Permission",
+        title=_("Permission"),
         required=False
         )
 
     factory = zope.configuration.fields.GlobalObject(
-        title=u"Factory",
+        title=_("Factory"),
         required=False
         )
 
@@ -45,9 +48,9 @@
     """This is the basic information for all views."""
     
     for_ = zope.configuration.fields.Tokens(
-        title=u"Specifications of the objects to be viewed",
-        description=u"""This should be a list of interfaces or classes
-        """,
+        title=_("Specifications of the objects to be viewed"),
+        description=_("""This should be a list of interfaces or classes
+        """),
         required=True,
         value_type=zope.configuration.fields.GlobalObject(
           missing_value=object(),
@@ -55,47 +58,48 @@
         )
 
     permission = zope.app.security.fields.Permission(
-        title=u"Permission",
-        description=u"The permission needed to use the view.",
+        title=_("Permission"),
+        description=_("The permission needed to use the view."),
         required=False
         )
 
     class_ = zope.configuration.fields.GlobalObject(
-        title=u"Class",
-        description=u"A class that provides attributes used by the view.",
+        title=_("Class"),
+        description=_("A class that provides attributes used by the view."),
         required=False
         )
 
     layer = zope.app.component.fields.LayerField(
-        title=u"The layer the view is in.",
-        description=u"""
+        title=_("The layer the view is in."),
+        description=_("""
         A skin is composed of layers. It is common to put skin
         specific views in a layer named after the skin. If the 'layer'
-        attribute is not supplied, it defaults to 'default'.""",
+        attribute is not supplied, it defaults to 'default'."""),
         required=False
         )
 
     allowed_interface = zope.configuration.fields.Tokens(
-        title=u"Interface that is also allowed if user has permission.",
-        description=u"""
+        title=_("Interface that is also allowed if user has permission."),
+        description=_("""
         By default, 'permission' only applies to viewing the view and
         any possible sub views. By specifying this attribute, you can
         make the permission also apply to everything described in the
         supplied interface.
 
         Multiple interfaces can be provided, separated by
-        whitespace.""",
+        whitespace."""),
         required=False,
         value_type=zope.configuration.fields.GlobalObject()
         )
 
     allowed_attributes = zope.configuration.fields.Tokens(
-        title=u"View attributes that are also allowed if user has permission.",
-        description=u"""
+        title=_("View attributes that are also allowed if the user"
+                " has permission."),
+        description=_("""
         By default, 'permission' only applies to viewing the view and
         any possible sub views. By specifying 'allowed_attributes',
         you can make the permission also apply to the extra attributes
-        on the view object.""",
+        on the view object."""),
         required=False,
         value_type=zope.configuration.fields.PythonIdentifier()
         )
@@ -106,23 +110,23 @@
     """
 
     name = zope.schema.TextLine(
-        title=u"The name of the resource.",
-        description=u"The name shows up in URLs/paths. For example 'foo'.",
+        title=_("The name of the resource."),
+        description=_("The name shows up in URLs/paths. For example 'foo'."),
         required=True,
         default=u'',
         )
 
     provides = zope.configuration.fields.GlobalObject(
-        title=u"The interface this component provides.",
-        description=u"""
+        title=_("The interface this component provides."),
+        description=_("""
         A view can provide an interface.  This would be used for
-        views that support other views.""",
+        views that support other views."""),
         required=False,
         default=zope.interface.Interface,
         )
 
     type = zope.configuration.fields.GlobalObject(
-        title=u"Request type",
+        title=_("Request type"),
         required=True
         )
 
@@ -132,12 +136,12 @@
     """
     
     interface = zope.configuration.fields.GlobalObject(
-        title=u"Interface",
+        title=_("Interface"),
         required=True
         )
 
     type = zope.configuration.fields.GlobalObject(
-        title=u"Interface type",
+        title=_("Interface type"),
         required=False
         )
 
@@ -147,24 +151,23 @@
     """
 
     factory = zope.configuration.fields.Tokens(
-        title=u"Adapter factory/factories",
-        description=u"""A list of factories (usually just one) that create the
-        adapter instance.""",
+        title=_("Adapter factory/factories"),
+        description=_("A list of factories (usually just one) that create"
+                      " the adapter instance."),
         required=True,
         value_type=zope.configuration.fields.GlobalObject()
         )
 
     provides = zope.configuration.fields.GlobalObject(
-        title=u"Interface the component provides",
-        description=u"""This attribute specifes the interface the adapter
-        instance must provide.""",
+        title=_("Interface the component provides"),
+        description=_("This attribute specifes the interface the adapter"
+                      " instance must provide."),
         required=True
         )
 
     for_ = zope.configuration.fields.Tokens(
-        title=u"Specifications to be adapted",
-        description=u"""This should be a list of interfaces or classes
-        """,
+        title=_("Specifications to be adapted"),
+        description=_("This should be a list of interfaces or classes"),
         required=True,
         value_type=zope.configuration.fields.GlobalObject(
           missing_value=object(),
@@ -172,31 +175,30 @@
         )
 
     permission = zope.app.security.fields.Permission(
-        title=u"Permission",
-        description=u"""This adapter is only available, if the principal has
-        this permission.""",
+        title=_("Permission"),
+        description=_("This adapter is only available, if the principal"
+                      " has this permission."),
         required=False
         )
 
     name = zope.schema.TextLine(
-        title=u"Name",
-        description=u"""Adapters can have names.
-
-        This attribute allows you to
-        specify the name for this adapter.""",
+        title=_("Name"),
+        description=_("Adapters can have names.\n\n"
+                      "This attribute allows you to specify the name for"
+                      " this adapter."),
         required=False
         )
 
     trusted = zope.configuration.fields.Bool(
-        title=u"Trusted",
-        description=u"""Make the adapter a trusted adapter
+        title=_("Trusted"),
+        description=_("""Make the adapter a trusted adapter
 
         Trusted adapters have unfettered access to the objects they
         adapt.  If asked to adapt security-proxied objects, then,
         rather than getting an unproxied adapter of security-proxied
         objects, you get a security-proxied adapter of unproxied
         objects.
-        """,
+        """),
         required=False,
         default=False,
         )
@@ -207,21 +209,21 @@
     """
 
     factory = zope.configuration.fields.GlobalObject(
-        title=u"Subscriber factory",
-        description=u"A factory used to create the subscriber instance.",
+        title=_("Subscriber factory"),
+        description=_("A factory used to create the subscriber instance."),
         required=True
         )
 
     provides = zope.configuration.fields.GlobalObject(
-        title=u"Interface the component provides",
-        description=u"""This attribute specifes the interface the adapter
-        instance must provide.""",
+        title=_("Interface the component provides"),
+        description=_("This attribute specifes the interface the adapter"
+                      " instance must provide."),
         required=False,
         )
 
     for_ = zope.configuration.fields.Tokens(
-        title=u"Interfaces or classes that this subscriber depends on",
-        description=u"This should be a list of interfaces or classes",
+        title=_("Interfaces or classes that this subscriber depends on"),
+        description=_("This should be a list of interfaces or classes"),
         required=True,
         value_type=zope.configuration.fields.GlobalObject(
           missing_value = object(),
@@ -229,22 +231,22 @@
         )
 
     permission = zope.app.security.fields.Permission(
-        title=u"Permission",
-        description=u"""This subscriber is only available, if the principal has
-        this permission.""",
+        title=_("Permission"),
+        description=_("This subscriber is only available, if the"
+                      " principal has this permission."),
         required=False
         )
 
     trusted = zope.configuration.fields.Bool(
-        title=u"Trusted",
-        description=u"""Make the subscriber a trusted subscriber
+        title=_("Trusted"),
+        description=_("""Make the subscriber a trusted subscriber
 
         Trusted subscribers have unfettered access to the objects they
         adapt.  If asked to adapt security-proxied objects, then,
         rather than getting an unproxied subscriber of security-proxied
         objects, you get a security-proxied subscriber of unproxied
         objects.
-        """,
+        """),
         required=False,
         default=False,
         )
@@ -253,12 +255,12 @@
     """Register a utility"""
 
     provides = zope.configuration.fields.GlobalObject(
-        title=u"Interface the component provides",
+        title=_("Interface the component provides"),
         required=True
         )
 
     name = zope.schema.TextLine(
-        title=u"Name",
+        title=_("Name"),
         required=False
         )
 
@@ -266,26 +268,26 @@
     """Define a factory"""
 
     component = zope.configuration.fields.GlobalObject(
-        title=u"Component to be used",
+        title=_("Component to be used"),
         required=True
         )
     
     id = zope.schema.Id(
-        title=u"ID",
+        title=_("ID"),
         required=False
         )
 
     title = zope.configuration.fields.MessageID(
-        title=u"Title",
-        description=u"""
-        text suitable for use in the 'add content' menu of a
-        management interface""",
+        title=_("Title"),
+        description=_("Text suitable for use in the 'add content' menu of"
+                      " a management interface"),
         required=False
         )
 
     description = zope.configuration.fields.MessageID(
-        title=u"Description",
-        description=u"Longer narrative description of what this factory does",
+        title=_("Description"),
+        description=_("Longer narrative description of what this factory"
+                      " does"),
         required=False
         )
 
@@ -294,7 +296,7 @@
     """Register a view for a component"""
 
     factory = zope.configuration.fields.Tokens(
-        title=u"Factory",
+        title=_("Factory"),
         required=False,
         value_type=zope.configuration.fields.GlobalObject()
         )
@@ -308,12 +310,12 @@
     """
 
     for_ = zope.configuration.fields.GlobalObject(
-        title=u"The interface this view is the default for.",
-        description=u"""
+        title=_("The interface this view is the default for."),
+        description=_("""
         Specifies the interface for which the default view is declared. All
         objects implementing this interface make use of this default
         setting. If this attribute is not specified, the default is available
-        for all objects.""",
+        for all objects."""),
         required=False
         )
 
@@ -324,18 +326,19 @@
     """Register a resource"""
     
     layer = zope.app.component.fields.LayerField(
-        title=u"The layer the resource is in.",
+        title=_("The layer the resource is in."),
         required=False
         )
 
     allowed_interface = zope.configuration.fields.Tokens(
-        title=u"Interface that is also allowed if user has permission.",
+        title=_("Interface that is also allowed if user has permission."),
         required=False,
         value_type=zope.configuration.fields.GlobalObject()
         )
 
     allowed_attributes = zope.configuration.fields.Tokens(
-        title=u"View attributes that are also allowed if user has permission.",
+        title=_("View attributes that are also allowed if user"
+                " has permission."),
         required=False,
         value_type=zope.configuration.fields.PythonIdentifier()
         )
@@ -344,12 +347,12 @@
 class IServiceTypeDirective(zope.interface.Interface):
 
     id = zope.schema.TextLine(
-        title=u"ID of the service type",
+        title=_("ID of the service type"),
         required=True
         )
 
     interface = zope.configuration.fields.GlobalObject(
-        title=u"Interface of the service type",
+        title=_("Interface of the service type"),
         required=True
         )
 
@@ -357,7 +360,7 @@
     """Register a service"""
 
     serviceType = zope.schema.TextLine(
-        title=u"ID of service type",
+        title=_("ID of service type"),
         required=True
         )
 
@@ -365,7 +368,7 @@
     """Make statements about a class"""
 
     class_ = zope.configuration.fields.GlobalObject(
-        title=u"Class",
+        title=_("Class"),
         required=True
         )
 
@@ -375,7 +378,7 @@
     """
 
     interface = zope.configuration.fields.Tokens(
-        title=u"One or more interfaces",
+        title=_("One or more interfaces"),
         required=True,
         value_type=zope.configuration.fields.GlobalObject()
         )
@@ -386,51 +389,51 @@
     """
 
     permission = zope.app.security.fields.Permission(
-        title=u"Permission",
-        description=u"""
+        title=_("Permission"),
+        description=_("""
         Specifies the permission by id that will be required to
-        access or mutate the attributes and methods specified.""",
+        access or mutate the attributes and methods specified."""),
         required=False
         )
 
     attributes = zope.configuration.fields.Tokens(
-        title=u"Attributes and methods",
-        description=u"""
-        This is a list of attributes and methods that can be accessed.""",
+        title=_("Attributes and methods"),
+        description=_("This is a list of attributes and methods"
+                      " that can be accessed."),
         required=False,
         value_type=zope.configuration.fields.PythonIdentifier()
         )
         
     set_attributes = zope.configuration.fields.Tokens(
-        title=u"Attributes that can be set",
-        description=u"""
-        This is a list of attributes that can be modified/mutated.""",
+        title=_("Attributes that can be set"),
+        description=_("This is a list of attributes that can be"
+                      " modified/mutated."),
         required=False,
         value_type=zope.configuration.fields.PythonIdentifier()
         )
 
     interface = zope.configuration.fields.Tokens(
-        title=u"Interfaces",
-        description=u"""
-        The listed interfaces' methods and attributes can be accessed.""",
+        title=_("Interfaces"),
+        description=_("The listed interfaces' methods and attributes"
+                      " can be accessed."),
         required=False,
         value_type=zope.configuration.fields.GlobalObject()
         )
 
     set_schema = zope.configuration.fields.Tokens(
-        title=u"The attributes specified by the schema can be set",
-        description=u"""
-        The listed schemas' properties can be modified/mutated.""",
+        title=_("The attributes specified by the schema can be set"),
+        description=_("The listed schemas' properties can be"
+                      " modified/mutated."),
         required=False,
         value_type=zope.configuration.fields.GlobalObject()
         )
 
     like_class = zope.configuration.fields.GlobalObject(
-        title=u"Configure like this class",
-        description=u"""
+        title=_("Configure like this class"),
+        description=_("""
         This argument says that this content class should be configured in the
         same way the specified class' security is. If this argument is
-        specifed, no other argument can be used.""",
+        specifed, no other argument can be used."""),
         required=False
         )
     
@@ -442,13 +445,13 @@
     """
 
     attributes = zope.configuration.fields.Tokens(
-        title=u"Attributes",
+        title=_("Attributes"),
         required=False,
         value_type=zope.configuration.fields.PythonIdentifier()
         )
 
     interface = zope.configuration.fields.Tokens(
-        title=u"Interface",
+        title=_("Interface"),
         required=False,
         value_type=zope.configuration.fields.GlobalObject()
         )
@@ -457,24 +460,24 @@
     """Specify the factory used to create this content object"""
 
     id = zope.schema.Id(
-        title=u"ID",
-        description=u"""
+        title=_("ID"),
+        description=_("""
         the identifier for this factory in the ZMI factory
         identification scheme.  If not given, defaults to the literal
-        string given as the content directive's 'class' attribute.""",
+        string given as the content directive's 'class' attribute."""),
         required=False
         )
 
     title = zope.configuration.fields.MessageID(
-        title=u"Title",
-        description=u"""
-        text suitable for use in the 'add content' menu of a
-        management interface""",
+        title=_("Title"),
+        description=_("Text suitable for use in the 'add content' menu"
+                      " of a management interface"),
         required=False
         )
 
     description = zope.configuration.fields.MessageID(
-        title=u"Description",
-        description=u"Longer narrative description of what this factory does",
+        title=_("Description"),
+        description=_("Longer narrative description of what this"
+                      " factory does"),
         required=False
         )



More information about the Zope3-Checkins mailing list