use non-breakable space in time display
authorsylvain.thenault@logilab.fr
Thu, 26 Feb 2009 14:01:00 +0100
changeset 978 536c748e7b3f
parent 977 d8bb6209edcd
child 979 93447d75c4b9
use non-breakable space in time display
i18n/en.po
i18n/es.po
i18n/fr.po
web/views/baseforms.py
web/views/baseviews.py
--- a/i18n/en.po	Thu Feb 26 13:45:14 2009 +0100
+++ b/i18n/en.po	Thu Feb 26 14:01:00 2009 +0100
@@ -47,10 +47,26 @@
 msgstr ""
 
 #, python-format
+msgid "%d days"
+msgstr ""
+
+#, python-format
+msgid "%d hours"
+msgstr ""
+
+#, python-format
+msgid "%d minutes"
+msgstr ""
+
+#, python-format
 msgid "%d months"
 msgstr ""
 
 #, python-format
+msgid "%d seconds"
+msgstr ""
+
+#, python-format
 msgid "%d weeks"
 msgstr ""
 
@@ -59,7 +75,31 @@
 msgstr ""
 
 #, python-format
-msgid "%s days"
+msgid "%d days"
+msgstr ""
+
+#, python-format
+msgid "%d hours"
+msgstr ""
+
+#, python-format
+msgid "%d minutes"
+msgstr ""
+
+#, python-format
+msgid "%d months"
+msgstr ""
+
+#, python-format
+msgid "%d seconds"
+msgstr ""
+
+#, python-format
+msgid "%d weeks"
+msgstr ""
+
+#, python-format
+msgid "%d years"
 msgstr ""
 
 #, python-format
@@ -67,14 +107,6 @@
 msgstr ""
 
 #, python-format
-msgid "%s hours"
-msgstr ""
-
-#, python-format
-msgid "%s minutes"
-msgstr ""
-
-#, python-format
 msgid "%s not estimated"
 msgstr ""
 
@@ -83,10 +115,6 @@
 msgstr ""
 
 #, python-format
-msgid "%s seconds"
-msgstr ""
-
-#, python-format
 msgid "%s software version of the database"
 msgstr ""
 
--- a/i18n/es.po	Thu Feb 26 13:45:14 2009 +0100
+++ b/i18n/es.po	Thu Feb 26 14:01:00 2009 +0100
@@ -52,34 +52,66 @@
 msgstr "%(subject)s %(etype)s #%(eid)s (%(login)s)"
 
 #, python-format
+msgid "%d days"
+msgstr "%d días"
+
+#, python-format
+msgid "%d hours"
+msgstr "%d horas"
+
+#, python-format
+msgid "%d minutes"
+msgstr "%d minutos"
+
+#, python-format
 msgid "%d months"
 msgstr "%d meses"
 
 #, python-format
+msgid "%d seconds"
+msgstr "%d segundos"
+
+#, python-format
 msgid "%d weeks"
 msgstr "%d semanas"
 
 #, python-format
-msgid "%d years"
-msgstr "%d años"
+msgid "%d years"
+msgstr "%d años"
+
+#, python-format
+msgid "%d days"
+msgstr "%d días"
+
+#, python-format
+msgid "%d hours"
+msgstr "%d horas"
 
 #, python-format
-msgid "%s days"
-msgstr "%d días"
+msgid "%d minutes"
+msgstr "%d minutos"
+
+#, python-format
+msgid "%d months"
+msgstr "%d meses"
+
+#, python-format
+msgid "%d seconds"
+msgstr "%d segundos"
+
+#, python-format
+msgid "%d weeks"
+msgstr "%d semanas"
+
+#, python-format
+msgid "%d years"
+msgstr "%d años"
 
 #, python-format
 msgid "%s error report"
 msgstr "%s reporte de errores"
 
 #, python-format
-msgid "%s hours"
-msgstr "%s horas"
-
-#, python-format
-msgid "%s minutes"
-msgstr "%s minutos"
-
-#, python-format
 msgid "%s not estimated"
 msgstr "%s no estimado(s)"
 
@@ -88,10 +120,6 @@
 msgstr "%s resultados de la demanda"
 
 #, python-format
-msgid "%s seconds"
-msgstr "%s segundos"
-
-#, python-format
 msgid "%s software version of the database"
 msgstr "version sistema de la base para %s"
 
--- a/i18n/fr.po	Thu Feb 26 13:45:14 2009 +0100
+++ b/i18n/fr.po	Thu Feb 26 14:01:00 2009 +0100
@@ -52,10 +52,26 @@
 msgstr "%(subject)s %(etype)s #%(eid)s (%(login)s)"
 
 #, python-format
+msgid "%d days"
+msgstr "%d jours"
+
+#, python-format
+msgid "%d hours"
+msgstr "%d heures"
+
+#, python-format
+msgid "%d minutes"
+msgstr "%d minutes"
+
+#, python-format
 msgid "%d months"
 msgstr "%d mois"
 
 #, python-format
+msgid "%d seconds"
+msgstr "%d secondes"
+
+#, python-format
 msgid "%d weeks"
 msgstr "%d semaines"
 
@@ -64,22 +80,38 @@
 msgstr "%d années"
 
 #, python-format
-msgid "%s days"
-msgstr "%d jours"
+msgid "%d days"
+msgstr "%d jours"
+
+#, python-format
+msgid "%d hours"
+msgstr "%d heures"
+
+#, python-format
+msgid "%d minutes"
+msgstr "%d minutes"
+
+#, python-format
+msgid "%d months"
+msgstr "%d mois"
+
+#, python-format
+msgid "%d seconds"
+msgstr "%d secondes"
+
+#, python-format
+msgid "%d weeks"
+msgstr "%d semaines"
+
+#, python-format
+msgid "%d years"
+msgstr "%d années"
 
 #, python-format
 msgid "%s error report"
 msgstr "%s rapport d'erreur"
 
 #, python-format
-msgid "%s hours"
-msgstr "%s heures"
-
-#, python-format
-msgid "%s minutes"
-msgstr "%s minutes"
-
-#, python-format
 msgid "%s not estimated"
 msgstr "%s non estimé(s)"
 
@@ -88,10 +120,6 @@
 msgstr "%s résultats pour la requête"
 
 #, python-format
-msgid "%s seconds"
-msgstr "%s secondes"
-
-#, python-format
 msgid "%s software version of the database"
 msgstr "version logicielle de la base pour %s"
 
--- a/web/views/baseforms.py	Thu Feb 26 13:45:14 2009 +0100
+++ b/web/views/baseforms.py	Thu Feb 26 14:01:00 2009 +0100
@@ -521,7 +521,6 @@
     def on_submit(self, entity):
         return u'return freezeFormButtons(\'%s\')' % (self.domid)
 
-
     def submited_message(self):
         return self.req._('element edited')
 
--- a/web/views/baseviews.py	Thu Feb 26 13:45:14 2009 +0100
+++ b/web/views/baseviews.py	Thu Feb 26 14:01:00 2009 +0100
@@ -58,6 +58,21 @@
     entities) 
     """
     id = 'final'
+    # record generated i18n catalog messages
+    _('%d years')
+    _('%d months')
+    _('%d weeks')
+    _('%d days')
+    _('%d hours')
+    _('%d minutes')
+    _('%d seconds')
+    _('%d years')
+    _('%d months')
+    _('%d weeks')
+    _('%d days')
+    _('%d hours')
+    _('%d minutes')
+    _('%d seconds')
             
     def cell_call(self, row, col, props=None, displaytime=False, format='text/html'):
         etype = self.rset.description[row][col]
@@ -69,23 +84,26 @@
                 self.w(entity.printable_value(rtype, value, format=format))
                 return
         if etype in ('Time', 'Interval'):
-            _ = self.req._
             # value is DateTimeDelta but we have no idea about what is the 
             # reference date here, so we can only approximate years and months
+            if format == 'text/html':
+                space = ' '
+            else:
+                space = ' '
             if value.days > 730: # 2 years
-                self.w(_('%d years') % (value.days // 365))
+                self.w(self.req.__('%%d%syears' % space) % (value.days // 365))
             elif value.days > 60: # 2 months
-                self.w(_('%d months') % (value.days // 30))
+                self.w(self.req.__('%%d%smonths' % space) % (value.days // 30))
             elif value.days > 14: # 2 weeks
-                self.w(_('%d weeks') % (value.days // 7))
+                self.w(self.req.__('%%d%sweeks' % space) % (value.days // 7))
             elif value.days > 2:
-                self.w(_('%s days') % int(value.days))
+                self.w(self.req.__('%%d%sdays' % space) % int(value.days))
             elif value.hours > 2:
-                self.w(_('%s hours') % int(value.hours))
+                self.w(self.req.__('%%d%shours' % space) % int(value.hours))
             elif value.minutes >= 2:
-                self.w(_('%s minutes') % int(value.minutes))
+                self.w(self.req.__('%%d%sminutes' % space) % int(value.minutes))
             else:
-                self.w(_('%s seconds') % int(value.seconds))
+                self.w(self.req.__('%%d%sseconds' % space) % int(value.seconds))
             return
         self.wdata(printable_value(self.req, etype, value, props, displaytime=displaytime))