Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-gettext

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-gettext - npm Package Compare versions

Comparing version 2.3.11 to 2.4.0

2

bower.json
{
"name": "angular-gettext",
"version": "2.3.11",
"version": "2.4.0",
"main": "dist/angular-gettext.js",

@@ -5,0 +5,0 @@ "ignore": [

@@ -430,3 +430,3 @@ /**

var interpolationContext = angular.extend({}, scope);
var interpolationContext = scope.$new();
var unwatchers = [];

@@ -445,2 +445,4 @@ attributes.forEach(function (attribute) {

});
interpolationContext.$destroy();
});

@@ -484,5 +486,5 @@ return interpolationContext;

scope.$count = countFn(scope);
translated = gettextCatalog.getPlural(scope.$count, msgid, translatePlural, interpolationContext, translateContext);
translated = gettextCatalog.getPlural(scope.$count, msgid, translatePlural, null, translateContext);
} else {
translated = gettextCatalog.getString(msgid, interpolationContext, translateContext);
translated = gettextCatalog.getString(msgid, null, translateContext);
}

@@ -506,3 +508,3 @@ var oldContents = element.contents();

var newWrapper = angular.element('<span>' + translated + '</span>');
$compile(newWrapper.contents())(scope);
$compile(newWrapper.contents())(interpolationContext || scope);
var newContents = newWrapper.contents();

@@ -509,0 +511,0 @@

@@ -1,1 +0,1 @@

angular.module("gettext",[]),angular.module("gettext").constant("gettext",function(t){return t}),angular.module("gettext").factory("gettextCatalog",["gettextPlurals","gettextFallbackLanguage","$http","$cacheFactory","$interpolate","$rootScope",function(i,u,e,t,c,r){var a,l="$$noContext",n='<span id="test" title="test" class="tested">test</span>',g=angular.element("<span>"+n+"</span>").html()!==n,o=function(t){return a.debug&&a.currentLanguage!==a.baseLanguage?a.debugPrefix+t:t},f=function(t){return a.showTranslatedMarkers?a.translatedMarkerPrefix+t+a.translatedMarkerSuffix:t};function h(){r.$broadcast("gettextLanguageChanged")}return a={debug:!1,debugPrefix:"[MISSING]: ",showTranslatedMarkers:!1,translatedMarkerPrefix:"[",translatedMarkerSuffix:"]",strings:{},baseLanguage:"en",currentLanguage:"en",cache:t("strings"),setCurrentLanguage:function(t){this.currentLanguage=t,h()},getCurrentLanguage:function(){return this.currentLanguage},setStrings:function(t,e){this.strings[t]||(this.strings[t]={});var r=i(t,1);for(var a in e){var n=e[a];if(g&&(a=angular.element("<span>"+a+"</span>").html()),angular.isString(n)||angular.isArray(n)){var s={};s[l]=n,n=s}for(var u in this.strings[t][a]||(this.strings[t][a]={}),n){var c=n[u];angular.isArray(c)?this.strings[t][a][u]=c:(this.strings[t][a][u]=[],this.strings[t][a][u][r]=c)}}h()},getStringFormFor:function(t,e,r,a){return t?(((this.strings[t]||{})[e]||{})[a||l]||[])[i(t,r)]:null},getString:function(t,e,r){var a=u(this.currentLanguage);return t=this.getStringFormFor(this.currentLanguage,t,1,r)||this.getStringFormFor(a,t,1,r)||o(t),t=e?c(t)(e):t,f(t)},getPlural:function(t,e,r,a,n){var s=u(this.currentLanguage);return e=this.getStringFormFor(this.currentLanguage,e,t,n)||this.getStringFormFor(s,e,t,n)||o(1===t?e:r),a&&(a.$count=t,e=c(e)(a)),f(e)},loadRemote:function(t){return e({method:"GET",url:t,cache:a.cache}).then(function(t){var e=t.data;for(var r in e)a.setStrings(r,e[r]);return t})}}}]),angular.module("gettext").directive("translate",["gettextCatalog","$parse","$animate","$compile","$window","gettextUtil",function(h,a,m,d,t,x){var e=angular.$$lowercase||angular.lowercase,r=parseInt((/msie (\d+)/.exec(e(t.navigator.userAgent))||[])[1],10),c="translateParams";function n(e,r,n){var t=Object.keys(r).filter(function(t){return x.startsWith(t,c)&&t!==c});if(!t.length)return null;var s=angular.extend({},e),u=[];return t.forEach(function(a){var t=e.$watch(r[a],function(t){var e,r=(e=a,x.lcFirst(e.replace(c,"")));s[r]=t,n(s)});u.push(t)}),e.$on("$destroy",function(){u.forEach(function(t){t()})}),s}return{restrict:"AE",terminal:!0,compile:function(t,e){x.assert(!e.translatePlural||e.translateN,"translate-n","translate-plural"),x.assert(!e.translateN||e.translatePlural,"translate-plural","translate-n");var g=x.trim(t.html()),o=e.translatePlural,f=e.translateContext;return r<=8&&"\x3c!--IE fix--\x3e"===g.slice(-13)&&(g=g.slice(0,-13)),{post:function(s,u,t){var c=a(t.translateN),i=null,l=!0;function e(t){var e;t=t||null,o?((s=i||(i=s.$new())).$count=c(s),e=h.getPlural(s.$count,g,o,t,f)):e=h.getString(g,t,f);var r=u.contents();if(r||e)if(e!==x.trim(r.html())){var a=angular.element("<span>"+e+"</span>");d(a.contents())(s);var n=a.contents();m.enter(n,u),m.leave(r)}else l&&d(r)(s)}var r=n(s,t,e);e(r),l=!1,t.translateN&&s.$watch(t.translateN,function(){e(r)}),s.$on("gettextLanguageChanged",function(){e(r)})}}}}}]),angular.module("gettext").factory("gettextFallbackLanguage",function(){var r={},a=/([^_]+)_[^_]+$/;return function(t){if(r[t])return r[t];var e=a.exec(t);return e?(r[t]=e[1],e[1]):null}}),angular.module("gettext").filter("translate",["gettextCatalog",function(r){function t(t,e){return r.getString(t,null,e)}return t.$stateful=!0,t}]),angular.module("gettext").factory("gettextPlurals",function(){var r={pt_BR:"pt_BR","pt-BR":"pt_BR"};return function(t,e){switch(function(t){r[t]||(r[t]=t.split(/\-|_/).shift());return r[t]}(t)){case"ay":case"bo":case"cgg":case"dz":case"fa":case"id":case"ja":case"jbo":case"ka":case"kk":case"km":case"ko":case"ky":case"lo":case"ms":case"my":case"sah":case"su":case"th":case"tt":case"ug":case"vi":case"wo":case"zh":return 0;case"is":return e%10!=1||e%100==11?1:0;case"jv":return 0!=e?1:0;case"mk":return 1==e||e%10==1?0:1;case"ach":case"ak":case"am":case"arn":case"br":case"fil":case"fr":case"gun":case"ln":case"mfe":case"mg":case"mi":case"oc":case"pt_BR":case"tg":case"ti":case"tr":case"uz":case"wa":case"zh":return 1<e?1:0;case"lv":return e%10==1&&e%100!=11?0:0!=e?1:2;case"lt":return e%10==1&&e%100!=11?0:2<=e%10&&(e%100<10||20<=e%100)?1:2;case"be":case"bs":case"hr":case"ru":case"sr":case"uk":return e%10==1&&e%100!=11?0:2<=e%10&&e%10<=4&&(e%100<10||20<=e%100)?1:2;case"mnk":return 0==e?0:1==e?1:2;case"ro":return 1==e?0:0==e||0<e%100&&e%100<20?1:2;case"pl":return 1==e?0:2<=e%10&&e%10<=4&&(e%100<10||20<=e%100)?1:2;case"cs":case"sk":return 1==e?0:2<=e&&e<=4?1:2;case"sl":return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0;case"mt":return 1==e?0:0==e||1<e%100&&e%100<11?1:10<e%100&&e%100<20?2:3;case"gd":return 1==e||11==e?0:2==e||12==e?1:2<e&&e<20?2:3;case"cy":return 1==e?0:2==e?1:8!=e&&11!=e?2:3;case"kw":return 1==e?0:2==e?1:3==e?2:3;case"ga":return 1==e?0:2==e?1:e<7?2:e<11?3:4;case"ar":return 0==e?0:1==e?1:2==e?2:3<=e%100&&e%100<=10?3:11<=e%100?4:5;default:return 1!=e?1:0}}}),angular.module("gettext").factory("gettextUtil",function(){return{trim:String.prototype.trim?function(t){return"string"==typeof t?t.trim():t}:function(t){return"string"==typeof t?t.replace(/^\s*/,"").replace(/\s*$/,""):t},assert:function(t,e,r){if(!t)throw new Error("You should add a "+e+" attribute whenever you add a "+r+" attribute.")},startsWith:function(t,e){return 0===t.indexOf(e)},lcFirst:function(t){return t.charAt(0).toLowerCase()+t.substr(1)}}});
angular.module("gettext",[]),angular.module("gettext").constant("gettext",function(t){return t}),angular.module("gettext").factory("gettextCatalog",["gettextPlurals","gettextFallbackLanguage","$http","$cacheFactory","$interpolate","$rootScope",function(i,u,e,t,c,r){var a,l="$$noContext",n='<span id="test" title="test" class="tested">test</span>',g=angular.element("<span>"+n+"</span>").html()!==n,o=function(t){return a.debug&&a.currentLanguage!==a.baseLanguage?a.debugPrefix+t:t},f=function(t){return a.showTranslatedMarkers?a.translatedMarkerPrefix+t+a.translatedMarkerSuffix:t};function h(){r.$broadcast("gettextLanguageChanged")}return a={debug:!1,debugPrefix:"[MISSING]: ",showTranslatedMarkers:!1,translatedMarkerPrefix:"[",translatedMarkerSuffix:"]",strings:{},baseLanguage:"en",currentLanguage:"en",cache:t("strings"),setCurrentLanguage:function(t){this.currentLanguage=t,h()},getCurrentLanguage:function(){return this.currentLanguage},setStrings:function(t,e){this.strings[t]||(this.strings[t]={});var r=i(t,1);for(var a in e){var n=e[a];if(g&&(a=angular.element("<span>"+a+"</span>").html()),angular.isString(n)||angular.isArray(n)){var s={};s[l]=n,n=s}for(var u in this.strings[t][a]||(this.strings[t][a]={}),n){var c=n[u];angular.isArray(c)?this.strings[t][a][u]=c:(this.strings[t][a][u]=[],this.strings[t][a][u][r]=c)}}h()},getStringFormFor:function(t,e,r,a){return t?(((this.strings[t]||{})[e]||{})[a||l]||[])[i(t,r)]:null},getString:function(t,e,r){var a=u(this.currentLanguage);return t=this.getStringFormFor(this.currentLanguage,t,1,r)||this.getStringFormFor(a,t,1,r)||o(t),t=e?c(t)(e):t,f(t)},getPlural:function(t,e,r,a,n){var s=u(this.currentLanguage);return e=this.getStringFormFor(this.currentLanguage,e,t,n)||this.getStringFormFor(s,e,t,n)||o(1===t?e:r),a&&(a.$count=t,e=c(e)(a)),f(e)},loadRemote:function(t){return e({method:"GET",url:t,cache:a.cache}).then(function(t){var e=t.data;for(var r in e)a.setStrings(r,e[r]);return t})}}}]),angular.module("gettext").directive("translate",["gettextCatalog","$parse","$animate","$compile","$window","gettextUtil",function(h,a,m,d,t,x){var e=angular.$$lowercase||angular.lowercase,r=parseInt((/msie (\d+)/.exec(e(t.navigator.userAgent))||[])[1],10),c="translateParams";function n(e,r,n){var t=Object.keys(r).filter(function(t){return x.startsWith(t,c)&&t!==c});if(!t.length)return null;var s=e.$new(),u=[];return t.forEach(function(a){var t=e.$watch(r[a],function(t){var e,r=(e=a,x.lcFirst(e.replace(c,"")));s[r]=t,n(s)});u.push(t)}),e.$on("$destroy",function(){u.forEach(function(t){t()}),s.$destroy()}),s}return{restrict:"AE",terminal:!0,compile:function(t,e){x.assert(!e.translatePlural||e.translateN,"translate-n","translate-plural"),x.assert(!e.translateN||e.translatePlural,"translate-plural","translate-n");var g=x.trim(t.html()),o=e.translatePlural,f=e.translateContext;return r<=8&&"\x3c!--IE fix--\x3e"===g.slice(-13)&&(g=g.slice(0,-13)),{post:function(s,u,t){var c=a(t.translateN),i=null,l=!0;function e(t){var e;t=t||null,o?((s=i||(i=s.$new())).$count=c(s),e=h.getPlural(s.$count,g,o,null,f)):e=h.getString(g,null,f);var r=u.contents();if(r||e)if(e!==x.trim(r.html())){var a=angular.element("<span>"+e+"</span>");d(a.contents())(t||s);var n=a.contents();m.enter(n,u),m.leave(r)}else l&&d(r)(s)}var r=n(s,t,e);e(r),l=!1,t.translateN&&s.$watch(t.translateN,function(){e(r)}),s.$on("gettextLanguageChanged",function(){e(r)})}}}}}]),angular.module("gettext").factory("gettextFallbackLanguage",function(){var r={},a=/([^_]+)_[^_]+$/;return function(t){if(r[t])return r[t];var e=a.exec(t);return e?(r[t]=e[1],e[1]):null}}),angular.module("gettext").filter("translate",["gettextCatalog",function(r){function t(t,e){return r.getString(t,null,e)}return t.$stateful=!0,t}]),angular.module("gettext").factory("gettextPlurals",function(){var r={pt_BR:"pt_BR","pt-BR":"pt_BR"};return function(t,e){switch(function(t){r[t]||(r[t]=t.split(/\-|_/).shift());return r[t]}(t)){case"ay":case"bo":case"cgg":case"dz":case"fa":case"id":case"ja":case"jbo":case"ka":case"kk":case"km":case"ko":case"ky":case"lo":case"ms":case"my":case"sah":case"su":case"th":case"tt":case"ug":case"vi":case"wo":case"zh":return 0;case"is":return e%10!=1||e%100==11?1:0;case"jv":return 0!=e?1:0;case"mk":return 1==e||e%10==1?0:1;case"ach":case"ak":case"am":case"arn":case"br":case"fil":case"fr":case"gun":case"ln":case"mfe":case"mg":case"mi":case"oc":case"pt_BR":case"tg":case"ti":case"tr":case"uz":case"wa":case"zh":return 1<e?1:0;case"lv":return e%10==1&&e%100!=11?0:0!=e?1:2;case"lt":return e%10==1&&e%100!=11?0:2<=e%10&&(e%100<10||20<=e%100)?1:2;case"be":case"bs":case"hr":case"ru":case"sr":case"uk":return e%10==1&&e%100!=11?0:2<=e%10&&e%10<=4&&(e%100<10||20<=e%100)?1:2;case"mnk":return 0==e?0:1==e?1:2;case"ro":return 1==e?0:0==e||0<e%100&&e%100<20?1:2;case"pl":return 1==e?0:2<=e%10&&e%10<=4&&(e%100<10||20<=e%100)?1:2;case"cs":case"sk":return 1==e?0:2<=e&&e<=4?1:2;case"sl":return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0;case"mt":return 1==e?0:0==e||1<e%100&&e%100<11?1:10<e%100&&e%100<20?2:3;case"gd":return 1==e||11==e?0:2==e||12==e?1:2<e&&e<20?2:3;case"cy":return 1==e?0:2==e?1:8!=e&&11!=e?2:3;case"kw":return 1==e?0:2==e?1:3==e?2:3;case"ga":return 1==e?0:2==e?1:e<7?2:e<11?3:4;case"ar":return 0==e?0:1==e?1:2==e?2:3<=e%100&&e%100<=10?3:11<=e%100?4:5;default:return 1!=e?1:0}}}),angular.module("gettext").factory("gettextUtil",function(){return{trim:String.prototype.trim?function(t){return"string"==typeof t?t.trim():t}:function(t){return"string"==typeof t?t.replace(/^\s*/,"").replace(/\s*$/,""):t},assert:function(t,e,r){if(!t)throw new Error("You should add a "+e+" attribute whenever you add a "+r+" attribute.")},startsWith:function(t,e){return 0===t.indexOf(e)},lcFirst:function(t){return t.charAt(0).toLowerCase()+t.substr(1)}}});
{
"name": "angular-gettext",
"version": "2.3.11",
"version": "2.4.0",
"title": "Angular Gettext",

@@ -5,0 +5,0 @@ "description": "Gettext support for Angular.js",

@@ -13,3 +13,3 @@ # angular-gettext - gettext utilities for angular.js

Copyright (C) 2013-2017 by Ruben Vermeersch <ruben@rocketeer.be>
Copyright (C) 2013-2018 by Ruben Vermeersch <ruben@rocketeer.be>

@@ -16,0 +16,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc