[Checkins] SVN: z3c.table/trunk/ Added translation for the link title in the column header of the sortable table.

Michael Howitz mh at gocept.com
Sat Jul 31 08:29:39 EDT 2010


Log message for revision 115256:
  Added translation for the link title in the column header of the sortable table.
  
  

Changed:
  U   z3c.table/trunk/CHANGES.txt
  U   z3c.table/trunk/src/z3c/table/header.py
  A   z3c.table/trunk/src/z3c/table/i18n.py
  U   z3c.table/trunk/src/z3c/table/interfaces.py

-=-
Modified: z3c.table/trunk/CHANGES.txt
===================================================================
--- z3c.table/trunk/CHANGES.txt	2010-07-31 09:55:16 UTC (rev 115255)
+++ z3c.table/trunk/CHANGES.txt	2010-07-31 12:29:38 UTC (rev 115256)
@@ -5,7 +5,7 @@
 0.8.1 (unreleased)
 ------------------
 
-- Nothing changed yet.
+- Added translation for the link title in the column header.
 
 
 0.8.0 (2009-12-29)

Modified: z3c.table/trunk/src/z3c/table/header.py
===================================================================
--- z3c.table/trunk/src/z3c/table/header.py	2010-07-31 09:55:16 UTC (rev 115255)
+++ z3c.table/trunk/src/z3c/table/header.py	2010-07-31 12:29:38 UTC (rev 115256)
@@ -16,8 +16,10 @@
 """
 __docformat__ = "reStructuredText"
 
-from urllib import urlencode
-from z3c.table import interfaces
+
+from z3c.table.i18n import _
+import urllib
+import z3c.table.interfaces
 import zope.i18n
 import zope.interface
 
@@ -25,7 +27,7 @@
 class ColumnHeader(object):
     """ColumnHeader renderer provider"""
 
-    zope.interface.implements(interfaces.IColumnHeader)
+    zope.interface.implements(z3c.table.interfaces.IColumnHeader)
 
     _request_args = []
 
@@ -91,9 +93,10 @@
         args = self.getQueryStringArgs()
         args.update({'%s-sortOn' % prefix: colID,
                      '%s-sortOrder' % prefix: sortOrder})
-        queryString = '?%s' % (urlencode(args))
+        queryString = '?%s' % (urllib.urlencode(args))
 
-        return '<a href="%s" title="Sort">%s</a>' % (
+        return '<a href="%s" title="%s">%s</a>' % (
             queryString,
+            zope.i18n.translate(_('Sort'), context=self.request),
             zope.i18n.translate(self.column.header, context=self.request))
 

Added: z3c.table/trunk/src/z3c/table/i18n.py
===================================================================
--- z3c.table/trunk/src/z3c/table/i18n.py	                        (rev 0)
+++ z3c.table/trunk/src/z3c/table/i18n.py	2010-07-31 12:29:38 UTC (rev 115256)
@@ -0,0 +1,17 @@
+##############################################################################
+#
+# Copyright (c) 2010 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+import zope.i18nmessageid
+
+
+_ = zope.i18nmessageid.MessageFactory('z3c')


Property changes on: z3c.table/trunk/src/z3c/table/i18n.py
___________________________________________________________________
Added: svn:keywords
   + Id Rev Date
Added: svn:eol-style
   + native

Modified: z3c.table/trunk/src/z3c/table/interfaces.py
===================================================================
--- z3c.table/trunk/src/z3c/table/interfaces.py	2010-07-31 09:55:16 UTC (rev 115255)
+++ z3c.table/trunk/src/z3c/table/interfaces.py	2010-07-31 12:29:38 UTC (rev 115256)
@@ -11,27 +11,19 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""
-$Id:$
-"""
-__docformat__ = "reStructuredText"
-
+from z3c.table.i18n import _
+import zope.contentprovider.interfaces
 import zope.interface
 import zope.schema
-import zope.i18nmessageid
 
-from zope.contentprovider.interfaces import IContentProvider
 
-_ = zope.i18nmessageid.MessageFactory('z3c')
-
-
 class IValues(zope.interface.Interface):
     """Table value adapter."""
 
     values = zope.interface.Attribute('Iterable table row data sequence.')
 
 
-class ITable(IContentProvider):
+class ITable(zope.contentprovider.interfaces.IContentProvider):
     """Table provider"""
 
     columnCounter = zope.schema.Int(
@@ -237,7 +229,7 @@
     """None cell used for colspan."""
 
 
-class IBatchProvider(IContentProvider):
+class IBatchProvider(zope.contentprovider.interfaces.IContentProvider):
     """Batch content provider"""
 
     def renderBatchLink(batch, cssClass=None):
@@ -246,6 +238,7 @@
     def render():
         """Plain render method without keyword arguments."""
 
+
 class IColumnHeader(zope.interface.Interface):
     """Multi-adapter for header rendering."""
 



More information about the checkins mailing list