Skip to content

Commit

Permalink
Merge pull request #55 from schoes/master
Browse files Browse the repository at this point in the history
possibility to not translate message even if the translate filter is ava...
  • Loading branch information
JanStevens committed Nov 11, 2014
2 parents 611613c + af0a299 commit dfaf8d0
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/growlFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ angular.module("angular-growl").provider("growl", function() {
_disableCloseButton = false,
_disableIcons = false,
_reverseOrder = false,
_disableCountDown = false;
_disableCountDown = false,
_translateMessages = true;

/**
* set a global timeout (time to live) after which messages will be automatically closed
Expand All @@ -37,6 +38,15 @@ angular.module("angular-growl").provider("growl", function() {
}
};

/**
* set whether the messages should be translated (default:true) when the translator is available
*
* @param {bool} translateMessages true to to translate all messages
*/
this.globalTranslateMessages = function (translateMessages) {
_translateMessages = translateMessages;
};

/**
* set whether the close button should be displayed (default) or hidden
*
Expand Down Expand Up @@ -177,7 +187,7 @@ angular.module("angular-growl").provider("growl", function() {
}

function broadcastMessage(message) {
if (translate) {
if (translate && message.translateMessage) {
message.text = translate(message.text, message.variables);
} else {
var polation = $interpolate(message.text);
Expand All @@ -203,6 +213,7 @@ angular.module("angular-growl").provider("growl", function() {
disableCountDown: _config.disableCountDown === undefined ? _disableCountDown : _config.disableCountDown,
position: _config.position || _position,
referenceId: _config.referenceId || _referenceId,
translateMessage: _config.translateMessage === undefined ? _translateMessages : _config.translateMessage,
destroy: function() {
growlMessages.deleteMessage(message);
},
Expand Down

0 comments on commit dfaf8d0

Please sign in to comment.