diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/localization/localize.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/localization/localize.directive.js index 0a69ef5340..8dadf955bf 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/localization/localize.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/localization/localize.directive.js @@ -3,9 +3,15 @@ angular.module("umbraco.directives") /** * @ngdoc directive * @name umbraco.directives.directive:localize - * @restrict EA + * @restrict E * @function - * @description Localize directive + * @description + * Localize a specific token to put into the HTML as an item + * ##Usage + *
+    * Close
+    * Fallback value
+    * 
**/ .directive('localize', function ($log, localizationService) { return { @@ -24,10 +30,27 @@ angular.module("umbraco.directives") }; }) + /** + * @ngdoc directive + * @name umbraco.directives.directive:localize + * @restrict A + * @function + * @description + * Add a HTML attribute to an element containing the HTML attribute name you wish to localise + * Using the format of '@section_key' or 'section_key' + + * ##Usage + *
+    * 
+    * 
+    * 
+ *
+ **/ .directive('localize', function ($log, localizationService) { return { restrict: 'A', link: function (scope, element, attrs) { + //Support one or more attribute properties to update var keys = attrs.localize.split(','); angular.forEach(keys, function(value, key){ @@ -35,13 +58,15 @@ angular.module("umbraco.directives") if(attr){ if(attr[0] === '@'){ - - var t = localizationService.tokenize(attr.substring(1), scope); - localizationService.localize(t.key, t.tokens).then(function(val){ - element.attr(value, val); - }); - + //If the translation key starts with @ then remove it + attr = attr.substring(1); } + + var t = localizationService.tokenize(attr, scope); + + localizationService.localize(t.key, t.tokens).then(function(val){ + element.attr(value, val); + }); } }); }