changeset 2993:716550e1e4fa beta

fixed way of creating notification template for better translations
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 09 Nov 2012 19:21:16 +0100
parents 3bc8d2e08966
children af0d7d8acb22
files rhodecode/model/notification.py
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/model/notification.py	Thu Nov 08 14:24:31 2012 +0100
+++ b/rhodecode/model/notification.py	Fri Nov 09 19:21:16 2012 +0100
@@ -217,16 +217,16 @@
         #alias
         _n = notification
         _map = {
-            _n.TYPE_CHANGESET_COMMENT: _('commented on commit'),
-            _n.TYPE_MESSAGE: _('sent message'),
-            _n.TYPE_MENTION: _('mentioned you'),
-            _n.TYPE_REGISTRATION: _('registered in RhodeCode'),
-            _n.TYPE_PULL_REQUEST: _('opened new pull request'),
-            _n.TYPE_PULL_REQUEST_COMMENT: _('commented on pull request')
+            _n.TYPE_CHANGESET_COMMENT: _('commented on commit at %(when)s'),
+            _n.TYPE_MESSAGE: _('sent message at %(when)s'),
+            _n.TYPE_MENTION: _('mentioned you at %(when)s'),
+            _n.TYPE_REGISTRATION: _('registered in RhodeCode at %(when)s'),
+            _n.TYPE_PULL_REQUEST: _('opened new pull request at %(when)s'),
+            _n.TYPE_PULL_REQUEST_COMMENT: _('commented on pull request at %(when)s')
         }
 
         # action == _map string
-        tmpl = "%(user)s %(action)s at %(when)s"
+        tmpl = "%(user)s %(action)s "
         if show_age:
             when = h.age(notification.created_on)
         else:
@@ -234,9 +234,9 @@
 
         data = dict(
             user=notification.created_by_user.username,
-            action=_map[notification.type_], when=when,
+            action=_map[notification.type_]
         )
-        return tmpl % data
+        return (tmpl % data) % {'when': when}
 
 
 class EmailNotificationModel(BaseModel):