[CMF-checkins] SVN: CMF/trunk/C - added 'i18n_domain' property used
to create MassageIDs for 'title' and 'description'
Yvo Schubbe
y.2005- at wcm-solutions.de
Mon Aug 15 07:12:41 EDT 2005
Log message for revision 37934:
- added 'i18n_domain' property used to create MassageIDs for 'title' and 'description'
- added i18n attributes to CMFSetup profiles
Changed:
U CMF/trunk/CHANGES.txt
U CMF/trunk/CMFCalendar/profiles/default/types/Event.xml
U CMF/trunk/CMFCore/ActionInformation.py
U CMF/trunk/CMFCore/TypesTool.py
U CMF/trunk/CMFDefault/profiles/default/actions.xml
U CMF/trunk/CMFDefault/profiles/default/types/CMF_BTree_Folder.xml
U CMF/trunk/CMFDefault/profiles/default/types/Discussion_Item.xml
U CMF/trunk/CMFDefault/profiles/default/types/Document.xml
U CMF/trunk/CMFDefault/profiles/default/types/Favorite.xml
U CMF/trunk/CMFDefault/profiles/default/types/File.xml
U CMF/trunk/CMFDefault/profiles/default/types/Folder.xml
U CMF/trunk/CMFDefault/profiles/default/types/Image.xml
U CMF/trunk/CMFDefault/profiles/default/types/Link.xml
U CMF/trunk/CMFDefault/profiles/default/types/News_Item.xml
U CMF/trunk/CMFDefault/profiles/default/types/Topic.xml
U CMF/trunk/CMFSetup/actions.py
U CMF/trunk/CMFSetup/tests/test_actions.py
U CMF/trunk/CMFSetup/tests/test_typeinfo.py
U CMF/trunk/CMFSetup/tests/test_utils.py
U CMF/trunk/CMFSetup/typeinfo.py
U CMF/trunk/CMFSetup/utils.py
U CMF/trunk/CMFSetup/xml/apcExport.xml
U CMF/trunk/CMFSetup/xml/object_nodes.xml
U CMF/trunk/CMFSetup/xml/property_nodes.xml
U CMF/trunk/CMFSetup/xml/ticTypeExport.xml
-=-
Modified: CMF/trunk/CHANGES.txt
===================================================================
--- CMF/trunk/CHANGES.txt 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CHANGES.txt 2005-08-15 11:12:11 UTC (rev 37934)
@@ -2,8 +2,13 @@
New Features
- - Replaced user messages by MassageIDs to improve the i18n support.
+ - TypeInformation and newstyle Actions: Added i18n support.
+ If 'i18n_domain' is specified, 'title' and 'description' are returned as
+ MassageID objects instead of strings. This allows to use different i18n
+ domains for different TypeInfos and Actions.
+ - Replaced user messages by MassageIDs to improve the i18n support.
+
- CMFDefault CMFSetup profile: Added CMF BTree Folder to the list of
automatically instantiated types in the types tool.
(http://www.zope.org/Collectors/CMF/371)
@@ -62,7 +67,7 @@
- CMFSetup: Merged the registerClass and registerIcon call since
registerClass is capable of registering icons.
-
+
- DublinCore and PortalFolder: Changed fallback in 'Type' method.
The fallback is only necessary if the related type info is missing.
@@ -79,9 +84,9 @@
- The CMF now depends on Zope 2.8 / Five.
- Non-release packages moved out of the /CMF/ repository package:
-
+
o hotfixes moved to /CMF_Hotfixes
-
+
o others (CMFCollector, CMFStaging, CMFTracker, CMFWorkspaces)
moved to /CMF_Extras/
Modified: CMF/trunk/CMFCalendar/profiles/default/types/Event.xml
===================================================================
--- CMF/trunk/CMFCalendar/profiles/default/types/Event.xml 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFCalendar/profiles/default/types/Event.xml 2005-08-15 11:12:11 UTC (rev 37934)
@@ -1,7 +1,9 @@
<?xml version="1.0"?>
-<type-info id="Event" kind="Factory-based Type Information">
- <property name="title">Event</property>
- <property name="description">Events are objects for use in Calendar topical queries on the catalog.</property>
+<type-info id="Event" kind="Factory-based Type Information"
+ i18n:domain="cmf_calendar"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <property name="title" i18n:translate="">Event</property>
+ <property name="description" i18n:translate="">Events are objects for use in Calendar topical queries on the catalog.</property>
<property name="content_icon">event_icon.gif</property>
<property name="content_meta_type">CMF Event</property>
<property name="product">CMFCalendar</property>
Modified: CMF/trunk/CMFCore/ActionInformation.py
===================================================================
--- CMF/trunk/CMFCore/ActionInformation.py 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFCore/ActionInformation.py 2005-08-15 11:12:11 UTC (rev 37934)
@@ -24,6 +24,7 @@
from OFS.OrderedFolder import OrderedFolder
from OFS.SimpleItem import SimpleItem
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
+from zope.i18nmessageid import MessageID
from Expression import Expression
from interfaces.portal_actions import Action as IAction
@@ -86,6 +87,7 @@
__implements__ = IAction
meta_type = 'CMF Action'
+ i18n_domain = 'cmf_default'
security = ClassSecurityInfo()
@@ -94,6 +96,8 @@
'label': 'Title'},
{'id': 'description', 'type': 'text', 'mode': 'w',
'label': 'Description'},
+ {'id':'i18n_domain', 'type': 'string', 'mode':'w',
+ 'label':'I18n Domain'},
{'id': 'url_expr', 'type': 'string', 'mode': 'w',
'label': 'URL (Expression)'},
{'id': 'icon_expr', 'type': 'string', 'mode': 'w',
@@ -110,6 +114,7 @@
self.id = id
self._setPropValue( 'title', kw.get('title', '') )
self._setPropValue( 'description', kw.get('description', '') )
+ self._setPropValue( 'i18n_domain', kw.get('i18n_domain', '') )
self._setPropValue( 'url_expr', kw.get('url_expr', '') )
self._setPropValue( 'icon_expr', kw.get('icon_expr', '') )
self._setPropValue( 'available_expr', kw.get('available_expr', '') )
@@ -148,6 +153,10 @@
lazy_keys.append(id)
elif id == 'available':
val = True
+ elif id == 'i18n_domain':
+ continue
+ elif self.i18n_domain and id in ('title', 'description'):
+ val = MessageID(val, self.i18n_domain)
lazy_map[id] = val
return (lazy_map, lazy_keys)
Modified: CMF/trunk/CMFCore/TypesTool.py
===================================================================
--- CMF/trunk/CMFCore/TypesTool.py 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFCore/TypesTool.py 2005-08-15 11:12:11 UTC (rev 37934)
@@ -18,6 +18,7 @@
from sys import exc_info
from warnings import warn
+import Products
from AccessControl import ClassSecurityInfo
from AccessControl import getSecurityManager
from Acquisition import aq_base
@@ -28,7 +29,7 @@
from OFS.ObjectManager import IFAwareObjectManager
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from zLOG import LOG, ERROR
-import Products
+from zope.i18nmessageid import MessageID
from ActionProviderBase import ActionProviderBase
from exceptions import AccessControl_Unauthorized
@@ -77,6 +78,8 @@
'label':'Title'},
{'id':'description', 'type': 'text', 'mode':'w',
'label':'Description'},
+ {'id':'i18n_domain', 'type': 'string', 'mode':'w',
+ 'label':'I18n Domain'},
{'id':'content_icon', 'type': 'string', 'mode':'w',
'label':'Icon'},
{'id':'content_meta_type', 'type': 'string', 'mode':'w',
@@ -103,6 +106,7 @@
title = ''
description = ''
+ i18n_domain = ''
content_meta_type = ''
content_icon = ''
immediate_view = ''
@@ -182,7 +186,10 @@
l10n/i18n or where a single content class is being
used twice, under different names.
"""
- return self.title or self.getId()
+ if self.title and self.i18n_domain:
+ return MessageID(self.title, self.i18n_domain)
+ else:
+ return self.title or self.getId()
security.declareProtected(View, 'Description')
def Description(self):
@@ -190,7 +197,10 @@
Textual description of the class of objects (intended
for display in a "constructor list").
"""
- return self.description
+ if self.description and self.i18n_domain:
+ return MessageID(self.description, self.i18n_domain)
+ else:
+ return self.description
security.declareProtected(View, 'Metatype')
def Metatype(self):
Modified: CMF/trunk/CMFDefault/profiles/default/actions.xml
===================================================================
--- CMF/trunk/CMFDefault/profiles/default/actions.xml 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFDefault/profiles/default/actions.xml 2005-08-15 11:12:11 UTC (rev 37934)
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<actions-tool>
+<actions-tool xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<action-provider id="portal_types">
</action-provider>
<action-provider id="portal_workflow">
@@ -8,9 +8,10 @@
</action-provider>
<object name="user" meta_type="CMF Action Category">
<property name="title"></property>
- <object name="login" meta_type="CMF Action">
- <property name="title">Login</property>
- <property name="description">Click here to Login</property>
+ <object name="login" meta_type="CMF Action"
+ i18n:domain="cmf_default">
+ <property name="title" i18n:translate="">Login</property>
+ <property name="description" i18n:translate="">Click here to Login</property>
<property name="url_expr">string:${portal_url}/login_form</property>
<property name="icon_expr"></property>
<property name="available_expr">not: member</property>
@@ -18,9 +19,10 @@
<element value="View" /></property>
<property name="visible">True</property>
</object>
- <object name="join" meta_type="CMF Action">
- <property name="title">Join</property>
- <property name="description">Click here to Join</property>
+ <object name="join" meta_type="CMF Action"
+ i18n:domain="cmf_default">
+ <property name="title" i18n:translate="">Join</property>
+ <property name="description" i18n:translate="">Click here to Join</property>
<property name="url_expr">string:${portal_url}/join_form</property>
<property name="icon_expr"></property>
<property name="available_expr">not: member</property>
@@ -28,9 +30,10 @@
<element value="Add portal member" /></property>
<property name="visible">True</property>
</object>
- <object name="preferences" meta_type="CMF Action">
- <property name="title">Preferences</property>
- <property name="description">Change your user preferences</property>
+ <object name="preferences" meta_type="CMF Action"
+ i18n:domain="cmf_default">
+ <property name="title" i18n:translate="">Preferences</property>
+ <property name="description" i18n:translate="">Change your user preferences</property>
<property name="url_expr">string:${portal_url}/personalize_form</property>
<property name="icon_expr"></property>
<property name="available_expr">member</property>
@@ -38,9 +41,10 @@
<element value="View" /></property>
<property name="visible">True</property>
</object>
- <object name="logout" meta_type="CMF Action">
- <property name="title">Log out</property>
- <property name="description">Click here to logout</property>
+ <object name="logout" meta_type="CMF Action"
+ i18n:domain="cmf_default">
+ <property name="title" i18n:translate="">Log out</property>
+ <property name="description" i18n:translate="">Click here to logout</property>
<property name="url_expr">string:${portal_url}/logout</property>
<property name="icon_expr"></property>
<property name="available_expr">member</property>
@@ -48,9 +52,10 @@
<element value="View" /></property>
<property name="visible">True</property>
</object>
- <object name="addFavorite" meta_type="CMF Action">
- <property name="title">Add to favorites</property>
- <property name="description">Add this item to your favorites</property>
+ <object name="addFavorite" meta_type="CMF Action"
+ i18n:domain="cmf_default">
+ <property name="title" i18n:translate="">Add to favorites</property>
+ <property name="description" i18n:translate="">Add this item to your favorites</property>
<property name="url_expr">string:${object_url}/addtoFavorites</property>
<property name="icon_expr"></property>
<property name="available_expr">portal/portal_membership/getHomeFolder</property>
@@ -58,9 +63,10 @@
<element value="View" /></property>
<property name="visible">True</property>
</object>
- <object name="mystuff" meta_type="CMF Action">
- <property name="title">My stuff</property>
- <property name="description">Goto your home folder</property>
+ <object name="mystuff" meta_type="CMF Action"
+ i18n:domain="cmf_default">
+ <property name="title" i18n:translate="">My stuff</property>
+ <property name="description" i18n:translate="">Goto your home folder</property>
<property name="url_expr">string:${portal/portal_membership/getHomeUrl}/folder_contents</property>
<property name="icon_expr"></property>
<property name="available_expr">python: member and portal.portal_membership.getHomeFolder()</property>
@@ -68,9 +74,10 @@
<element value="View" /></property>
<property name="visible">True</property>
</object>
- <object name="favorites" meta_type="CMF Action">
- <property name="title">My favorites</property>
- <property name="description">Browse your favorites</property>
+ <object name="favorites" meta_type="CMF Action"
+ i18n:domain="cmf_default">
+ <property name="title" i18n:translate="">My favorites</property>
+ <property name="description" i18n:translate="">Browse your favorites</property>
<property name="url_expr">string:${portal/portal_membership/getHomeUrl}/Favorites/folder_contents</property>
<property name="icon_expr"></property>
<property name="available_expr">python: member and hasattr(portal.portal_membership.getHomeFolder(), "Favorites")</property>
@@ -78,9 +85,10 @@
<element value="View" /></property>
<property name="visible">True</property>
</object>
- <object name="logged_in" meta_type="CMF Action">
- <property name="title">Logged in</property>
- <property name="description">Used by scripts</property>
+ <object name="logged_in" meta_type="CMF Action"
+ i18n:domain="cmf_default">
+ <property name="title" i18n:translate="">Logged in</property>
+ <property name="description" i18n:translate="">Used by scripts</property>
<property name="url_expr">string:${portal_url}/logged_in</property>
<property name="icon_expr"></property>
<property name="available_expr"></property>
@@ -91,9 +99,10 @@
</object>
<object name="object" meta_type="CMF Action Category">
<property name="title"></property>
- <object name="reply" meta_type="CMF Action">
- <property name="title">Reply</property>
- <property name="description"></property>
+ <object name="reply" meta_type="CMF Action"
+ i18n:domain="cmf_default">
+ <property name="title" i18n:translate="">Reply</property>
+ <property name="description" i18n:translate=""></property>
<property name="url_expr">string:${object_url}/discussion_reply_form</property>
<property name="icon_expr"></property>
<property name="available_expr">python: object is not None and portal.portal_discussion.isDiscussionAllowedFor(object)</property>
@@ -101,9 +110,10 @@
<element value="Reply to item" /></property>
<property name="visible">True</property>
</object>
- <object name="syndication" meta_type="CMF Action">
- <property name="title">Syndication</property>
- <property name="description"></property>
+ <object name="syndication" meta_type="CMF Action"
+ i18n:domain="cmf_default">
+ <property name="title" i18n:translate="">Syndication</property>
+ <property name="description" i18n:translate=""></property>
<property name="url_expr">string:${folder_url}/synPropertiesForm</property>
<property name="icon_expr"></property>
<property name="available_expr">python: folder is object</property>
@@ -114,9 +124,10 @@
</object>
<object name="folder" meta_type="CMF Action Category">
<property name="title"></property>
- <object name="folderContents" meta_type="CMF Action">
- <property name="title">Folder contents</property>
- <property name="description"></property>
+ <object name="folderContents" meta_type="CMF Action"
+ i18n:domain="cmf_default">
+ <property name="title" i18n:translate="">Folder contents</property>
+ <property name="description" i18n:translate=""></property>
<property name="url_expr">string:${folder_url}/folder_contents</property>
<property name="icon_expr"></property>
<property name="available_expr">python: folder is not object</property>
@@ -127,9 +138,10 @@
</object>
<object name="global" meta_type="CMF Action Category">
<property name="title"></property>
- <object name="manage_members" meta_type="CMF Action">
- <property name="title">Manage members</property>
- <property name="description">Manage portal members</property>
+ <object name="manage_members" meta_type="CMF Action"
+ i18n:domain="cmf_default">
+ <property name="title" i18n:translate="">Manage members</property>
+ <property name="description" i18n:translate="">Manage portal members</property>
<property name="url_expr">string:${portal_url}/members_manage_form</property>
<property name="icon_expr"></property>
<property name="available_expr"></property>
@@ -137,9 +149,10 @@
<element value="Manage users" /></property>
<property name="visible">True</property>
</object>
- <object name="members_delete" meta_type="CMF Action">
- <property name="title">Delete members</property>
- <property name="description">Delete portal members</property>
+ <object name="members_delete" meta_type="CMF Action"
+ i18n:domain="cmf_default">
+ <property name="title" i18n:translate="">Delete members</property>
+ <property name="description" i18n:translate="">Delete portal members</property>
<property name="url_expr">string:${portal_url}/members_delete_form</property>
<property name="icon_expr"></property>
<property name="available_expr"></property>
@@ -147,9 +160,10 @@
<element value="Manage users" /></property>
<property name="visible">False</property>
</object>
- <object name="undo" meta_type="CMF Action">
- <property name="title">Undo</property>
- <property name="description"></property>
+ <object name="undo" meta_type="CMF Action"
+ i18n:domain="cmf_default">
+ <property name="title" i18n:translate="">Undo</property>
+ <property name="description" i18n:translate=""></property>
<property name="url_expr">string:${portal_url}/undo_form</property>
<property name="icon_expr"></property>
<property name="available_expr">member</property>
@@ -157,9 +171,10 @@
<element value="List undoable changes" /></property>
<property name="visible">True</property>
</object>
- <object name="configPortal" meta_type="CMF Action">
- <property name="title">Reconfigure Portal</property>
- <property name="description">Reconfigure the portal</property>
+ <object name="configPortal" meta_type="CMF Action"
+ i18n:domain="cmf_default">
+ <property name="title" i18n:translate="">Reconfigure Portal</property>
+ <property name="description" i18n:translate="">Reconfigure the portal</property>
<property name="url_expr">string:${portal_url}/reconfig_form</property>
<property name="icon_expr"></property>
<property name="available_expr"></property>
Modified: CMF/trunk/CMFDefault/profiles/default/types/CMF_BTree_Folder.xml
===================================================================
--- CMF/trunk/CMFDefault/profiles/default/types/CMF_BTree_Folder.xml 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFDefault/profiles/default/types/CMF_BTree_Folder.xml 2005-08-15 11:12:11 UTC (rev 37934)
@@ -1,7 +1,10 @@
<?xml version="1.0"?>
-<type-info id="CMF BTree Folder" kind="Factory-based Type Information">
- <property name="title">CMF BTree Folder</property>
- <property name="description">Folder for holding very large numbers of items.</property>
+<type-info id="CMF BTree Folder"
+ kind="Factory-based Type Information"
+ i18n:domain="cmf_default"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <property name="title" i18n:translate="">CMF BTree Folder</property>
+ <property name="description" i18n:translate="">Folder for holding very large numbers of items.</property>
<property name="content_icon">folder_icon.gif</property>
<property name="content_meta_type">CMF BTree Folder</property>
<property name="product">CMFCore</property>
Modified: CMF/trunk/CMFDefault/profiles/default/types/Discussion_Item.xml
===================================================================
--- CMF/trunk/CMFDefault/profiles/default/types/Discussion_Item.xml 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFDefault/profiles/default/types/Discussion_Item.xml 2005-08-15 11:12:11 UTC (rev 37934)
@@ -1,8 +1,10 @@
<?xml version="1.0"?>
<type-info id="Discussion Item"
- kind="Factory-based Type Information">
- <property name="title">Discussion Item</property>
- <property name="description">Discussion Items are documents which reply to other content.
+ kind="Factory-based Type Information"
+ i18n:domain="cmf_default"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <property name="title" i18n:translate="">Discussion Item</property>
+ <property name="description" i18n:translate="">Discussion Items are documents which reply to other content.
They should *not* be addable through the standard 'folder_factories' interface.</property>
<property name="content_icon">discussionitem_icon.gif</property>
<property name="content_meta_type">Discussion Item</property>
Modified: CMF/trunk/CMFDefault/profiles/default/types/Document.xml
===================================================================
--- CMF/trunk/CMFDefault/profiles/default/types/Document.xml 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFDefault/profiles/default/types/Document.xml 2005-08-15 11:12:11 UTC (rev 37934)
@@ -1,8 +1,10 @@
<?xml version="1.0"?>
<type-info id="Document"
- kind="Factory-based Type Information">
- <property name="title">Document</property>
- <property name="description">Documents contain text that can be formatted using 'Structured Text.'
+ kind="Factory-based Type Information"
+ i18n:domain="cmf_default"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <property name="title" i18n:translate="">Document</property>
+ <property name="description" i18n:translate="">Documents contain text that can be formatted using 'Structured Text.'
They may also contain HTML, or "plain" text.</property>
<property name="content_icon">document_icon.gif</property>
<property name="content_meta_type">Document</property>
Modified: CMF/trunk/CMFDefault/profiles/default/types/Favorite.xml
===================================================================
--- CMF/trunk/CMFDefault/profiles/default/types/Favorite.xml 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFDefault/profiles/default/types/Favorite.xml 2005-08-15 11:12:11 UTC (rev 37934)
@@ -1,8 +1,10 @@
<?xml version="1.0"?>
<type-info id="Favorite"
- kind="Factory-based Type Information">
- <property name="title">Favorite</property>
- <property name="description">A Favorite is a Link to an intra-portal resource.</property>
+ kind="Factory-based Type Information"
+ i18n:domain="cmf_default"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <property name="title" i18n:translate="">Favorite</property>
+ <property name="description" i18n:translate="">A Favorite is a Link to an intra-portal resource.</property>
<property name="content_icon">link_icon.gif</property>
<property name="content_meta_type">Favorite</property>
<property name="product">CMFDefault</property>
Modified: CMF/trunk/CMFDefault/profiles/default/types/File.xml
===================================================================
--- CMF/trunk/CMFDefault/profiles/default/types/File.xml 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFDefault/profiles/default/types/File.xml 2005-08-15 11:12:11 UTC (rev 37934)
@@ -1,7 +1,9 @@
<?xml version="1.0"?>
-<type-info id="File" kind="Factory-based Type Information">
- <property name="title">File</property>
- <property name="description">File objects can contain arbitrary downloadable files.</property>
+<type-info id="File" kind="Factory-based Type Information"
+ i18n:domain="cmf_default"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <property name="title" i18n:translate="">File</property>
+ <property name="description" i18n:translate="">File objects can contain arbitrary downloadable files.</property>
<property name="content_icon">file_icon.gif</property>
<property name="content_meta_type">Portal File</property>
<property name="product">CMFDefault</property>
Modified: CMF/trunk/CMFDefault/profiles/default/types/Folder.xml
===================================================================
--- CMF/trunk/CMFDefault/profiles/default/types/Folder.xml 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFDefault/profiles/default/types/Folder.xml 2005-08-15 11:12:11 UTC (rev 37934)
@@ -1,7 +1,9 @@
<?xml version="1.0"?>
-<type-info id="Folder" kind="Factory-based Type Information">
- <property name="title">Folder</property>
- <property name="description">Use folders to put content in categories.</property>
+<type-info id="Folder" kind="Factory-based Type Information"
+ i18n:domain="cmf_default"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <property name="title" i18n:translate="">Folder</property>
+ <property name="description" i18n:translate="">Use folders to put content in categories.</property>
<property name="content_icon">folder_icon.gif</property>
<property name="content_meta_type">Portal Folder</property>
<property name="product">CMFCore</property>
Modified: CMF/trunk/CMFDefault/profiles/default/types/Image.xml
===================================================================
--- CMF/trunk/CMFDefault/profiles/default/types/Image.xml 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFDefault/profiles/default/types/Image.xml 2005-08-15 11:12:11 UTC (rev 37934)
@@ -1,7 +1,9 @@
<?xml version="1.0"?>
-<type-info id="Image" kind="Factory-based Type Information">
- <property name="title">Image</property>
- <property name="description">Image objects can be embedded in Portal documents.</property>
+<type-info id="Image" kind="Factory-based Type Information"
+ i18n:domain="cmf_default"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <property name="title" i18n:translate="">Image</property>
+ <property name="description" i18n:translate="">Image objects can be embedded in Portal documents.</property>
<property name="content_icon">image_icon.gif</property>
<property name="content_meta_type">Portal Image</property>
<property name="product">CMFDefault</property>
Modified: CMF/trunk/CMFDefault/profiles/default/types/Link.xml
===================================================================
--- CMF/trunk/CMFDefault/profiles/default/types/Link.xml 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFDefault/profiles/default/types/Link.xml 2005-08-15 11:12:11 UTC (rev 37934)
@@ -1,7 +1,9 @@
<?xml version="1.0"?>
-<type-info id="Link" kind="Factory-based Type Information">
- <property name="title">Link</property>
- <property name="description">Link items are annotated URLs.</property>
+<type-info id="Link" kind="Factory-based Type Information"
+ i18n:domain="cmf_default"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <property name="title" i18n:translate="">Link</property>
+ <property name="description" i18n:translate="">Link items are annotated URLs.</property>
<property name="content_icon">link_icon.gif</property>
<property name="content_meta_type">Link</property>
<property name="product">CMFDefault</property>
Modified: CMF/trunk/CMFDefault/profiles/default/types/News_Item.xml
===================================================================
--- CMF/trunk/CMFDefault/profiles/default/types/News_Item.xml 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFDefault/profiles/default/types/News_Item.xml 2005-08-15 11:12:11 UTC (rev 37934)
@@ -1,8 +1,10 @@
<?xml version="1.0"?>
<type-info id="News Item"
- kind="Factory-based Type Information">
- <property name="title">News Item</property>
- <property name="description">News Items contain short text articles and carry a title as well as
+ kind="Factory-based Type Information"
+ i18n:domain="cmf_default"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <property name="title" i18n:translate="">News Item</property>
+ <property name="description" i18n:translate="">News Items contain short text articles and carry a title as well as
an optional description.</property>
<property name="content_icon">newsitem_icon.gif</property>
<property name="content_meta_type">News Item</property>
Modified: CMF/trunk/CMFDefault/profiles/default/types/Topic.xml
===================================================================
--- CMF/trunk/CMFDefault/profiles/default/types/Topic.xml 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFDefault/profiles/default/types/Topic.xml 2005-08-15 11:12:11 UTC (rev 37934)
@@ -1,7 +1,9 @@
<?xml version="1.0"?>
-<type-info id="Topic" kind="Factory-based Type Information">
- <property name="title">Topic</property>
- <property name="description">Topics are canned queries for organizing content with up to date queries into the catalog.</property>
+<type-info id="Topic" kind="Factory-based Type Information"
+ i18n:domain="cmf_default"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <property name="title" i18n:translate="">Topic</property>
+ <property name="description" i18n:translate="">Topics are canned queries for organizing content with up to date queries into the catalog.</property>
<property name="content_icon">topic_icon.gif</property>
<property name="content_meta_type">Portal Topic</property>
<property name="product">CMFTopic</property>
Modified: CMF/trunk/CMFSetup/actions.py
===================================================================
--- CMF/trunk/CMFSetup/actions.py 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFSetup/actions.py 2005-08-15 11:12:11 UTC (rev 37934)
@@ -222,22 +222,23 @@
return {
'actions-tool':
- { 'action-provider': {KEY: 'providers', DEFAULT: ()},
- 'object': {KEY: 'objects', DEFAULT: ()} },
+ { 'action-provider': {KEY: 'providers', DEFAULT: ()},
+ 'object': {KEY: 'objects', DEFAULT: ()},
+ 'xmlns:i18n': {} },
'action-provider':
- { 'id': {},
- 'remove': {},
- 'action': {KEY: 'actions', DEFAULT: ()} },
+ { 'id': {},
+ 'remove': {},
+ 'action': {KEY: 'actions', DEFAULT: ()} },
'action':
- { 'action_id': {KEY: 'id'},
- 'title': {},
- 'description': {CONVERTER: self._convertToUnique},
- 'category': {},
- 'condition_expr': {KEY: 'condition'},
- 'permission': {KEY: 'permissions', DEFAULT: ()},
- 'visible': {CONVERTER: self._convertToBoolean},
- 'url_expr': {KEY: 'action'} },
+ { 'action_id': {KEY: 'id'},
+ 'title': {},
+ 'description': {CONVERTER: self._convertToUnique},
+ 'category': {},
+ 'condition_expr': {KEY: 'condition'},
+ 'permission': {KEY: 'permissions', DEFAULT: ()},
+ 'visible': {CONVERTER: self._convertToBoolean},
+ 'url_expr': {KEY: 'action'} },
'permission':
- { '#text': {KEY: None} } }
+ { '#text': {KEY: None} } }
InitializeClass(ActionProvidersConfigurator)
Modified: CMF/trunk/CMFSetup/tests/test_actions.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_actions.py 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFSetup/tests/test_actions.py 2005-08-15 11:12:11 UTC (rev 37934)
@@ -178,7 +178,7 @@
configurator = self._makeOne( site )
tool_info = configurator.parseXML( _EMPTY_EXPORT )
- self.assertEqual( len(tool_info), 2 )
+ self.assertEqual( len(tool_info), 3 )
self.assertEqual( len( tool_info[ 'providers' ] ), 1 )
@@ -192,7 +192,7 @@
configurator = self._makeOne( site )
tool_info = configurator.parseXML( _NORMAL_EXPORT )
- self.assertEqual( len(tool_info), 2 )
+ self.assertEqual( len(tool_info), 3 )
self.assertEqual( len( tool_info['providers'] ), 3 )
@@ -232,7 +232,7 @@
_EMPTY_EXPORT = """\
<?xml version="1.0"?>
-<actions-tool>
+<actions-tool xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<action-provider id="portal_actions">
</action-provider>
</actions-tool>
@@ -240,7 +240,7 @@
_NORMAL_EXPORT = """\
<?xml version="1.0"?>
-<actions-tool>
+<actions-tool xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<action-provider id="portal_actions">
</action-provider>
<action-provider id="portal_foo">
@@ -267,7 +267,7 @@
_NEWSYTLE_EXPORT = """\
<?xml version="1.0"?>
-<actions-tool>
+<actions-tool xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<action-provider id="portal_actions">
</action-provider>
<object name="dummy" meta_type="CMF Action Category">
@@ -295,9 +295,29 @@
</actions-tool>
"""
+_I18N_IMPORT = """\
+<?xml version="1.0"?>
+<actions-tool xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <action-provider id="portal_actions">
+ </action-provider>
+ <object name="dummy" meta_type="CMF Action Category">
+ <property name="title"></property>
+ <object name="foo" meta_type="CMF Action" i18n:domain="foo_domain">
+ <property name="title" i18n:translate="">Foo</property>
+ <property name="description" i18n:translate=""></property>
+ <property name="url_expr">string:${object_url}/foo</property>
+ <property name="icon_expr"></property>
+ <property name="available_expr">python:1</property>
+ <property name="permissions"></property>
+ <property name="visible">True</property>
+ </object>
+ </object>
+</actions-tool>
+"""
+
_INSERT_IMPORT = """\
<?xml version="1.0"?>
-<actions-tool>
+<actions-tool xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<object name="dummy">
<object name="spam" meta_type="CMF Action" insert-before="*">
<property name="title">Spam</property>
@@ -318,7 +338,7 @@
_REMOVE_IMPORT = """\
<?xml version="1.0"?>
-<actions-tool>
+<actions-tool xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<action-provider id="portal_actions" remove="">
</action-provider>
<action-provider id="not_existing" remove="">
@@ -490,6 +510,33 @@
self.failIf( foo.listActions() )
self.failIf( bar.listActions() )
+ def test_i18n(self):
+
+ from Products.CMFSetup.actions import importActionProviders
+
+ site = self._initSite(0, 0)
+ atool = site.portal_actions
+
+ context = DummyImportContext(site)
+ context._files['actions.xml'] = _I18N_IMPORT
+ importActionProviders(context)
+
+ self.assertEqual(len(atool.listActionProviders()), 1)
+ self.assertEqual(atool.objectIds(), ['dummy'])
+ self.assertEqual(atool.dummy.objectIds(), ['foo'])
+ self.assertEqual(atool.dummy.foo.i18n_domain, 'foo_domain')
+
+ # complete the roundtrip
+ context = DummyExportContext(site)
+ from Products.CMFSetup.actions import exportActionProviders
+ exportActionProviders(context)
+
+ self.assertEqual(len(context._wrote), 1)
+ filename, text, content_type = context._wrote[0]
+ self.assertEqual(filename, 'actions.xml')
+ self._compareDOM(text, _I18N_IMPORT)
+ self.assertEqual(content_type, 'text/xml')
+
def test_insert_skip_purge(self):
from Products.CMFSetup.actions import importActionProviders
Modified: CMF/trunk/CMFSetup/tests/test_typeinfo.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_typeinfo.py 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFSetup/tests/test_typeinfo.py 2005-08-15 11:12:11 UTC (rev 37934)
@@ -208,7 +208,7 @@
found = configurator.getTypeInfo('foo')
expected = _TI_LIST[0]
- self.assertEqual(found['kind'], 'Factory-based Type Information')
+ self.assertEqual(found['meta_type'], 'Factory-based Type Information')
for key in ('id', 'aliases'):
self.assertEqual(found[key], expected[key])
@@ -233,7 +233,7 @@
found = configurator.getTypeInfo('bar')
expected = _TI_LIST[1]
- self.assertEqual(found['kind'], 'Scriptable Type Information')
+ self.assertEqual(found['meta_type'], 'Scriptable Type Information')
for key in ('id', 'aliases'):
self.assertEqual(found[key], expected[key])
@@ -356,6 +356,7 @@
'id': 'foo',
'title': 'Foo',
'description': 'Foo things',
+ 'i18n_domain': 'foo_domain',
'content_meta_type': 'Foo Thing',
'content_icon': 'foo.png',
'product': 'CMFSetup',
@@ -509,10 +510,12 @@
_FOO_EXPORT = """\
<type-info
+ i18n:domain="foo_domain"
id="%s"
- kind="Factory-based Type Information">
- <property name="title">Foo</property>
- <property name="description">Foo things</property>
+ kind="Factory-based Type Information"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <property name="title" i18n:translate="">Foo</property>
+ <property name="description" i18n:translate="">Foo things</property>
<property name="content_icon">foo.png</property>
<property name="content_meta_type">Foo Thing</property>
<property name="product">CMFSetup</property>
@@ -617,7 +620,8 @@
_BAR_EXPORT = """\
<type-info
id="%s"
- kind="Scriptable Type Information">
+ kind="Scriptable Type Information"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<property name="title">Bar</property>
<property name="description">Bar things</property>
<property name="content_icon">bar.png</property>
Modified: CMF/trunk/CMFSetup/tests/test_utils.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_utils.py 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFSetup/tests/test_utils.py 2005-08-15 11:12:11 UTC (rev 37934)
@@ -312,6 +312,7 @@
EXPECTED = { 'id': 'dummy',
'meta_type': 'Dummy Type',
+ 'i18n_domain': None,
'properties': _NORMAL_PROPERTY_INFO,
'subobjects': () }
Modified: CMF/trunk/CMFSetup/typeinfo.py
===================================================================
--- CMF/trunk/CMFSetup/typeinfo.py 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFSetup/typeinfo.py 2005-08-15 11:12:11 UTC (rev 37934)
@@ -99,6 +99,9 @@
for prop_info in info['properties']:
tic.initProperty(type_info, prop_info)
+ if 'i18n:domain' in info:
+ type_info.i18n_domain = info['i18n:domain']
+
if 'actions' in info:
type_info._actions = info['actions']
@@ -274,12 +277,13 @@
return {
'type-info':
- { 'id': {},
+ { 'i18n:domain': {},
+ 'id': {},
'kind': {},
'aliases': {CONVERTER: self._convertAliases},
'action': {KEY: 'actions'},
'property': {KEY: 'properties', DEFAULT: ()},
- },
+ 'xmlns:i18n': {} },
'aliases':
{ 'alias': {KEY: None} },
'alias':
@@ -313,9 +317,8 @@
security = ClassSecurityInfo()
- security.declareProtected( ManagePortal, 'getTypeInfo' )
- def getTypeInfo( self, type_id ):
-
+ security.declareProtected(ManagePortal, 'getTypeInfo')
+ def getTypeInfo(self, type_id):
""" Return a mapping for the given type info in the site.
o These mappings are pretty much equivalent to the stock
@@ -323,9 +326,12 @@
CMF.
"""
ti = self._getTI(type_id)
- return self._makeTIMapping(ti)
+ ti_info = self._extractObject(ti)
+ ti_info['aliases'] = ti.getMethodAliases()
+ ti_info['actions'] = [ ai.getMapping() for ai in ti.listActions() ]
+ return ti_info
- security.declarePrivate('_getTI' )
+ security.declarePrivate('_getTI')
def _getTI(self, type_id):
"""Get the TI from its id."""
typestool = getToolByName(self._site, 'portal_types')
@@ -334,26 +340,6 @@
except KeyError:
raise ValueError("Unknown type: %s" % type_id)
- security.declarePrivate( '_makeTIMapping' )
- def _makeTIMapping( self, ti ):
-
- """ Convert a TypeInformation object into the appropriate mapping.
- """
- return {
- 'id': ti.getId(),
- 'kind': ti.meta_type,
- 'aliases': ti.getMethodAliases(),
- 'actions': [ai.getMapping() for ai in ti.listActions()],
- }
-
- security.declareProtected(ManagePortal, 'generateProperties')
- def generateProperties(self, type_id):
- """Get a sequence of mappings for properties."""
- ti = self._getTI(type_id)
- prop_infos = [self._extractProperty(ti, prop_map)
- for prop_map in ti._propertyMap()]
- return self.generatePropertyNodes(prop_infos)
-
def _getExportTemplate(self):
return PageTemplateFile('ticTypeExport.xml', _xmldir)
Modified: CMF/trunk/CMFSetup/utils.py
===================================================================
--- CMF/trunk/CMFSetup/utils.py 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFSetup/utils.py 2005-08-15 11:12:11 UTC (rev 37934)
@@ -212,18 +212,21 @@
return {
'object':
- { 'name': {KEY: 'id'},
+ { 'i18n:domain': {},
+ 'name': {KEY: 'id'},
'meta_type': {},
'insert-before': {},
'insert-after': {},
'property': {KEY: 'properties', DEFAULT: ()},
- 'object': {KEY: 'objects', DEFAULT: ()} },
+ 'object': {KEY: 'objects', DEFAULT: ()},
+ 'xmlns:i18n': {} },
'property':
{ 'name': {KEY: 'id'},
'#text': {KEY: 'value', DEFAULT: ''},
'element': {KEY: 'elements', DEFAULT: ()},
'type': {},
- 'select_variable': {} },
+ 'select_variable': {},
+ 'i18n:translate': {} },
'element':
{ 'value': {KEY: None} },
'description':
@@ -273,6 +276,9 @@
[ self.initObject(obj, info) for info in o_info['objects'] ]
+ if 'i18n:domain' in o_info:
+ obj.i18n_domain = o_info['i18n:domain']
+
[ self.initProperty(obj, info) for info in o_info['properties'] ]
security.declareProtected(ManagePortal, 'initProperty')
@@ -352,10 +358,15 @@
properties = []
subobjects = []
+ i18n_domain = getattr(obj, 'i18n_domain', None)
if getattr( aq_base(obj), '_propertyMap' ):
for prop_map in obj._propertyMap():
- properties.append( self._extractProperty(obj, prop_map) )
+ prop_info = self._extractProperty(obj, prop_map)
+ if i18n_domain and prop_info['id'] in ('title', 'description'):
+ prop_info['i18ned'] = ''
+ if prop_info['id'] != 'i18n_domain':
+ properties.append(prop_info)
if getattr( aq_base(obj), 'objectValues' ):
for sub in obj.objectValues():
@@ -363,6 +374,7 @@
return { 'id': obj.getId(),
'meta_type': obj.meta_type,
+ 'i18n_domain': i18n_domain or None,
'properties': tuple(properties),
'subobjects': tuple(subobjects) }
Modified: CMF/trunk/CMFSetup/xml/apcExport.xml
===================================================================
--- CMF/trunk/CMFSetup/xml/apcExport.xml 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFSetup/xml/apcExport.xml 2005-08-15 11:12:11 UTC (rev 37934)
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
-<actions-tool xmlns:tal="http://xml.zope.org/namespaces/tal">
- <tal:loop tal:repeat="info here/listProviderInfo"
+<actions-tool xmlns:tal="http://xml.zope.org/namespaces/tal"
+ tal:attributes="xmlns:i18n string:http://xml.zope.org/namespaces/i18n">
+ <tal:loop tal:repeat="info context/listProviderInfo"
><action-provider id="portal_actions"
tal:attributes="id info/id;" >
<action action_id="folder_contents"
Modified: CMF/trunk/CMFSetup/xml/object_nodes.xml
===================================================================
--- CMF/trunk/CMFSetup/xml/object_nodes.xml 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFSetup/xml/object_nodes.xml 2005-08-15 11:12:11 UTC (rev 37934)
@@ -1,7 +1,8 @@
<tal:loop xmlns:tal="http://xml.zope.org/namespaces/tal"
tal:repeat="obj_info options/objects">
<object name="ID" meta_type="META TYPE"
- tal:attributes="name obj_info/id;
+ tal:attributes="i18n:domain obj_info/i18n_domain;
+ name obj_info/id;
meta_type obj_info/meta_type"
><tal:span tal:define="prop_infos obj_info/properties"
tal:replace="structure python: context.generatePropertyNodes(prop_infos)"
Modified: CMF/trunk/CMFSetup/xml/property_nodes.xml
===================================================================
--- CMF/trunk/CMFSetup/xml/property_nodes.xml 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFSetup/xml/property_nodes.xml 2005-08-15 11:12:11 UTC (rev 37934)
@@ -3,7 +3,8 @@
<property name="ID"
tal:attributes="name prop_info/id;
type prop_info/type;
- select_variable prop_info/select_variable"
+ select_variable prop_info/select_variable;
+ i18n:translate prop_info/i18ned | nothing"
><tal:span tal:content="prop_info/value"
/><tal:loop tal:repeat="element prop_info/elements">
<element value="VALUE"
Modified: CMF/trunk/CMFSetup/xml/ticTypeExport.xml
===================================================================
--- CMF/trunk/CMFSetup/xml/ticTypeExport.xml 2005-08-15 08:27:00 UTC (rev 37933)
+++ CMF/trunk/CMFSetup/xml/ticTypeExport.xml 2005-08-15 11:12:11 UTC (rev 37934)
@@ -3,14 +3,16 @@
id="foo"
kind="Some Type Information"
tal:define="type_id options/type_id;
- info python: here.getTypeInfo(type_id);
- props python: here.generateProperties(type_id)"
- tal:attributes="id info/id;
- kind info/kind"
- ><properties tal:replace="structure props"/>
+ ti_info python: context.getTypeInfo(type_id)"
+ tal:attributes="xmlns:i18n string:http://xml.zope.org/namespaces/i18n;
+ i18n:domain ti_info/i18n_domain;
+ id ti_info/id;
+ kind ti_info/meta_type"
+ ><tal:span tal:define="prop_infos ti_info/properties"
+ tal:replace="structure python: context.generatePropertyNodes(prop_infos)"/>
<aliases>
<alias from="(Default)" to="foo_view"
- tal:repeat="item info/aliases/items"
+ tal:repeat="item ti_info/aliases/items"
tal:attributes="from python: item[ 0 ]; to python: item[ 1 ];"
/>
</aliases>
@@ -21,7 +23,7 @@
url_expr="string:${object_url}/foo_view"
category="object"
visible="True"
- tal:repeat="action info/actions"
+ tal:repeat="action ti_info/actions"
tal:attributes="action_id action/id;
title action/title;
condition_expr action/condition;
More information about the CMF-checkins
mailing list