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

retranslate

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

retranslate - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

dist/retranslate.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.retranslate=t(require("react")):e.retranslate=t(e.react)}(this,function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(t,n){t.exports=e},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),a=Object(r.createContext)(),u=a.Provider,i=a.Consumer,c=function(e){var t=e.children,n=e.params,a=e.dangerouslyTranslateInnerHTML;return o.a.createElement(i,null,function(e){return a?e.translateAsParts(a,n).map(function(e,t){return e.dangerous?o.a.createElement(r.Fragment,{key:t},e.value):o.a.createElement("span",{key:t,dangerouslySetInnerHTML:{__html:e.value}})}):e.translateAsParts(t,n).map(function(e,t){return o.a.createElement(r.Fragment,{key:t},e.value)})})};c.displayName="Message",c.defaultProps={children:"",params:{},dangerouslyTranslateInnerHTML:""};var l=c;function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e,t){return!t||"object"!==s(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function b(e,t){var n=Object.keys(t).map(function(t){return function e(t,n){var r=[],o=new RegExp("{{\\s*".concat(n,"\\s*}}")),a=t.match(o);if(a){r.push({key:n,position:a.index,length:a[0].length});var u=a.index+a.length;e(t.slice(u),n).forEach(function(e){r.push({key:n,position:e.position+u,length:e.length})})}return r}(e,t)}).reduce(function(e,t){return e.concat(t)},[]).sort(function(e,t){return e.position-t.position}),r=[],o=0;n.forEach(function(n){var a=n.key,u=n.position,i=n.length;r.push({dangerous:!1,value:e.slice(o,u)}),r.push({dangerous:!0,value:t[a]}),o=u+i});var a=e.slice(o);return a.length&&r.push({dangerous:!1,value:a}),r.filter(function(e){return e.value})}var g=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),p(this,y(t).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(t,r["Component"]),function(e,t,n){t&&f(e.prototype,t),n&&f(e,n)}(t,[{key:"getContext",value:function(){return{language:this.props.language,translateAsParts:this.translateAsParts.bind(this),translate:this.translate.bind(this)}}},{key:"translateAsParts",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.props,r=n.language,o=n.messages,a=n.fallbackLanguage;return o[r]&&o[r][e]?b(o[r][e],t):o[a]&&o[a][e]?b(o[a][e],t):[{dangerous:!1,value:e}]}},{key:"translate",value:function(e,t){return this.translateAsParts(e,t).map(function(e){return e.value}).join("")}},{key:"render",value:function(){var e=this.props.children;return o.a.createElement(u,{value:this.getContext()},e)}}]),t}();g.displayName="TranslationProvider",g.defaultProps={language:"",children:""};var v=g;function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=function(e){var t=function(t){return o.a.createElement(i,null,function(n){var r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){m(e,t,n[t])})}return e}({translations:n},t);return o.a.createElement(e,r)})};return t.displayName="withTranslations(".concat(function(e){return e.displayName||e.name||"Component"}(e),")"),t};n.d(t,"Message",function(){return O}),n.d(t,"Provider",function(){return j}),n.d(t,"withTranslations",function(){return P}),n.d(t,"WithTranslations",function(){return x});var O=l,j=v,P=h,x=i}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("retranslate",["react"],t):"object"==typeof exports?exports.retranslate=t(require("react")):e.retranslate=t(e.React)}("undefined"!=typeof self?self:this,function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(t,n){t.exports=e},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),a=Object(r.createContext)(),u=a.Provider,i=a.Consumer,c=function(e){var t=e.children,n=e.params,a=e.dangerouslyTranslateInnerHTML;return o.a.createElement(i,null,function(e){return a?e.translateAsParts(a,n).map(function(e,t){return e.dangerous?o.a.createElement(r.Fragment,{key:t},e.value):o.a.createElement("span",{key:t,dangerouslySetInnerHTML:{__html:e.value}})}):e.translateAsParts(t,n).map(function(e,t){return o.a.createElement(r.Fragment,{key:t},e.value)})})};c.displayName="Message",c.defaultProps={children:"",params:{},dangerouslyTranslateInnerHTML:""};var l=c;function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e,t){return!t||"object"!==s(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function b(e,t){var n=Object.keys(t).map(function(t){return function e(t,n){var r=[],o=new RegExp("{{\\s*".concat(n,"\\s*}}")),a=t.match(o);if(a){r.push({key:n,position:a.index,length:a[0].length});var u=a.index+a.length;e(t.slice(u),n).forEach(function(e){r.push({key:n,position:e.position+u,length:e.length})})}return r}(e,t)}).reduce(function(e,t){return e.concat(t)},[]).sort(function(e,t){return e.position-t.position}),r=[],o=0;n.forEach(function(n){var a=n.key,u=n.position,i=n.length;r.push({dangerous:!1,value:e.slice(o,u)}),r.push({dangerous:!0,value:t[a]}),o=u+i});var a=e.slice(o);return a.length&&r.push({dangerous:!1,value:a}),r.filter(function(e){return e.value})}var g=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),p(this,y(t).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(t,r["Component"]),function(e,t,n){t&&f(e.prototype,t),n&&f(e,n)}(t,[{key:"getContext",value:function(){return{language:this.props.language,translateAsParts:this.translateAsParts.bind(this),translate:this.translate.bind(this)}}},{key:"translateAsParts",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.props,r=n.language,o=n.messages,a=n.fallbackLanguage;return o[r]&&o[r][e]?b(o[r][e],t):o[a]&&o[a][e]?b(o[a][e],t):[{dangerous:!1,value:e}]}},{key:"translate",value:function(e,t){return this.translateAsParts(e,t).map(function(e){return e.value}).join("")}},{key:"render",value:function(){var e=this.props.children;return o.a.createElement(u,{value:this.getContext()},e)}}]),t}();g.displayName="TranslationProvider",g.defaultProps={language:"",children:""};var v=g;function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=function(e){var t=function(t){return o.a.createElement(i,null,function(n){var r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){m(e,t,n[t])})}return e}({translations:n},t);return o.a.createElement(e,r)})};return t.displayName="withTranslations(".concat(function(e){return e.displayName||e.name||"Component"}(e),")"),t};n.d(t,"Message",function(){return O}),n.d(t,"Provider",function(){return j}),n.d(t,"withTranslations",function(){return P}),n.d(t,"WithTranslations",function(){return x});var O=l,j=v,P=h,x=i}])});
//# sourceMappingURL=retranslate.js.map

@@ -5,3 +5,3 @@ {

"main": "dist/retranslate.js",
"version": "1.0.2",
"version": "1.0.3",
"license": "MIT",

@@ -8,0 +8,0 @@ "bugs": {

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