##// END OF EJS Templates
notifications: fixed translation problem in my notifications.
marcink -
r1387:fd095af8 default
parent child Browse files
Show More
@@ -38,6 +38,7 b' from rhodecode.model import BaseModel'
38 from rhodecode.model.db import Notification, User, UserNotification
38 from rhodecode.model.db import Notification, User, UserNotification
39 from rhodecode.model.meta import Session
39 from rhodecode.model.meta import Session
40 from rhodecode.model.settings import SettingsModel
40 from rhodecode.model.settings import SettingsModel
41 from rhodecode.translation import TranslationString
41
42
42 log = logging.getLogger(__name__)
43 log = logging.getLogger(__name__)
43
44
@@ -275,6 +276,10 b' class NotificationModel(BaseModel):'
275 date_or_age = h.age(notification.created_on)
276 date_or_age = h.age(notification.created_on)
276 if translate:
277 if translate:
277 date_or_age = translate(date_or_age)
278 date_or_age = translate(date_or_age)
279
280 if isinstance(date_or_age, TranslationString):
281 date_or_age = date_or_age.interpolate()
282
278 else:
283 else:
279 template = templates[1]
284 template = templates[1]
280 date_or_age = h.format_date(notification.created_on)
285 date_or_age = h.format_date(notification.created_on)
@@ -53,7 +53,6 b''
53 <button class="btn" id="test-notification-live" on-tap="testNotificationsLive">Test live notification</button>
53 <button class="btn" id="test-notification-live" on-tap="testNotificationsLive">Test live notification</button>
54 </div>
54 </div>
55 <h4 id="test-response"></h4>
55 <h4 id="test-response"></h4>
56 </div>
57
56
58 </div>
57 </div>
59
58
@@ -16,7 +16,7 b''
16 # RhodeCode Enterprise Edition, including its added features, Support services,
16 # RhodeCode Enterprise Edition, including its added features, Support services,
17 # and proprietary license terms, please see https://rhodecode.com/licenses/
17 # and proprietary license terms, please see https://rhodecode.com/licenses/
18
18
19 from pyramid.i18n import TranslationStringFactory
19 from pyramid.i18n import TranslationStringFactory, TranslationString
20
20
21 # Create a translation string factory for the 'rhodecode' domain.
21 # Create a translation string factory for the 'rhodecode' domain.
22 _ = TranslationStringFactory('rhodecode')
22 _ = TranslationStringFactory('rhodecode')
General Comments 0
You need to be logged in to leave comments. Login now