retranslate
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -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=6)}([function(t,n){t.exports=e},function(e,t,n){e.exports=n(2)()},function(e,t,n){"use strict";var r=n(3),o=n(4),a=n(5);e.exports=function(){function e(e,t,n,r,u,i){i!==a&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";var r=function(e){};e.exports=function(e,t,n,o,a,u,i,s){if(r(t),!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,o,a,u,i,s],f=0;(c=new Error(t.replace(/%s/g,function(){return l[f++]}))).name="Invariant Violation"}throw c.framesToPop=1,c}}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),a=n(1),u=n.n(a),i=Object(r.createContext)(),s=i.Provider,c=i.Consumer,l=function(e){var t=e.children,n=e.params,a=e.dangerouslyTranslateInnerHTML;return o.a.createElement(c,null,function(e){var u=e.translations;return a?u.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}})}):u.translateAsParts(t,n).map(function(e,t){return o.a.createElement(r.Fragment,{key:t},e.value)})})};l.displayName="Message",l.propTypes={children:u.a.string,params:u.a.objectOf(u.a.node),dangerouslyTranslateInnerHTML:u.a.string},l.defaultProps={children:"",params:{},dangerouslyTranslateInnerHTML:""};var f=l;function p(e){return(p="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 y(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 d(e,t){return!t||"object"!==p(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 h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){return(g=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 m=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),d(this,h(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&&g(e,t)}(t,r["Component"]),function(e,t,n){t&&y(e.prototype,t),n&&y(e,n)}(t,[{key:"getContext",value:function(){return{translations:{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(s,{value:this.getContext()},e)}}]),t}();m.displayName="TranslationProvider",m.propTypes={language:u.a.string,fallbackLanguage:u.a.string.isRequired,messages:u.a.objectOf(u.a.objectOf(u.a.node)).isRequired,children:u.a.node},m.defaultProps={language:"",children:""};var v=m;function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var P=function(e){var t=function(t){return o.a.createElement(c,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){O(e,t,n[t])})}return e}({translations:n.translations},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 j}),n.d(t,"Provider",function(){return T}),n.d(t,"withTranslations",function(){return _}),n.d(t,"WithTranslations",function(){return x});var j=f,T=v,_=P,x=c}])}); | ||
!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){var u=e.translations;return a?u.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}})}):u.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 v=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{translations:{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}();v.displayName="TranslationProvider",v.defaultProps={language:"",children:""};var g=v;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.translations},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=g,P=h,x=i}])}); | ||
//# sourceMappingURL=retranslate.js.map |
@@ -5,3 +5,3 @@ { | ||
"main": "dist/retranslate.js", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"license": "MIT", | ||
@@ -35,2 +35,3 @@ "bugs": { | ||
"babel-loader": "^8.0.0-beta.4", | ||
"babel-plugin-transform-react-remove-prop-types": "^0.4.15", | ||
"coveralls": "^3.0.2", | ||
@@ -37,0 +38,0 @@ "enzyme": "^3.4.4", |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
28978
28
21