forked from nvdnkpr/angular-localize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular-localize.min.js
2 lines (2 loc) · 1.7 KB
/
angular-localize.min.js
1
2
!function(){"use strict";function a(a){var b=typeof a;if("string"===b)return function(){return a};if("function"===b)return a;throw"not a function"}angular.module("localize",["ngSanitize"]).filter("escapeHTML",function(){var a={encReg:/[<>&"]/g,encMap:{"<":"<",">":">","&":"&",'"':"""},encFunc:function(b){return a.encMap[b]}};return function(b){return String(b).replace(a.encReg,a.encFunc)}}).factory("localizeConfig",["$window",function(a){return{i18n:a.i18n,observableAttrs:/^data-(?!ng-|localize)/}}]).factory("localize",["$filter","localizeConfig",function(b,c){var d=c.i18n,e=b("escapeHTML");return function(b,c,f){var g,h=d[b];return h?(h=a(h),f&&(g={},angular.forEach(c,function(a,b){g[b]=e(a)})),h(g||c||{})):b}}]).filter("localize",["localize",function(a){return a}]).directive("localize",["$sanitize","$filter","localizeConfig",function(b,c,d){var e=d.i18n,f=c("escapeHTML");return function(c,g,h){var i,j,k,l=h.localize||g.html(),m=e[l],n=/input|textarea/i.test(g.prop("nodeName"));m?(m=a(m),n?j=function(){h.$set("placeholder",m(h))}:h.localize?j=function(){g.text(m(h))}:(i={},j=function(a,c){a&&(i[a]=f(c)),g.html(b(m(i)))}),angular.forEach(h.$attr,function(a,b){d.observableAttrs.test(a)&&(h.$observe(b,n||h.localize?j:function(a){j(b,a)}),k=!0)}),k||j()):h.localize&&(n?h.$set("placeholder",l):g.text(l))}}]).factory("localizeFactory",["localizeConfig",function(b){var c=b.i18n;return function(){var d={link:function(e,f,g){var h,i,j=d.name,k=j.charAt(8).toLowerCase()+j.slice(9),l=g[j],m=c[l];m?(m=a(m),h=function(){g.$set(k,m(g))},angular.forEach(g.$attr,function(a,c){b.observableAttrs.test(a)&&(g.$observe(c,h),i=!0)}),i||h()):g.$set(k,l)}};return d}}])}();
//# sourceMappingURL=angular-localize.min.js.map