src/directive/translate-attr.js
function () {
        angular.forEach(translateAttr, function (translationId, attributeName) {
          if (!translationId) {
            return;
          }
          previousAttributes[attributeName] = true;

          // if translation id starts with '.' and translateNamespace given, prepend namespace
          if (scope.translateNamespace && translationId.charAt(0) === '.') {
            translationId = scope.translateNamespace + translationId;
          }
          $translate(translationId, translateValues, attr.translateInterpolation, undefined, scope.translateLanguage, translateSanitizeStrategy)
            .then(function (translation) {
              element.attr(attributeName, translation);
            }, function (translationId) {
              element.attr(attributeName, translationId);
            });
        });

        // Removing unused attributes that were previously used
        angular.forEach(previousAttributes, function (flag, attributeName) {
          if (!translateAttr[attributeName]) {
            element.removeAttr(attributeName);
            delete previousAttributes[attributeName];
          }
        });
      }
function () {
        angular.forEach(translateAttr, function (translationId, attributeName) {
          if (!translationId) {
            return;
          }
          previousAttributes[attributeName] = true;

          // if translation id starts with '.' and translateNamespace given, prepend namespace
          if (scope.translateNamespace && translationId.charAt(0) === '.') {
            translationId = scope.translateNamespace + translationId;
          }
          $translate(translationId, translateValues, attr.translateInterpolation, undefined, scope.translateLanguage, translateSanitizeStrategy)
            .then(function (translation) {
              element.attr(attributeName, translation);
            }, function (translationId) {
              element.attr(attributeName, translationId);
            });
        });

        // Removing unused attributes that were previously used
        angular.forEach(previousAttributes, function (flag, attributeName) {
          if (!translateAttr[attributeName]) {
            element.removeAttr(attributeName);
            delete previousAttributes[attributeName];
          }
        });
      }
function ( ) { angular . forEach ( translateAttr , function ( translationId , attributeName ) { if ( ! translationId ) { return ; } previousAttributes [ attributeName ] = true ; // if translation id starts with '.' and translateNamespace given, prepend namespace if ( scope . translateNamespace && translationId . charAt ( 0 ) === '.' ) { translationId = scope . translateNamespace + translationId ; } $translate ( translationId , translateValues , attr . translateInterpolation , undefined , scope . translateLanguage , translateSanitizeStrategy ) . then ( function ( translation ) { element . attr ( attributeName , translation ) ; } , function ( translationId ) { element . attr ( attributeName , translationId ) ; } ) ; } ) ; // Removing unused attributes that were previously used angular . forEach ( previousAttributes , function ( flag , attributeName ) { if ( ! translateAttr [ attributeName ] ) { element . removeAttr ( attributeName ) ; delete previousAttributes [ attributeName ] ; } } ) ; }
Main update translations function
Main update translations function