forked from i18next/react-i18next
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreacti18next.min.js
1 lines (1 loc) · 7.43 KB
/
reacti18next.min.js
1
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.reactI18next=e()}}(function(){return function e(t,n,r){function o(u,a){if(!n[u]){if(!t[u]){var c="function"==typeof require&&require;if(!a&&c)return c(u,!0);if(i)return i(u,!0);var l=new Error("Cannot find module '"+u+"'");throw l.code="MODULE_NOT_FOUND",l}var f=n[u]={exports:{}};t[u][0].call(f.exports,function(e){var n=t[u][1][e];return o(n?n:e)},f,f.exports,e,t,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(e,t,n){for(var r=!0;r;){var o=e,i=t,u=n;r=!1,null===o&&(o=Function.prototype);var a=Object.getOwnPropertyDescriptor(o,i);if(void 0!==a){if("value"in a)return a.value;var c=a.get;return void 0===c?void 0:c.call(u)}var l=Object.getPrototypeOf(o);if(null===l)return void 0;e=l,t=i,n=u,r=!0,a=l=void 0}},c=e("react"),l=(r(c),function(e){function t(e,n){o(this,t),a(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e,n),this.i18n=e.i18n}return i(t,e),u(t,[{key:"getChildContext",value:function(){return{i18n:this.i18n}}},{key:"componentWillReceiveProps",value:function(e){this.props.i18n!==e.i18n&&console.error("[react-i18next][I18nextProvider]does not support changing the i18n object.")}},{key:"render",value:function(){var e=this.props.children;return c.Children.only(e)}}]),t}(c.Component));l.propTypes={i18n:c.PropTypes.object.isRequired,children:c.PropTypes.element.isRequired},l.childContextTypes={i18n:c.PropTypes.object.isRequired},n["default"]=l,t.exports=n["default"]},{react:"react"}],2:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var o=e("./translate"),i=r(o),u=e("./interpolate"),a=r(u),c=e("./I18nextProvider"),l=r(c);n["default"]={translate:i["default"],Interpolate:a["default"],I18nextProvider:l["default"]},t.exports=n["default"]},{"./I18nextProvider":1,"./interpolate":3,"./translate":4}],3:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=function(e,t,n){for(var r=!0;r;){var o=e,i=t,u=n;r=!1,null===o&&(o=Function.prototype);var a=Object.getOwnPropertyDescriptor(o,i);if(void 0!==a){if("value"in a)return a.value;var c=a.get;return void 0===c?void 0:c.call(u)}var l=Object.getPrototypeOf(o);if(null===l)return void 0;e=l,t=i,n=u,r=!0,a=l=void 0}},l=e("react"),f=r(l),p=function(e){function t(e,n){o(this,t),c(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e,n),this.i18n=n.i18n,this.t=n.t}return i(t,e),a(t,[{key:"render",value:function(){var e=this,t=this.props.parent||"span",n=this.props.regexp||this.i18n.services.interpolator.regexp,r=u({},this.props.options,{interpolation:{prefix:"#$?",suffix:"?$#"}}),o=this.t(this.props.i18nKey,r);if(!o||"string"!=typeof o)return f["default"].createElement("noscript",null);var i=[];return o.split(n).reduce(function(t,n,r){var o;if(r%2===0){if(0===n.length)return t;o=n}else o=e.props[n];return t.push(o),t},i),f["default"].createElement.apply(this,[t,this.props].concat(i))}}]),t}(l.Component);p.contextTypes={i18n:l.PropTypes.object.isRequired,t:l.PropTypes.func.isRequired},n["default"]=p,t.exports=n["default"]},{react:"react"}],4:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e){return e.displayName||e.name||"Component"}function a(e){return function(t){var n=void 0,r=void 0,a=function(u){function a(e,t){o(this,a),f(Object.getPrototypeOf(a.prototype),"constructor",this).call(this,e,t),r=t.i18n,this.state={i18nLoadedAt:null}}return i(a,u),l(a,[{key:"getChildContext",value:function(){return{t:n}}},{key:"componentWillMount",value:function(){this.mounted=!0,r.loadNamespaces(e),n=r.getFixedT(null,e)}},{key:"componentDidMount",value:function(){var e=this;this.onI18nChanged=function(){e.mounted&&e.setState({i18nLoadedAt:new Date})},r.on("languageChanged loaded",this.onI18nChanged)}},{key:"componentWillUnmount",value:function(){this.mounted=!1,this.onI18nChanged&&(r.off("languageChanged",this.onI18nChanged),r.off("loaded",this.onI18nChanged))}},{key:"onI18nChange",value:function(){this.mounted&&this.setState({i18nLoadedAt:new Date})}},{key:"render",value:function(){var e=this.state.i18nLoadedAt;return s["default"].createElement(t,c({},this.props,{t:n,i18nLoadedAt:e}))}}]),a}(p.Component);return a.contextTypes={i18n:p.PropTypes.object.isRequired},a.childContextTypes={t:p.PropTypes.func.isRequired},a.displayName="Translate["+u(t)+"]",a}}Object.defineProperty(n,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),f=function(e,t,n){for(var r=!0;r;){var o=e,i=t,u=n;r=!1,null===o&&(o=Function.prototype);var a=Object.getOwnPropertyDescriptor(o,i);if(void 0!==a){if("value"in a)return a.value;var c=a.get;return void 0===c?void 0:c.call(u)}var l=Object.getPrototypeOf(o);if(null===l)return void 0;e=l,t=i,n=u,r=!0,a=l=void 0}},p=e("react"),s=r(p);n["default"]=a,t.exports=n["default"]},{react:"react"}]},{},[2])(2)});