[Zope3-checkins] CVS: Zope3/src/zope/app - size.py:1.7

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Aug 6 11:45:36 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app
In directory cvs.zope.org:/tmp/cvs-serv18235/app

Modified Files:
	size.py 
Log Message:
Mainly I18n of the ISized adapters.


=== Zope3/src/zope/app/size.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/size.py:1.6	Tue Jun  3 11:09:25 2003
+++ Zope3/src/zope/app/size.py	Wed Aug  6 10:45:01 2003
@@ -15,7 +15,7 @@
 
 $Id$
 """
-
+from zope.app.i18n import ZopeMessageIDFactory as _
 from zope.app.interfaces.size import ISized
 from zope.interface import implements
 
@@ -41,15 +41,18 @@
         units, size = self._sortingSize
         if units == 'byte':
             return byteDisplay(size)
-        return u'n/a' # XXX L10N this should be localizable
+        return _('n/a')
 
 def byteDisplay(size):
-    # XXX L10N this should be localizable
     if size == 0:
-        return '0 KB'
+        return _('0 KB')
     if size < 1024:
-        return '1 KB'
+        return _('1 KB')
     if size > 1048576:
-        return '%0.02f MB' % (size / 1048576.0)
-    return '%d KB' % (size / 1024.0)
+        size_str = _('${size} MB')
+        size_str.mapping = {'size': '%0.02f' %(size / 1048576.0)}
+        return size_str
+    size_str = _('${size} KB')
+    size_str.mapping = {'size': '%d' %(size / 1024.0)}
+    return size_str
 




More information about the Zope3-Checkins mailing list