notifications: translate messages prefixed with tr:
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
/* global async */
|
||||
/* global angular */
|
||||
|
||||
angular.module('Application').controller('NotificationsController', ['$scope', '$timeout', 'Client', function ($scope, $timeout, Client) {
|
||||
angular.module('Application').controller('NotificationsController', ['$scope', '$timeout', '$translate', 'Client', function ($scope, $timeout, $translate, Client) {
|
||||
$scope.clearAllBusy = false;
|
||||
|
||||
$scope.notifications = [];
|
||||
@@ -20,11 +20,15 @@ angular.module('Application').controller('NotificationsController', ['$scope', '
|
||||
// collapse by default
|
||||
result.forEach(function (r) { r.isCollapsed = true; });
|
||||
|
||||
// attempt to parse the message as json
|
||||
// attempt to translate or parse the message as json
|
||||
result.forEach(function (r) {
|
||||
try {
|
||||
r.messageJson = JSON.parse(r.message);
|
||||
} catch (e) {}
|
||||
if (r.message.slice(0, 3) === 'tr:') {
|
||||
r.message = $translate.instant(r.message.slice(3));
|
||||
} else {
|
||||
try {
|
||||
r.messageJson = JSON.parse(r.message);
|
||||
} catch (e) {}
|
||||
}
|
||||
});
|
||||
|
||||
$scope.notifications = result;
|
||||
|
||||
Reference in New Issue
Block a user