[Checkins] SVN: z3c.table/trunk/ - Added translation for ``LinkColumn.linkContent``.

Michael Howitz mh at gocept.com
Tue Dec 29 09:05:44 EST 2009


Log message for revision 107245:
  - Added translation for ``LinkColumn.linkContent``.
  
  - Added ``I18nGetAttrColumn`` which translates its content.
  
  

Changed:
  U   z3c.table/trunk/CHANGES.txt
  U   z3c.table/trunk/src/z3c/table/column.py

-=-
Modified: z3c.table/trunk/CHANGES.txt
===================================================================
--- z3c.table/trunk/CHANGES.txt	2009-12-29 12:16:37 UTC (rev 107244)
+++ z3c.table/trunk/CHANGES.txt	2009-12-29 14:05:44 UTC (rev 107245)
@@ -5,9 +5,11 @@
 0.7.1 (unreleased)
 ------------------
 
-- Nothing changed yet.
+- Added translation for ``LinkColumn.linkContent``.
 
+- Added ``I18nGetAttrColumn`` which translates its content.
 
+
 0.7.0 (2009-12-29)
 ------------------
 

Modified: z3c.table/trunk/src/z3c/table/column.py
===================================================================
--- z3c.table/trunk/src/z3c/table/column.py	2009-12-29 12:16:37 UTC (rev 107244)
+++ z3c.table/trunk/src/z3c/table/column.py	2009-12-29 14:05:44 UTC (rev 107245)
@@ -245,6 +245,13 @@
         return self.getValue(item)
 
 
+class I18nGetAttrColumn(GetAttrColumn):
+    """GetAttrColumn which translates its content."""
+
+    def renderCell(self):
+        return zope.i18n.translate(self.getValue(item))
+
+
 class FormatterColumn(Column):
     """Formatter column."""
 
@@ -333,7 +340,9 @@
 
     def getLinkContent(self, item):
         """Setup link content."""
-        return self.linkContent or getName(item)
+        if self.linkContent:
+            return zope.i18n.translate(self.linkContent, context=self.request)
+        return getName(item)
 
     def renderCell(self, item):
         # setup a tag



More information about the checkins mailing list