@@ -10,7 +10,8 @@ angular.module('flashMessage', ['ng'])
1010 wrapperTemplate : 'flashMessage/wrapper.html' ,
1111 template : 'flashMessage/message.html' ,
1212 showClose : true ,
13- clickToClose : true
13+ clickToClose : true ,
14+ useTranslation : false
1415 } ,
1516 types = [
1617 {
@@ -45,10 +46,13 @@ angular.module('flashMessage', ['ng'])
4546 types [ index ] = item ;
4647 }
4748
49+ return this ;
4850 } ;
4951
5052 this . setConfig = function ( data ) {
5153 options = angular . extend ( options , data ) ;
54+
55+ return this ;
5256 } ;
5357
5458 this . $get = [ '$q' , '$interval' , '$rootScope' , function ( $q , $interval , $rootScope ) {
@@ -79,7 +83,7 @@ angular.module('flashMessage', ['ng'])
7983 } ;
8084
8185 angular . forEach ( types , function ( item ) {
82- me [ item . type ] = function ( data , persist , delay , showClose , template , clickToClose ) {
86+ me [ item . type ] = function ( data , persist , delay , showClose , template , clickToClose , useTranslation ) {
8387
8488 var index = types . map ( function ( x ) { return x . type ; } ) . indexOf ( item . type ) ,
8589 msg ;
@@ -99,6 +103,8 @@ angular.module('flashMessage', ['ng'])
99103 template : getValue ( [ template , types [ index ] . template , options . template , 0 ] ) ,
100104 clickToClose : getValue ( [ clickToClose , types [ index ] . clickToClose , options . clickToClose , 0 ] ) ,
101105 showClose : getValue ( [ showClose , types [ index ] . showClose , options . showClose , 0 ] ) ,
106+ useTranslation : getValue ( [ useTranslation , types [ index ] . useTranslation , options . useTranslation , false ] ) ,
107+
102108 close : function ( data ) {
103109 if ( data === 'clickToClose' && ! msg . clickToClose ) {
104110 return ;
@@ -184,7 +190,8 @@ angular.module('flashMessage', ['ng'])
184190
185191 $templateCache . put ( 'flashMessage/message.html' ,
186192
187- '<span class="flash-message-body" ng-bind-html="msg.data | allowHtmlInMessage"></span>' +
193+ '<span class="flash-message-body" ng-if="!msg.useTranslation" ng-bind-html="msg.data | allowHtmlInMessage"></span>' +
194+ '<span class="flash-message-body" ng-if="msg.useTranslation" ng-bind-html="msg.data | translate | allowHtmlInMessage"></span>' +
188195 '<span class="flash-message-close flash-message-clickable" ng-if="msg.showClose" ng-click="msg.close(\'close\')">×</span>'
189196
190197 ) ;
0 commit comments