react-i18next
Advanced tools
Comparing version 11.9.0 to 11.10.0
@@ -0,1 +1,5 @@ | ||
### 11.10.0 | ||
- add transWrapTextNodes option [1324](https://github.com/i18next/react-i18next/pull/1324) to prevent a well-known Google Translate issue with React apps [1323](https://github.com/i18next/react-i18next/issues/1323), thanks to [feross](https://github.com/feross) | ||
### 11.9.0 | ||
@@ -2,0 +6,0 @@ |
@@ -317,2 +317,3 @@ define(['exports', 'react'], function (exports, React) { 'use strict'; | ||
transSupportBasicHtmlNodes: true, | ||
transWrapTextNodes: '', | ||
transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'], | ||
@@ -640,3 +641,11 @@ useSuspense: true | ||
} else if (node.type === 'text') { | ||
mem.push(node.content); | ||
var wrapTextNodes = i18nOptions.transWrapTextNodes; | ||
if (wrapTextNodes) { | ||
mem.push(React__default.createElement(wrapTextNodes, { | ||
key: "".concat(node.name, "-").concat(i) | ||
}, node.content)); | ||
} else { | ||
mem.push(node.content); | ||
} | ||
} | ||
@@ -643,0 +652,0 @@ |
@@ -1,1 +0,1 @@ | ||
define(["exports","react"],(function(e,n){"use strict";var t="default"in n?n.default:n;function r(e){return(r="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 i(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function c(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e,n){if(null==e)return{};var t,r,i=function(e,n){if(null==e)return{};var t,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}function u(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(t.push(o.value),!n||t.length!==n);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return l(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return l(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var f={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},p=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function d(e){var n={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},t=e.match(/<\/?([^\s]+?)[/\s>]/);if(t&&(n.name=t[1],(f[t[1]]||"/"===e.charAt(e.length-2))&&(n.voidElement=!0),n.name.startsWith("!--"))){var r=e.indexOf("--\x3e");return{type:"comment",comment:-1!==r?e.slice(4,r):""}}for(var i=new RegExp(p),a=null;null!==(a=i.exec(e));)if(a[0].trim())if(a[1]){var o=a[1].trim(),c=[o,""];o.indexOf("=")>-1&&(c=o.split("=")),n.attrs[c[0]]=c[1],i.lastIndex--}else a[2]&&(n.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return n}var m=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,g=/^\s*$/,h=Object.create(null);var y,v=function(e,n){n||(n={}),n.components||(n.components=h);var t,r=[],i=[],a=-1,o=!1;if(0!==e.indexOf("<")){var c=e.indexOf("<");r.push({type:"text",content:-1===c?e:e.substring(0,c)})}return e.replace(m,(function(c,s){if(o){if(c!=="</"+t.name+">")return;o=!1}var u,l="/"!==c.charAt(1),f=c.startsWith("\x3c!--"),p=s+c.length,m=e.charAt(p);if(f){var h=d(c);return a<0?(r.push(h),r):((u=i[a]).children.push(h),r)}if(l&&(a++,"tag"===(t=d(c)).type&&n.components[t.name]&&(t.type="component",o=!0),t.voidElement||o||!m||"<"===m||t.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),0===a&&r.push(t),(u=i[a-1])&&u.children.push(t),i[a]=t),(!l||t.voidElement)&&(a>-1&&(t.voidElement||t.name===c.slice(2,-1))&&(a--,t=-1===a?r:i[a]),!o&&"<"!==m&&m)){u=-1===a?r:i[a].children;var y=e.indexOf("<",p),v=e.slice(p,-1===y?void 0:y);g.test(v)&&(v=" "),(y>-1&&a+u.length>=0||" "!==v)&&u.push({type:"text",content:v})}})),r},b={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0},O=t.createContext();function w(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};b=c(c({},b),e)}function j(){return b}var E=function(){function e(){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.usedNamespaces={}}var n,t,r;return n=e,(t=[{key:"addUsedNamespaces",value:function(e){var n=this;e.forEach((function(e){n.usedNamespaces[e]||(n.usedNamespaces[e]=!0)}))}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}])&&i(n.prototype,t),r&&i(n,r),e}();function S(e){y=e}function x(){return y}var N={type:"3rdParty",init:function(e){w(e.options.react),S(e)}};function I(e){return function(n){return new Promise((function(t){var r=k();e.getInitialProps?e.getInitialProps(n).then((function(e){t(c(c({},e),r))})):t(r)}))}}function k(){var e=x(),n=e.reportNamespaces?e.reportNamespaces.getUsedNamespaces():[],t={},r={};return e.languages.forEach((function(t){r[t]={},n.forEach((function(n){r[t][n]=e.getResourceBundle(t,n)||{}}))})),t.initialI18nStore=r,t.initialLanguage=e.language,t}function P(){if(console&&console.warn){for(var e,n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];"string"==typeof t[0]&&(t[0]="react-i18next:: ".concat(t[0])),(e=console).warn.apply(e,t)}}var R={};function C(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];"string"==typeof n[0]&&R[n[0]]||("string"==typeof n[0]&&(R[n[0]]=new Date),P.apply(void 0,n))}function A(e,n,t){e.loadNamespaces(n,(function(){if(e.isInitialized)t();else{e.on("initialized",(function n(){setTimeout((function(){e.off("initialized",n)}),0),t()}))}}))}function T(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!n.languages||!n.languages.length)return C("i18n.languages were undefined or empty",n.languages),!0;var r=n.languages[0],i=!!n.options&&n.options.fallbackLng,a=n.languages[n.languages.length-1];if("cimode"===r.toLowerCase())return!0;var o=function(e,t){var r=n.services.backendConnector.state["".concat(e,"|").concat(t)];return-1===r||2===r};return!(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!o(n.isLanguageChangingTo,e))&&(!!n.hasResourceBundle(r,e)||(!n.services.backendConnector.backend||!(!o(r,e)||i&&!o(a,e))))}function z(e){return e.displayName||e.name||("string"==typeof e&&e.length>0?e:"Unknown")}function L(e,n){if(!e)return!1;var t=e.props?e.props.children:e.children;return n?t.length>0:!!t}function D(e){return e?e&&e.children?e.children:e.props&&e.props.children:[]}function B(e){return Array.isArray(e)?e:[e]}function U(e,n,i,a,o){if(""===n)return[];var s=a.transKeepBasicHtmlNodesFor||[],u=n&&new RegExp(s.join("|")).test(n);if(!e&&!u)return[n];var l={};!function e(n){B(n).forEach((function(n){"string"!=typeof n&&(L(n)?e(D(n)):"object"!==r(n)||t.isValidElement(n)||Object.assign(l,n))}))}(e);var f=i.services.interpolator.interpolate(n,c(c({},l),o),i.language),p=v("<0>".concat(f,"</0>"));function d(e,n,r){var i=D(e),a=g(i,n.children,r);return function(e){return"[object Array]"===Object.prototype.toString.call(e)&&e.every((function(e){return t.isValidElement(e)}))}(i)&&0===a.length?i:a}function m(e,n,r,i,a){e.dummy&&(e.children=n),r.push(t.cloneElement(e,c(c({},e.props),{},{key:i}),a?void 0:n))}function g(n,i,o){var l=B(n);return B(i).reduce((function(n,i,f){var p,h,y,v=i.children&&i.children[0]&&i.children[0].content;if("tag"===i.type){var b=l[parseInt(i.name,10)];!b&&1===o.length&&o[0][i.name]&&(b=o[0][i.name]),b||(b={});var O=0!==Object.keys(i.attrs).length?(p={props:i.attrs},(y=c({},h=b)).props=Object.assign(p.props,h.props),y):b,w=t.isValidElement(O),j=w&&L(i,!0)&&!i.voidElement,E=u&&"object"===r(O)&&O.dummy&&!w,S="object"===r(e)&&null!==e&&Object.hasOwnProperty.call(e,i.name);if("string"==typeof O)n.push(O);else if(L(O)||j){m(O,d(O,i,o),n,f)}else if(E){var x=g(l,i.children,o);n.push(t.cloneElement(O,c(c({},O.props),{},{key:f}),x))}else if(Number.isNaN(parseFloat(i.name))){if(S)m(O,d(O,i,o),n,f,i.voidElement);else if(a.transSupportBasicHtmlNodes&&s.indexOf(i.name)>-1)if(i.voidElement)n.push(t.createElement(i.name,{key:"".concat(i.name,"-").concat(f)}));else{var N=g(l,i.children,o);n.push(t.createElement(i.name,{key:"".concat(i.name,"-").concat(f)},N))}else if(i.voidElement)n.push("<".concat(i.name," />"));else{var I=g(l,i.children,o);n.push("<".concat(i.name,">").concat(I,"</").concat(i.name,">"))}}else if("object"!==r(O)||w)1===i.children.length&&v?n.push(t.cloneElement(O,c(c({},O.props),{},{key:f}),v)):n.push(t.cloneElement(O,c(c({},O.props),{},{key:f})));else{var k=i.children[0]?v:null;k&&n.push(k)}}else"text"===i.type&&n.push(i.content);return n}),[])}return D(g([{dummy:!0,children:e}],p,B(e||[]))[0])}function V(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.i18n,i=n.useContext(O)||{},a=i.i18n,o=i.defaultNS,s=r||a||x();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new E),!s){C("You will need to pass in an i18next instance by using initReactI18next");var l=function(e){return Array.isArray(e)?e[e.length-1]:e},f=[l,{},!1];return f.t=l,f.i18n={},f.ready=!1,f}s.options.react&&void 0!==s.options.react.wait&&C("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var p=c(c(c({},j()),s.options.react),t),d=p.useSuspense,m=e||o||s.options&&s.options.defaultNS;m="string"==typeof m?[m]:m||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(m);var g=(s.isInitialized||s.initializedStoreOnce)&&m.every((function(e){return T(e,s,p)}));function h(){return s.getFixedT(null,"fallback"===p.nsMode?m:m[0])}var y=n.useState(h),v=u(y,2),b=v[0],w=v[1],S=n.useRef(!0);n.useEffect((function(){var e=p.bindI18n,n=p.bindI18nStore;function t(){S.current&&w(h)}return S.current=!0,g||d||A(s,m,(function(){S.current&&w(h)})),e&&s&&s.on(e,t),n&&s&&s.store.on(n,t),function(){S.current=!1,e&&s&&e.split(" ").forEach((function(e){return s.off(e,t)})),n&&s&&n.split(" ").forEach((function(e){return s.store.off(e,t)}))}}),[s,m.join()]);var N=n.useRef(!0);n.useEffect((function(){S.current&&!N.current&&w(h),N.current=!1}),[s]);var I=[b,s,g];if(I.t=b,I.i18n=s,I.ready=g,g)return I;if(!g&&!d)return I;throw new Promise((function(e){A(s,m,(function(){e()}))}))}function K(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r.i18n,a=n.useContext(O)||{},o=a.i18n,c=i||o||x();c.options&&c.options.isClone||(e&&!c.initializedStoreOnce&&(c.services.resourceStore.data=e,c.options.ns=Object.values(e).reduce((function(e,n){return Object.keys(n).forEach((function(n){e.indexOf(n)<0&&e.push(n)})),e}),c.options.ns),c.initializedStoreOnce=!0,c.isInitialized=!0),t&&!c.initializedLanguageOnce&&(c.changeLanguage(t),c.initializedLanguageOnce=!0))}e.I18nContext=O,e.I18nextProvider=function(e){var t=e.i18n,r=e.defaultNS,i=e.children,a=n.useMemo((function(){return{i18n:t,defaultNS:r}}),[t,r]);return n.createElement(O.Provider,{value:a},i)},e.Trans=function(e){var i=e.children,a=e.count,o=e.parent,u=e.i18nKey,l=e.tOptions,f=void 0===l?{}:l,p=e.values,d=e.defaults,m=e.components,g=e.ns,h=e.i18n,y=e.t,v=s(e,["children","count","parent","i18nKey","tOptions","values","defaults","components","ns","i18n","t"]),b=n.useContext(O)||{},w=b.i18n,E=b.defaultNS,S=h||w||x();if(!S)return C("You will need to pass in an i18next instance by using i18nextReactModule"),i;var N=y||S.t.bind(S)||function(e){return e},I=c(c({},j()),S.options&&S.options.react),k=g||N.ns||E||S.options&&S.options.defaultNS;k="string"==typeof k?[k]:k||["translation"];var R=d||function e(n,i){if(!n)return"";var a="",o=B(n),c=i.transKeepBasicHtmlNodesFor||[];return o.forEach((function(n,o){if("string"==typeof n)a+="".concat(n);else if(t.isValidElement(n)){var u=Object.keys(n.props).length,l=c.indexOf(n.type)>-1,f=n.props.children;if(!f&&l&&0===u)a+="<".concat(n.type,"/>");else if(f||l&&0===u)if(n.props.i18nIsDynamicList)a+="<".concat(o,"></").concat(o,">");else if(l&&1===u&&"string"==typeof f)a+="<".concat(n.type,">").concat(f,"</").concat(n.type,">");else{var p=e(f,i);a+="<".concat(o,">").concat(p,"</").concat(o,">")}else a+="<".concat(o,"></").concat(o,">")}else if(null===n)P("Trans: the passed in value is invalid - seems you passed in a null child.");else if("object"===r(n)){var d=n.format,m=s(n,["format"]),g=Object.keys(m);if(1===g.length){var h=d?"".concat(g[0],", ").concat(d):g[0];a+="{{".concat(h,"}}")}else P("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",n)}else P("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.",n)})),a}(i,I)||I.transEmptyNodeValue||u,A=I.hashTransKey,T=u||(A?A(R):R),z=p?f.interpolation:{interpolation:c(c({},f.interpolation),{},{prefix:"#$?",suffix:"?$#"})},L=c(c(c(c({},f),{},{count:a},p),z),{},{defaultValue:R,ns:k}),D=U(m||i,T?N(T,L):R,S,I,L),V=void 0!==o?o:I.defaultTransParent;return V?t.createElement(V,v,D):D},e.Translation=function(e){var n=e.ns,t=e.children,r=u(V(n,s(e,["ns","children"])),3),i=r[0],a=r[1],o=r[2];return t(i,{i18n:a,lng:a.language},o)},e.composeInitialProps=I,e.date=function(){return""},e.getDefaults=j,e.getI18n=x,e.getInitialProps=k,e.initReactI18next=N,e.number=function(){return""},e.plural=function(){return""},e.select=function(){return""},e.selectOrdinal=function(){return""},e.setDefaults=w,e.setI18n=S,e.time=function(){return""},e.useSSR=K,e.useTranslation=V,e.withSSR=function(){return function(e){function n(n){var r=n.initialI18nStore,i=n.initialLanguage,a=s(n,["initialI18nStore","initialLanguage"]);return K(r,i),t.createElement(e,c({},a))}return n.getInitialProps=I(e),n.displayName="withI18nextSSR(".concat(z(e),")"),n.WrappedComponent=e,n}},e.withTranslation=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(r){function i(i){var a=i.forwardedRef,o=s(i,["forwardedRef"]),l=u(V(e,o),3),f=l[0],p=l[1],d=l[2],m=c(c({},o),{},{t:f,i18n:p,tReady:d});return n.withRef&&a?m.ref=a:!n.withRef&&a&&(m.forwardedRef=a),t.createElement(r,m)}i.displayName="withI18nextTranslation(".concat(z(r),")"),i.WrappedComponent=r;return n.withRef?t.forwardRef((function(e,n){return t.createElement(i,Object.assign({},e,{forwardedRef:n}))})):i}},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
define(["exports","react"],(function(e,n){"use strict";var t="default"in n?n.default:n;function r(e){return(r="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 i(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function c(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e,n){if(null==e)return{};var t,r,i=function(e,n){if(null==e)return{};var t,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}function u(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(t.push(o.value),!n||t.length!==n);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return l(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return l(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var f={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},p=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function d(e){var n={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},t=e.match(/<\/?([^\s]+?)[/\s>]/);if(t&&(n.name=t[1],(f[t[1]]||"/"===e.charAt(e.length-2))&&(n.voidElement=!0),n.name.startsWith("!--"))){var r=e.indexOf("--\x3e");return{type:"comment",comment:-1!==r?e.slice(4,r):""}}for(var i=new RegExp(p),a=null;null!==(a=i.exec(e));)if(a[0].trim())if(a[1]){var o=a[1].trim(),c=[o,""];o.indexOf("=")>-1&&(c=o.split("=")),n.attrs[c[0]]=c[1],i.lastIndex--}else a[2]&&(n.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return n}var m=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,h=/^\s*$/,g=Object.create(null);var y,v=function(e,n){n||(n={}),n.components||(n.components=g);var t,r=[],i=[],a=-1,o=!1;if(0!==e.indexOf("<")){var c=e.indexOf("<");r.push({type:"text",content:-1===c?e:e.substring(0,c)})}return e.replace(m,(function(c,s){if(o){if(c!=="</"+t.name+">")return;o=!1}var u,l="/"!==c.charAt(1),f=c.startsWith("\x3c!--"),p=s+c.length,m=e.charAt(p);if(f){var g=d(c);return a<0?(r.push(g),r):((u=i[a]).children.push(g),r)}if(l&&(a++,"tag"===(t=d(c)).type&&n.components[t.name]&&(t.type="component",o=!0),t.voidElement||o||!m||"<"===m||t.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),0===a&&r.push(t),(u=i[a-1])&&u.children.push(t),i[a]=t),(!l||t.voidElement)&&(a>-1&&(t.voidElement||t.name===c.slice(2,-1))&&(a--,t=-1===a?r:i[a]),!o&&"<"!==m&&m)){u=-1===a?r:i[a].children;var y=e.indexOf("<",p),v=e.slice(p,-1===y?void 0:y);h.test(v)&&(v=" "),(y>-1&&a+u.length>=0||" "!==v)&&u.push({type:"text",content:v})}})),r},b={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0},O=t.createContext();function w(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};b=c(c({},b),e)}function j(){return b}var x=function(){function e(){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.usedNamespaces={}}var n,t,r;return n=e,(t=[{key:"addUsedNamespaces",value:function(e){var n=this;e.forEach((function(e){n.usedNamespaces[e]||(n.usedNamespaces[e]=!0)}))}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}])&&i(n.prototype,t),r&&i(n,r),e}();function E(e){y=e}function S(){return y}var N={type:"3rdParty",init:function(e){w(e.options.react),E(e)}};function I(e){return function(n){return new Promise((function(t){var r=k();e.getInitialProps?e.getInitialProps(n).then((function(e){t(c(c({},e),r))})):t(r)}))}}function k(){var e=S(),n=e.reportNamespaces?e.reportNamespaces.getUsedNamespaces():[],t={},r={};return e.languages.forEach((function(t){r[t]={},n.forEach((function(n){r[t][n]=e.getResourceBundle(t,n)||{}}))})),t.initialI18nStore=r,t.initialLanguage=e.language,t}function P(){if(console&&console.warn){for(var e,n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];"string"==typeof t[0]&&(t[0]="react-i18next:: ".concat(t[0])),(e=console).warn.apply(e,t)}}var R={};function C(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];"string"==typeof n[0]&&R[n[0]]||("string"==typeof n[0]&&(R[n[0]]=new Date),P.apply(void 0,n))}function A(e,n,t){e.loadNamespaces(n,(function(){if(e.isInitialized)t();else{e.on("initialized",(function n(){setTimeout((function(){e.off("initialized",n)}),0),t()}))}}))}function T(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!n.languages||!n.languages.length)return C("i18n.languages were undefined or empty",n.languages),!0;var r=n.languages[0],i=!!n.options&&n.options.fallbackLng,a=n.languages[n.languages.length-1];if("cimode"===r.toLowerCase())return!0;var o=function(e,t){var r=n.services.backendConnector.state["".concat(e,"|").concat(t)];return-1===r||2===r};return!(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!o(n.isLanguageChangingTo,e))&&(!!n.hasResourceBundle(r,e)||(!n.services.backendConnector.backend||!(!o(r,e)||i&&!o(a,e))))}function z(e){return e.displayName||e.name||("string"==typeof e&&e.length>0?e:"Unknown")}function L(e,n){if(!e)return!1;var t=e.props?e.props.children:e.children;return n?t.length>0:!!t}function D(e){return e?e&&e.children?e.children:e.props&&e.props.children:[]}function B(e){return Array.isArray(e)?e:[e]}function U(e,n,i,a,o){if(""===n)return[];var s=a.transKeepBasicHtmlNodesFor||[],u=n&&new RegExp(s.join("|")).test(n);if(!e&&!u)return[n];var l={};!function e(n){B(n).forEach((function(n){"string"!=typeof n&&(L(n)?e(D(n)):"object"!==r(n)||t.isValidElement(n)||Object.assign(l,n))}))}(e);var f=i.services.interpolator.interpolate(n,c(c({},l),o),i.language),p=v("<0>".concat(f,"</0>"));function d(e,n,r){var i=D(e),a=h(i,n.children,r);return function(e){return"[object Array]"===Object.prototype.toString.call(e)&&e.every((function(e){return t.isValidElement(e)}))}(i)&&0===a.length?i:a}function m(e,n,r,i,a){e.dummy&&(e.children=n),r.push(t.cloneElement(e,c(c({},e.props),{},{key:i}),a?void 0:n))}function h(n,i,o){var l=B(n);return B(i).reduce((function(n,i,f){var p,g,y,v=i.children&&i.children[0]&&i.children[0].content;if("tag"===i.type){var b=l[parseInt(i.name,10)];!b&&1===o.length&&o[0][i.name]&&(b=o[0][i.name]),b||(b={});var O=0!==Object.keys(i.attrs).length?(p={props:i.attrs},(y=c({},g=b)).props=Object.assign(p.props,g.props),y):b,w=t.isValidElement(O),j=w&&L(i,!0)&&!i.voidElement,x=u&&"object"===r(O)&&O.dummy&&!w,E="object"===r(e)&&null!==e&&Object.hasOwnProperty.call(e,i.name);if("string"==typeof O)n.push(O);else if(L(O)||j){m(O,d(O,i,o),n,f)}else if(x){var S=h(l,i.children,o);n.push(t.cloneElement(O,c(c({},O.props),{},{key:f}),S))}else if(Number.isNaN(parseFloat(i.name))){if(E)m(O,d(O,i,o),n,f,i.voidElement);else if(a.transSupportBasicHtmlNodes&&s.indexOf(i.name)>-1)if(i.voidElement)n.push(t.createElement(i.name,{key:"".concat(i.name,"-").concat(f)}));else{var N=h(l,i.children,o);n.push(t.createElement(i.name,{key:"".concat(i.name,"-").concat(f)},N))}else if(i.voidElement)n.push("<".concat(i.name," />"));else{var I=h(l,i.children,o);n.push("<".concat(i.name,">").concat(I,"</").concat(i.name,">"))}}else if("object"!==r(O)||w)1===i.children.length&&v?n.push(t.cloneElement(O,c(c({},O.props),{},{key:f}),v)):n.push(t.cloneElement(O,c(c({},O.props),{},{key:f})));else{var k=i.children[0]?v:null;k&&n.push(k)}}else if("text"===i.type){var P=a.transWrapTextNodes;P?n.push(t.createElement(P,{key:"".concat(i.name,"-").concat(f)},i.content)):n.push(i.content)}return n}),[])}return D(h([{dummy:!0,children:e}],p,B(e||[]))[0])}function V(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.i18n,i=n.useContext(O)||{},a=i.i18n,o=i.defaultNS,s=r||a||S();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new x),!s){C("You will need to pass in an i18next instance by using initReactI18next");var l=function(e){return Array.isArray(e)?e[e.length-1]:e},f=[l,{},!1];return f.t=l,f.i18n={},f.ready=!1,f}s.options.react&&void 0!==s.options.react.wait&&C("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var p=c(c(c({},j()),s.options.react),t),d=p.useSuspense,m=e||o||s.options&&s.options.defaultNS;m="string"==typeof m?[m]:m||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(m);var h=(s.isInitialized||s.initializedStoreOnce)&&m.every((function(e){return T(e,s,p)}));function g(){return s.getFixedT(null,"fallback"===p.nsMode?m:m[0])}var y=n.useState(g),v=u(y,2),b=v[0],w=v[1],E=n.useRef(!0);n.useEffect((function(){var e=p.bindI18n,n=p.bindI18nStore;function t(){E.current&&w(g)}return E.current=!0,h||d||A(s,m,(function(){E.current&&w(g)})),e&&s&&s.on(e,t),n&&s&&s.store.on(n,t),function(){E.current=!1,e&&s&&e.split(" ").forEach((function(e){return s.off(e,t)})),n&&s&&n.split(" ").forEach((function(e){return s.store.off(e,t)}))}}),[s,m.join()]);var N=n.useRef(!0);n.useEffect((function(){E.current&&!N.current&&w(g),N.current=!1}),[s]);var I=[b,s,h];if(I.t=b,I.i18n=s,I.ready=h,h)return I;if(!h&&!d)return I;throw new Promise((function(e){A(s,m,(function(){e()}))}))}function K(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r.i18n,a=n.useContext(O)||{},o=a.i18n,c=i||o||S();c.options&&c.options.isClone||(e&&!c.initializedStoreOnce&&(c.services.resourceStore.data=e,c.options.ns=Object.values(e).reduce((function(e,n){return Object.keys(n).forEach((function(n){e.indexOf(n)<0&&e.push(n)})),e}),c.options.ns),c.initializedStoreOnce=!0,c.isInitialized=!0),t&&!c.initializedLanguageOnce&&(c.changeLanguage(t),c.initializedLanguageOnce=!0))}e.I18nContext=O,e.I18nextProvider=function(e){var t=e.i18n,r=e.defaultNS,i=e.children,a=n.useMemo((function(){return{i18n:t,defaultNS:r}}),[t,r]);return n.createElement(O.Provider,{value:a},i)},e.Trans=function(e){var i=e.children,a=e.count,o=e.parent,u=e.i18nKey,l=e.tOptions,f=void 0===l?{}:l,p=e.values,d=e.defaults,m=e.components,h=e.ns,g=e.i18n,y=e.t,v=s(e,["children","count","parent","i18nKey","tOptions","values","defaults","components","ns","i18n","t"]),b=n.useContext(O)||{},w=b.i18n,x=b.defaultNS,E=g||w||S();if(!E)return C("You will need to pass in an i18next instance by using i18nextReactModule"),i;var N=y||E.t.bind(E)||function(e){return e},I=c(c({},j()),E.options&&E.options.react),k=h||N.ns||x||E.options&&E.options.defaultNS;k="string"==typeof k?[k]:k||["translation"];var R=d||function e(n,i){if(!n)return"";var a="",o=B(n),c=i.transKeepBasicHtmlNodesFor||[];return o.forEach((function(n,o){if("string"==typeof n)a+="".concat(n);else if(t.isValidElement(n)){var u=Object.keys(n.props).length,l=c.indexOf(n.type)>-1,f=n.props.children;if(!f&&l&&0===u)a+="<".concat(n.type,"/>");else if(f||l&&0===u)if(n.props.i18nIsDynamicList)a+="<".concat(o,"></").concat(o,">");else if(l&&1===u&&"string"==typeof f)a+="<".concat(n.type,">").concat(f,"</").concat(n.type,">");else{var p=e(f,i);a+="<".concat(o,">").concat(p,"</").concat(o,">")}else a+="<".concat(o,"></").concat(o,">")}else if(null===n)P("Trans: the passed in value is invalid - seems you passed in a null child.");else if("object"===r(n)){var d=n.format,m=s(n,["format"]),h=Object.keys(m);if(1===h.length){var g=d?"".concat(h[0],", ").concat(d):h[0];a+="{{".concat(g,"}}")}else P("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",n)}else P("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.",n)})),a}(i,I)||I.transEmptyNodeValue||u,A=I.hashTransKey,T=u||(A?A(R):R),z=p?f.interpolation:{interpolation:c(c({},f.interpolation),{},{prefix:"#$?",suffix:"?$#"})},L=c(c(c(c({},f),{},{count:a},p),z),{},{defaultValue:R,ns:k}),D=U(m||i,T?N(T,L):R,E,I,L),V=void 0!==o?o:I.defaultTransParent;return V?t.createElement(V,v,D):D},e.Translation=function(e){var n=e.ns,t=e.children,r=u(V(n,s(e,["ns","children"])),3),i=r[0],a=r[1],o=r[2];return t(i,{i18n:a,lng:a.language},o)},e.composeInitialProps=I,e.date=function(){return""},e.getDefaults=j,e.getI18n=S,e.getInitialProps=k,e.initReactI18next=N,e.number=function(){return""},e.plural=function(){return""},e.select=function(){return""},e.selectOrdinal=function(){return""},e.setDefaults=w,e.setI18n=E,e.time=function(){return""},e.useSSR=K,e.useTranslation=V,e.withSSR=function(){return function(e){function n(n){var r=n.initialI18nStore,i=n.initialLanguage,a=s(n,["initialI18nStore","initialLanguage"]);return K(r,i),t.createElement(e,c({},a))}return n.getInitialProps=I(e),n.displayName="withI18nextSSR(".concat(z(e),")"),n.WrappedComponent=e,n}},e.withTranslation=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(r){function i(i){var a=i.forwardedRef,o=s(i,["forwardedRef"]),l=u(V(e,o),3),f=l[0],p=l[1],d=l[2],m=c(c({},o),{},{t:f,i18n:p,tReady:d});return n.withRef&&a?m.ref=a:!n.withRef&&a&&(m.forwardedRef=a),t.createElement(r,m)}i.displayName="withI18nextTranslation(".concat(z(r),")"),i.WrappedComponent=r;return n.withRef?t.forwardRef((function(e,n){return t.createElement(i,Object.assign({},e,{forwardedRef:n}))})):i}},Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -33,2 +33,3 @@ "use strict"; | ||
transSupportBasicHtmlNodes: true, | ||
transWrapTextNodes: '', | ||
transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'], | ||
@@ -35,0 +36,0 @@ useSuspense: true |
@@ -207,3 +207,11 @@ "use strict"; | ||
} else if (node.type === 'text') { | ||
mem.push(node.content); | ||
var wrapTextNodes = i18nOptions.transWrapTextNodes; | ||
if (wrapTextNodes) { | ||
mem.push(_react["default"].createElement(wrapTextNodes, { | ||
key: "".concat(node.name, "-").concat(i) | ||
}, node.content)); | ||
} else { | ||
mem.push(node.content); | ||
} | ||
} | ||
@@ -210,0 +218,0 @@ |
@@ -15,2 +15,3 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; | ||
transSupportBasicHtmlNodes: true, | ||
transWrapTextNodes: '', | ||
transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'], | ||
@@ -17,0 +18,0 @@ useSuspense: true |
@@ -188,3 +188,11 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; | ||
} else if (node.type === 'text') { | ||
mem.push(node.content); | ||
var wrapTextNodes = i18nOptions.transWrapTextNodes; | ||
if (wrapTextNodes) { | ||
mem.push(React.createElement(wrapTextNodes, { | ||
key: "".concat(node.name, "-").concat(i) | ||
}, node.content)); | ||
} else { | ||
mem.push(node.content); | ||
} | ||
} | ||
@@ -191,0 +199,0 @@ |
@@ -321,2 +321,3 @@ (function (global, factory) { | ||
transSupportBasicHtmlNodes: true, | ||
transWrapTextNodes: '', | ||
transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'], | ||
@@ -644,3 +645,11 @@ useSuspense: true | ||
} else if (node.type === 'text') { | ||
mem.push(node.content); | ||
var wrapTextNodes = i18nOptions.transWrapTextNodes; | ||
if (wrapTextNodes) { | ||
mem.push(React__default.createElement(wrapTextNodes, { | ||
key: "".concat(node.name, "-").concat(i) | ||
}, node.content)); | ||
} else { | ||
mem.push(node.content); | ||
} | ||
} | ||
@@ -647,0 +656,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e=e||self).ReactI18next={},e.React)}(this,(function(e,n){"use strict";var t="default"in n?n.default:n;function r(e){return(r="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 i(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function c(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e,n){if(null==e)return{};var t,r,i=function(e,n){if(null==e)return{};var t,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}function u(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(t.push(o.value),!n||t.length!==n);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return l(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return l(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var f={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},p=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function d(e){var n={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},t=e.match(/<\/?([^\s]+?)[/\s>]/);if(t&&(n.name=t[1],(f[t[1]]||"/"===e.charAt(e.length-2))&&(n.voidElement=!0),n.name.startsWith("!--"))){var r=e.indexOf("--\x3e");return{type:"comment",comment:-1!==r?e.slice(4,r):""}}for(var i=new RegExp(p),a=null;null!==(a=i.exec(e));)if(a[0].trim())if(a[1]){var o=a[1].trim(),c=[o,""];o.indexOf("=")>-1&&(c=o.split("=")),n.attrs[c[0]]=c[1],i.lastIndex--}else a[2]&&(n.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return n}var m=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,h=/^\s*$/,g=Object.create(null);var y,v=function(e,n){n||(n={}),n.components||(n.components=g);var t,r=[],i=[],a=-1,o=!1;if(0!==e.indexOf("<")){var c=e.indexOf("<");r.push({type:"text",content:-1===c?e:e.substring(0,c)})}return e.replace(m,(function(c,s){if(o){if(c!=="</"+t.name+">")return;o=!1}var u,l="/"!==c.charAt(1),f=c.startsWith("\x3c!--"),p=s+c.length,m=e.charAt(p);if(f){var g=d(c);return a<0?(r.push(g),r):((u=i[a]).children.push(g),r)}if(l&&(a++,"tag"===(t=d(c)).type&&n.components[t.name]&&(t.type="component",o=!0),t.voidElement||o||!m||"<"===m||t.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),0===a&&r.push(t),(u=i[a-1])&&u.children.push(t),i[a]=t),(!l||t.voidElement)&&(a>-1&&(t.voidElement||t.name===c.slice(2,-1))&&(a--,t=-1===a?r:i[a]),!o&&"<"!==m&&m)){u=-1===a?r:i[a].children;var y=e.indexOf("<",p),v=e.slice(p,-1===y?void 0:y);h.test(v)&&(v=" "),(y>-1&&a+u.length>=0||" "!==v)&&u.push({type:"text",content:v})}})),r},b={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0},O=t.createContext();function w(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};b=c(c({},b),e)}function j(){return b}var x=function(){function e(){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.usedNamespaces={}}var n,t,r;return n=e,(t=[{key:"addUsedNamespaces",value:function(e){var n=this;e.forEach((function(e){n.usedNamespaces[e]||(n.usedNamespaces[e]=!0)}))}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}])&&i(n.prototype,t),r&&i(n,r),e}();function E(e){y=e}function S(){return y}var N={type:"3rdParty",init:function(e){w(e.options.react),E(e)}};function I(e){return function(n){return new Promise((function(t){var r=k();e.getInitialProps?e.getInitialProps(n).then((function(e){t(c(c({},e),r))})):t(r)}))}}function k(){var e=S(),n=e.reportNamespaces?e.reportNamespaces.getUsedNamespaces():[],t={},r={};return e.languages.forEach((function(t){r[t]={},n.forEach((function(n){r[t][n]=e.getResourceBundle(t,n)||{}}))})),t.initialI18nStore=r,t.initialLanguage=e.language,t}function P(){if(console&&console.warn){for(var e,n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];"string"==typeof t[0]&&(t[0]="react-i18next:: ".concat(t[0])),(e=console).warn.apply(e,t)}}var R={};function C(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];"string"==typeof n[0]&&R[n[0]]||("string"==typeof n[0]&&(R[n[0]]=new Date),P.apply(void 0,n))}function A(e,n,t){e.loadNamespaces(n,(function(){if(e.isInitialized)t();else{e.on("initialized",(function n(){setTimeout((function(){e.off("initialized",n)}),0),t()}))}}))}function T(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!n.languages||!n.languages.length)return C("i18n.languages were undefined or empty",n.languages),!0;var r=n.languages[0],i=!!n.options&&n.options.fallbackLng,a=n.languages[n.languages.length-1];if("cimode"===r.toLowerCase())return!0;var o=function(e,t){var r=n.services.backendConnector.state["".concat(e,"|").concat(t)];return-1===r||2===r};return!(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!o(n.isLanguageChangingTo,e))&&(!!n.hasResourceBundle(r,e)||(!n.services.backendConnector.backend||!(!o(r,e)||i&&!o(a,e))))}function z(e){return e.displayName||e.name||("string"==typeof e&&e.length>0?e:"Unknown")}function L(e,n){if(!e)return!1;var t=e.props?e.props.children:e.children;return n?t.length>0:!!t}function D(e){return e?e&&e.children?e.children:e.props&&e.props.children:[]}function B(e){return Array.isArray(e)?e:[e]}function U(e,n,i,a,o){if(""===n)return[];var s=a.transKeepBasicHtmlNodesFor||[],u=n&&new RegExp(s.join("|")).test(n);if(!e&&!u)return[n];var l={};!function e(n){B(n).forEach((function(n){"string"!=typeof n&&(L(n)?e(D(n)):"object"!==r(n)||t.isValidElement(n)||Object.assign(l,n))}))}(e);var f=i.services.interpolator.interpolate(n,c(c({},l),o),i.language),p=v("<0>".concat(f,"</0>"));function d(e,n,r){var i=D(e),a=h(i,n.children,r);return function(e){return"[object Array]"===Object.prototype.toString.call(e)&&e.every((function(e){return t.isValidElement(e)}))}(i)&&0===a.length?i:a}function m(e,n,r,i,a){e.dummy&&(e.children=n),r.push(t.cloneElement(e,c(c({},e.props),{},{key:i}),a?void 0:n))}function h(n,i,o){var l=B(n);return B(i).reduce((function(n,i,f){var p,g,y,v=i.children&&i.children[0]&&i.children[0].content;if("tag"===i.type){var b=l[parseInt(i.name,10)];!b&&1===o.length&&o[0][i.name]&&(b=o[0][i.name]),b||(b={});var O=0!==Object.keys(i.attrs).length?(p={props:i.attrs},(y=c({},g=b)).props=Object.assign(p.props,g.props),y):b,w=t.isValidElement(O),j=w&&L(i,!0)&&!i.voidElement,x=u&&"object"===r(O)&&O.dummy&&!w,E="object"===r(e)&&null!==e&&Object.hasOwnProperty.call(e,i.name);if("string"==typeof O)n.push(O);else if(L(O)||j){m(O,d(O,i,o),n,f)}else if(x){var S=h(l,i.children,o);n.push(t.cloneElement(O,c(c({},O.props),{},{key:f}),S))}else if(Number.isNaN(parseFloat(i.name))){if(E)m(O,d(O,i,o),n,f,i.voidElement);else if(a.transSupportBasicHtmlNodes&&s.indexOf(i.name)>-1)if(i.voidElement)n.push(t.createElement(i.name,{key:"".concat(i.name,"-").concat(f)}));else{var N=h(l,i.children,o);n.push(t.createElement(i.name,{key:"".concat(i.name,"-").concat(f)},N))}else if(i.voidElement)n.push("<".concat(i.name," />"));else{var I=h(l,i.children,o);n.push("<".concat(i.name,">").concat(I,"</").concat(i.name,">"))}}else if("object"!==r(O)||w)1===i.children.length&&v?n.push(t.cloneElement(O,c(c({},O.props),{},{key:f}),v)):n.push(t.cloneElement(O,c(c({},O.props),{},{key:f})));else{var k=i.children[0]?v:null;k&&n.push(k)}}else"text"===i.type&&n.push(i.content);return n}),[])}return D(h([{dummy:!0,children:e}],p,B(e||[]))[0])}function V(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.i18n,i=n.useContext(O)||{},a=i.i18n,o=i.defaultNS,s=r||a||S();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new x),!s){C("You will need to pass in an i18next instance by using initReactI18next");var l=function(e){return Array.isArray(e)?e[e.length-1]:e},f=[l,{},!1];return f.t=l,f.i18n={},f.ready=!1,f}s.options.react&&void 0!==s.options.react.wait&&C("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var p=c(c(c({},j()),s.options.react),t),d=p.useSuspense,m=e||o||s.options&&s.options.defaultNS;m="string"==typeof m?[m]:m||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(m);var h=(s.isInitialized||s.initializedStoreOnce)&&m.every((function(e){return T(e,s,p)}));function g(){return s.getFixedT(null,"fallback"===p.nsMode?m:m[0])}var y=n.useState(g),v=u(y,2),b=v[0],w=v[1],E=n.useRef(!0);n.useEffect((function(){var e=p.bindI18n,n=p.bindI18nStore;function t(){E.current&&w(g)}return E.current=!0,h||d||A(s,m,(function(){E.current&&w(g)})),e&&s&&s.on(e,t),n&&s&&s.store.on(n,t),function(){E.current=!1,e&&s&&e.split(" ").forEach((function(e){return s.off(e,t)})),n&&s&&n.split(" ").forEach((function(e){return s.store.off(e,t)}))}}),[s,m.join()]);var N=n.useRef(!0);n.useEffect((function(){E.current&&!N.current&&w(g),N.current=!1}),[s]);var I=[b,s,h];if(I.t=b,I.i18n=s,I.ready=h,h)return I;if(!h&&!d)return I;throw new Promise((function(e){A(s,m,(function(){e()}))}))}function K(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r.i18n,a=n.useContext(O)||{},o=a.i18n,c=i||o||S();c.options&&c.options.isClone||(e&&!c.initializedStoreOnce&&(c.services.resourceStore.data=e,c.options.ns=Object.values(e).reduce((function(e,n){return Object.keys(n).forEach((function(n){e.indexOf(n)<0&&e.push(n)})),e}),c.options.ns),c.initializedStoreOnce=!0,c.isInitialized=!0),t&&!c.initializedLanguageOnce&&(c.changeLanguage(t),c.initializedLanguageOnce=!0))}e.I18nContext=O,e.I18nextProvider=function(e){var t=e.i18n,r=e.defaultNS,i=e.children,a=n.useMemo((function(){return{i18n:t,defaultNS:r}}),[t,r]);return n.createElement(O.Provider,{value:a},i)},e.Trans=function(e){var i=e.children,a=e.count,o=e.parent,u=e.i18nKey,l=e.tOptions,f=void 0===l?{}:l,p=e.values,d=e.defaults,m=e.components,h=e.ns,g=e.i18n,y=e.t,v=s(e,["children","count","parent","i18nKey","tOptions","values","defaults","components","ns","i18n","t"]),b=n.useContext(O)||{},w=b.i18n,x=b.defaultNS,E=g||w||S();if(!E)return C("You will need to pass in an i18next instance by using i18nextReactModule"),i;var N=y||E.t.bind(E)||function(e){return e},I=c(c({},j()),E.options&&E.options.react),k=h||N.ns||x||E.options&&E.options.defaultNS;k="string"==typeof k?[k]:k||["translation"];var R=d||function e(n,i){if(!n)return"";var a="",o=B(n),c=i.transKeepBasicHtmlNodesFor||[];return o.forEach((function(n,o){if("string"==typeof n)a+="".concat(n);else if(t.isValidElement(n)){var u=Object.keys(n.props).length,l=c.indexOf(n.type)>-1,f=n.props.children;if(!f&&l&&0===u)a+="<".concat(n.type,"/>");else if(f||l&&0===u)if(n.props.i18nIsDynamicList)a+="<".concat(o,"></").concat(o,">");else if(l&&1===u&&"string"==typeof f)a+="<".concat(n.type,">").concat(f,"</").concat(n.type,">");else{var p=e(f,i);a+="<".concat(o,">").concat(p,"</").concat(o,">")}else a+="<".concat(o,"></").concat(o,">")}else if(null===n)P("Trans: the passed in value is invalid - seems you passed in a null child.");else if("object"===r(n)){var d=n.format,m=s(n,["format"]),h=Object.keys(m);if(1===h.length){var g=d?"".concat(h[0],", ").concat(d):h[0];a+="{{".concat(g,"}}")}else P("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",n)}else P("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.",n)})),a}(i,I)||I.transEmptyNodeValue||u,A=I.hashTransKey,T=u||(A?A(R):R),z=p?f.interpolation:{interpolation:c(c({},f.interpolation),{},{prefix:"#$?",suffix:"?$#"})},L=c(c(c(c({},f),{},{count:a},p),z),{},{defaultValue:R,ns:k}),D=U(m||i,T?N(T,L):R,E,I,L),V=void 0!==o?o:I.defaultTransParent;return V?t.createElement(V,v,D):D},e.Translation=function(e){var n=e.ns,t=e.children,r=u(V(n,s(e,["ns","children"])),3),i=r[0],a=r[1],o=r[2];return t(i,{i18n:a,lng:a.language},o)},e.composeInitialProps=I,e.date=function(){return""},e.getDefaults=j,e.getI18n=S,e.getInitialProps=k,e.initReactI18next=N,e.number=function(){return""},e.plural=function(){return""},e.select=function(){return""},e.selectOrdinal=function(){return""},e.setDefaults=w,e.setI18n=E,e.time=function(){return""},e.useSSR=K,e.useTranslation=V,e.withSSR=function(){return function(e){function n(n){var r=n.initialI18nStore,i=n.initialLanguage,a=s(n,["initialI18nStore","initialLanguage"]);return K(r,i),t.createElement(e,c({},a))}return n.getInitialProps=I(e),n.displayName="withI18nextSSR(".concat(z(e),")"),n.WrappedComponent=e,n}},e.withTranslation=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(r){function i(i){var a=i.forwardedRef,o=s(i,["forwardedRef"]),l=u(V(e,o),3),f=l[0],p=l[1],d=l[2],m=c(c({},o),{},{t:f,i18n:p,tReady:d});return n.withRef&&a?m.ref=a:!n.withRef&&a&&(m.forwardedRef=a),t.createElement(r,m)}i.displayName="withI18nextTranslation(".concat(z(r),")"),i.WrappedComponent=r;return n.withRef?t.forwardRef((function(e,n){return t.createElement(i,Object.assign({},e,{forwardedRef:n}))})):i}},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e=e||self).ReactI18next={},e.React)}(this,(function(e,n){"use strict";var t="default"in n?n.default:n;function r(e){return(r="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 i(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function c(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e,n){if(null==e)return{};var t,r,i=function(e,n){if(null==e)return{};var t,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}function u(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(t.push(o.value),!n||t.length!==n);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return l(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return l(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var f={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},p=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function d(e){var n={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},t=e.match(/<\/?([^\s]+?)[/\s>]/);if(t&&(n.name=t[1],(f[t[1]]||"/"===e.charAt(e.length-2))&&(n.voidElement=!0),n.name.startsWith("!--"))){var r=e.indexOf("--\x3e");return{type:"comment",comment:-1!==r?e.slice(4,r):""}}for(var i=new RegExp(p),a=null;null!==(a=i.exec(e));)if(a[0].trim())if(a[1]){var o=a[1].trim(),c=[o,""];o.indexOf("=")>-1&&(c=o.split("=")),n.attrs[c[0]]=c[1],i.lastIndex--}else a[2]&&(n.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return n}var m=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,h=/^\s*$/,g=Object.create(null);var y,v=function(e,n){n||(n={}),n.components||(n.components=g);var t,r=[],i=[],a=-1,o=!1;if(0!==e.indexOf("<")){var c=e.indexOf("<");r.push({type:"text",content:-1===c?e:e.substring(0,c)})}return e.replace(m,(function(c,s){if(o){if(c!=="</"+t.name+">")return;o=!1}var u,l="/"!==c.charAt(1),f=c.startsWith("\x3c!--"),p=s+c.length,m=e.charAt(p);if(f){var g=d(c);return a<0?(r.push(g),r):((u=i[a]).children.push(g),r)}if(l&&(a++,"tag"===(t=d(c)).type&&n.components[t.name]&&(t.type="component",o=!0),t.voidElement||o||!m||"<"===m||t.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),0===a&&r.push(t),(u=i[a-1])&&u.children.push(t),i[a]=t),(!l||t.voidElement)&&(a>-1&&(t.voidElement||t.name===c.slice(2,-1))&&(a--,t=-1===a?r:i[a]),!o&&"<"!==m&&m)){u=-1===a?r:i[a].children;var y=e.indexOf("<",p),v=e.slice(p,-1===y?void 0:y);h.test(v)&&(v=" "),(y>-1&&a+u.length>=0||" "!==v)&&u.push({type:"text",content:v})}})),r},b={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0},O=t.createContext();function w(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};b=c(c({},b),e)}function x(){return b}var j=function(){function e(){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.usedNamespaces={}}var n,t,r;return n=e,(t=[{key:"addUsedNamespaces",value:function(e){var n=this;e.forEach((function(e){n.usedNamespaces[e]||(n.usedNamespaces[e]=!0)}))}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}])&&i(n.prototype,t),r&&i(n,r),e}();function E(e){y=e}function S(){return y}var N={type:"3rdParty",init:function(e){w(e.options.react),E(e)}};function I(e){return function(n){return new Promise((function(t){var r=k();e.getInitialProps?e.getInitialProps(n).then((function(e){t(c(c({},e),r))})):t(r)}))}}function k(){var e=S(),n=e.reportNamespaces?e.reportNamespaces.getUsedNamespaces():[],t={},r={};return e.languages.forEach((function(t){r[t]={},n.forEach((function(n){r[t][n]=e.getResourceBundle(t,n)||{}}))})),t.initialI18nStore=r,t.initialLanguage=e.language,t}function P(){if(console&&console.warn){for(var e,n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];"string"==typeof t[0]&&(t[0]="react-i18next:: ".concat(t[0])),(e=console).warn.apply(e,t)}}var R={};function C(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];"string"==typeof n[0]&&R[n[0]]||("string"==typeof n[0]&&(R[n[0]]=new Date),P.apply(void 0,n))}function A(e,n,t){e.loadNamespaces(n,(function(){if(e.isInitialized)t();else{e.on("initialized",(function n(){setTimeout((function(){e.off("initialized",n)}),0),t()}))}}))}function T(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!n.languages||!n.languages.length)return C("i18n.languages were undefined or empty",n.languages),!0;var r=n.languages[0],i=!!n.options&&n.options.fallbackLng,a=n.languages[n.languages.length-1];if("cimode"===r.toLowerCase())return!0;var o=function(e,t){var r=n.services.backendConnector.state["".concat(e,"|").concat(t)];return-1===r||2===r};return!(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!o(n.isLanguageChangingTo,e))&&(!!n.hasResourceBundle(r,e)||(!n.services.backendConnector.backend||!(!o(r,e)||i&&!o(a,e))))}function z(e){return e.displayName||e.name||("string"==typeof e&&e.length>0?e:"Unknown")}function L(e,n){if(!e)return!1;var t=e.props?e.props.children:e.children;return n?t.length>0:!!t}function D(e){return e?e&&e.children?e.children:e.props&&e.props.children:[]}function B(e){return Array.isArray(e)?e:[e]}function U(e,n,i,a,o){if(""===n)return[];var s=a.transKeepBasicHtmlNodesFor||[],u=n&&new RegExp(s.join("|")).test(n);if(!e&&!u)return[n];var l={};!function e(n){B(n).forEach((function(n){"string"!=typeof n&&(L(n)?e(D(n)):"object"!==r(n)||t.isValidElement(n)||Object.assign(l,n))}))}(e);var f=i.services.interpolator.interpolate(n,c(c({},l),o),i.language),p=v("<0>".concat(f,"</0>"));function d(e,n,r){var i=D(e),a=h(i,n.children,r);return function(e){return"[object Array]"===Object.prototype.toString.call(e)&&e.every((function(e){return t.isValidElement(e)}))}(i)&&0===a.length?i:a}function m(e,n,r,i,a){e.dummy&&(e.children=n),r.push(t.cloneElement(e,c(c({},e.props),{},{key:i}),a?void 0:n))}function h(n,i,o){var l=B(n);return B(i).reduce((function(n,i,f){var p,g,y,v=i.children&&i.children[0]&&i.children[0].content;if("tag"===i.type){var b=l[parseInt(i.name,10)];!b&&1===o.length&&o[0][i.name]&&(b=o[0][i.name]),b||(b={});var O=0!==Object.keys(i.attrs).length?(p={props:i.attrs},(y=c({},g=b)).props=Object.assign(p.props,g.props),y):b,w=t.isValidElement(O),x=w&&L(i,!0)&&!i.voidElement,j=u&&"object"===r(O)&&O.dummy&&!w,E="object"===r(e)&&null!==e&&Object.hasOwnProperty.call(e,i.name);if("string"==typeof O)n.push(O);else if(L(O)||x){m(O,d(O,i,o),n,f)}else if(j){var S=h(l,i.children,o);n.push(t.cloneElement(O,c(c({},O.props),{},{key:f}),S))}else if(Number.isNaN(parseFloat(i.name))){if(E)m(O,d(O,i,o),n,f,i.voidElement);else if(a.transSupportBasicHtmlNodes&&s.indexOf(i.name)>-1)if(i.voidElement)n.push(t.createElement(i.name,{key:"".concat(i.name,"-").concat(f)}));else{var N=h(l,i.children,o);n.push(t.createElement(i.name,{key:"".concat(i.name,"-").concat(f)},N))}else if(i.voidElement)n.push("<".concat(i.name," />"));else{var I=h(l,i.children,o);n.push("<".concat(i.name,">").concat(I,"</").concat(i.name,">"))}}else if("object"!==r(O)||w)1===i.children.length&&v?n.push(t.cloneElement(O,c(c({},O.props),{},{key:f}),v)):n.push(t.cloneElement(O,c(c({},O.props),{},{key:f})));else{var k=i.children[0]?v:null;k&&n.push(k)}}else if("text"===i.type){var P=a.transWrapTextNodes;P?n.push(t.createElement(P,{key:"".concat(i.name,"-").concat(f)},i.content)):n.push(i.content)}return n}),[])}return D(h([{dummy:!0,children:e}],p,B(e||[]))[0])}function V(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.i18n,i=n.useContext(O)||{},a=i.i18n,o=i.defaultNS,s=r||a||S();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new j),!s){C("You will need to pass in an i18next instance by using initReactI18next");var l=function(e){return Array.isArray(e)?e[e.length-1]:e},f=[l,{},!1];return f.t=l,f.i18n={},f.ready=!1,f}s.options.react&&void 0!==s.options.react.wait&&C("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var p=c(c(c({},x()),s.options.react),t),d=p.useSuspense,m=e||o||s.options&&s.options.defaultNS;m="string"==typeof m?[m]:m||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(m);var h=(s.isInitialized||s.initializedStoreOnce)&&m.every((function(e){return T(e,s,p)}));function g(){return s.getFixedT(null,"fallback"===p.nsMode?m:m[0])}var y=n.useState(g),v=u(y,2),b=v[0],w=v[1],E=n.useRef(!0);n.useEffect((function(){var e=p.bindI18n,n=p.bindI18nStore;function t(){E.current&&w(g)}return E.current=!0,h||d||A(s,m,(function(){E.current&&w(g)})),e&&s&&s.on(e,t),n&&s&&s.store.on(n,t),function(){E.current=!1,e&&s&&e.split(" ").forEach((function(e){return s.off(e,t)})),n&&s&&n.split(" ").forEach((function(e){return s.store.off(e,t)}))}}),[s,m.join()]);var N=n.useRef(!0);n.useEffect((function(){E.current&&!N.current&&w(g),N.current=!1}),[s]);var I=[b,s,h];if(I.t=b,I.i18n=s,I.ready=h,h)return I;if(!h&&!d)return I;throw new Promise((function(e){A(s,m,(function(){e()}))}))}function K(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r.i18n,a=n.useContext(O)||{},o=a.i18n,c=i||o||S();c.options&&c.options.isClone||(e&&!c.initializedStoreOnce&&(c.services.resourceStore.data=e,c.options.ns=Object.values(e).reduce((function(e,n){return Object.keys(n).forEach((function(n){e.indexOf(n)<0&&e.push(n)})),e}),c.options.ns),c.initializedStoreOnce=!0,c.isInitialized=!0),t&&!c.initializedLanguageOnce&&(c.changeLanguage(t),c.initializedLanguageOnce=!0))}e.I18nContext=O,e.I18nextProvider=function(e){var t=e.i18n,r=e.defaultNS,i=e.children,a=n.useMemo((function(){return{i18n:t,defaultNS:r}}),[t,r]);return n.createElement(O.Provider,{value:a},i)},e.Trans=function(e){var i=e.children,a=e.count,o=e.parent,u=e.i18nKey,l=e.tOptions,f=void 0===l?{}:l,p=e.values,d=e.defaults,m=e.components,h=e.ns,g=e.i18n,y=e.t,v=s(e,["children","count","parent","i18nKey","tOptions","values","defaults","components","ns","i18n","t"]),b=n.useContext(O)||{},w=b.i18n,j=b.defaultNS,E=g||w||S();if(!E)return C("You will need to pass in an i18next instance by using i18nextReactModule"),i;var N=y||E.t.bind(E)||function(e){return e},I=c(c({},x()),E.options&&E.options.react),k=h||N.ns||j||E.options&&E.options.defaultNS;k="string"==typeof k?[k]:k||["translation"];var R=d||function e(n,i){if(!n)return"";var a="",o=B(n),c=i.transKeepBasicHtmlNodesFor||[];return o.forEach((function(n,o){if("string"==typeof n)a+="".concat(n);else if(t.isValidElement(n)){var u=Object.keys(n.props).length,l=c.indexOf(n.type)>-1,f=n.props.children;if(!f&&l&&0===u)a+="<".concat(n.type,"/>");else if(f||l&&0===u)if(n.props.i18nIsDynamicList)a+="<".concat(o,"></").concat(o,">");else if(l&&1===u&&"string"==typeof f)a+="<".concat(n.type,">").concat(f,"</").concat(n.type,">");else{var p=e(f,i);a+="<".concat(o,">").concat(p,"</").concat(o,">")}else a+="<".concat(o,"></").concat(o,">")}else if(null===n)P("Trans: the passed in value is invalid - seems you passed in a null child.");else if("object"===r(n)){var d=n.format,m=s(n,["format"]),h=Object.keys(m);if(1===h.length){var g=d?"".concat(h[0],", ").concat(d):h[0];a+="{{".concat(g,"}}")}else P("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",n)}else P("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.",n)})),a}(i,I)||I.transEmptyNodeValue||u,A=I.hashTransKey,T=u||(A?A(R):R),z=p?f.interpolation:{interpolation:c(c({},f.interpolation),{},{prefix:"#$?",suffix:"?$#"})},L=c(c(c(c({},f),{},{count:a},p),z),{},{defaultValue:R,ns:k}),D=U(m||i,T?N(T,L):R,E,I,L),V=void 0!==o?o:I.defaultTransParent;return V?t.createElement(V,v,D):D},e.Translation=function(e){var n=e.ns,t=e.children,r=u(V(n,s(e,["ns","children"])),3),i=r[0],a=r[1],o=r[2];return t(i,{i18n:a,lng:a.language},o)},e.composeInitialProps=I,e.date=function(){return""},e.getDefaults=x,e.getI18n=S,e.getInitialProps=k,e.initReactI18next=N,e.number=function(){return""},e.plural=function(){return""},e.select=function(){return""},e.selectOrdinal=function(){return""},e.setDefaults=w,e.setI18n=E,e.time=function(){return""},e.useSSR=K,e.useTranslation=V,e.withSSR=function(){return function(e){function n(n){var r=n.initialI18nStore,i=n.initialLanguage,a=s(n,["initialI18nStore","initialLanguage"]);return K(r,i),t.createElement(e,c({},a))}return n.getInitialProps=I(e),n.displayName="withI18nextSSR(".concat(z(e),")"),n.WrappedComponent=e,n}},e.withTranslation=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(r){function i(i){var a=i.forwardedRef,o=s(i,["forwardedRef"]),l=u(V(e,o),3),f=l[0],p=l[1],d=l[2],m=c(c({},o),{},{t:f,i18n:p,tReady:d});return n.withRef&&a?m.ref=a:!n.withRef&&a&&(m.forwardedRef=a),t.createElement(r,m)}i.displayName="withI18nextTranslation(".concat(z(r),")"),i.WrappedComponent=r;return n.withRef?t.forwardRef((function(e,n){return t.createElement(i,Object.assign({},e,{forwardedRef:n}))})):i}},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "react-i18next", | ||
"version": "11.9.0", | ||
"version": "11.10.0", | ||
"description": "Internationalization for react done right. Using the i18next i18n ecosystem.", | ||
@@ -34,3 +34,3 @@ "main": "dist/commonjs/index.js", | ||
"dependencies": { | ||
"@babel/runtime": "^7.13.6", | ||
"@babel/runtime": "^7.14.0", | ||
"html-parse-stringify": "^3.0.1" | ||
@@ -37,0 +37,0 @@ }, |
@@ -321,2 +321,3 @@ (function (global, factory) { | ||
transSupportBasicHtmlNodes: true, | ||
transWrapTextNodes: '', | ||
transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'], | ||
@@ -644,3 +645,11 @@ useSuspense: true | ||
} else if (node.type === 'text') { | ||
mem.push(node.content); | ||
var wrapTextNodes = i18nOptions.transWrapTextNodes; | ||
if (wrapTextNodes) { | ||
mem.push(React__default.createElement(wrapTextNodes, { | ||
key: "".concat(node.name, "-").concat(i) | ||
}, node.content)); | ||
} else { | ||
mem.push(node.content); | ||
} | ||
} | ||
@@ -647,0 +656,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e=e||self).ReactI18next={},e.React)}(this,(function(e,n){"use strict";var t="default"in n?n.default:n;function r(e){return(r="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 i(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function c(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e,n){if(null==e)return{};var t,r,i=function(e,n){if(null==e)return{};var t,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}function u(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(t.push(o.value),!n||t.length!==n);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return l(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return l(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var f={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},p=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function d(e){var n={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},t=e.match(/<\/?([^\s]+?)[/\s>]/);if(t&&(n.name=t[1],(f[t[1]]||"/"===e.charAt(e.length-2))&&(n.voidElement=!0),n.name.startsWith("!--"))){var r=e.indexOf("--\x3e");return{type:"comment",comment:-1!==r?e.slice(4,r):""}}for(var i=new RegExp(p),a=null;null!==(a=i.exec(e));)if(a[0].trim())if(a[1]){var o=a[1].trim(),c=[o,""];o.indexOf("=")>-1&&(c=o.split("=")),n.attrs[c[0]]=c[1],i.lastIndex--}else a[2]&&(n.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return n}var m=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,h=/^\s*$/,g=Object.create(null);var y,v=function(e,n){n||(n={}),n.components||(n.components=g);var t,r=[],i=[],a=-1,o=!1;if(0!==e.indexOf("<")){var c=e.indexOf("<");r.push({type:"text",content:-1===c?e:e.substring(0,c)})}return e.replace(m,(function(c,s){if(o){if(c!=="</"+t.name+">")return;o=!1}var u,l="/"!==c.charAt(1),f=c.startsWith("\x3c!--"),p=s+c.length,m=e.charAt(p);if(f){var g=d(c);return a<0?(r.push(g),r):((u=i[a]).children.push(g),r)}if(l&&(a++,"tag"===(t=d(c)).type&&n.components[t.name]&&(t.type="component",o=!0),t.voidElement||o||!m||"<"===m||t.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),0===a&&r.push(t),(u=i[a-1])&&u.children.push(t),i[a]=t),(!l||t.voidElement)&&(a>-1&&(t.voidElement||t.name===c.slice(2,-1))&&(a--,t=-1===a?r:i[a]),!o&&"<"!==m&&m)){u=-1===a?r:i[a].children;var y=e.indexOf("<",p),v=e.slice(p,-1===y?void 0:y);h.test(v)&&(v=" "),(y>-1&&a+u.length>=0||" "!==v)&&u.push({type:"text",content:v})}})),r},b={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0},O=t.createContext();function w(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};b=c(c({},b),e)}function j(){return b}var x=function(){function e(){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.usedNamespaces={}}var n,t,r;return n=e,(t=[{key:"addUsedNamespaces",value:function(e){var n=this;e.forEach((function(e){n.usedNamespaces[e]||(n.usedNamespaces[e]=!0)}))}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}])&&i(n.prototype,t),r&&i(n,r),e}();function E(e){y=e}function S(){return y}var N={type:"3rdParty",init:function(e){w(e.options.react),E(e)}};function I(e){return function(n){return new Promise((function(t){var r=k();e.getInitialProps?e.getInitialProps(n).then((function(e){t(c(c({},e),r))})):t(r)}))}}function k(){var e=S(),n=e.reportNamespaces?e.reportNamespaces.getUsedNamespaces():[],t={},r={};return e.languages.forEach((function(t){r[t]={},n.forEach((function(n){r[t][n]=e.getResourceBundle(t,n)||{}}))})),t.initialI18nStore=r,t.initialLanguage=e.language,t}function P(){if(console&&console.warn){for(var e,n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];"string"==typeof t[0]&&(t[0]="react-i18next:: ".concat(t[0])),(e=console).warn.apply(e,t)}}var R={};function C(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];"string"==typeof n[0]&&R[n[0]]||("string"==typeof n[0]&&(R[n[0]]=new Date),P.apply(void 0,n))}function A(e,n,t){e.loadNamespaces(n,(function(){if(e.isInitialized)t();else{e.on("initialized",(function n(){setTimeout((function(){e.off("initialized",n)}),0),t()}))}}))}function T(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!n.languages||!n.languages.length)return C("i18n.languages were undefined or empty",n.languages),!0;var r=n.languages[0],i=!!n.options&&n.options.fallbackLng,a=n.languages[n.languages.length-1];if("cimode"===r.toLowerCase())return!0;var o=function(e,t){var r=n.services.backendConnector.state["".concat(e,"|").concat(t)];return-1===r||2===r};return!(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!o(n.isLanguageChangingTo,e))&&(!!n.hasResourceBundle(r,e)||(!n.services.backendConnector.backend||!(!o(r,e)||i&&!o(a,e))))}function z(e){return e.displayName||e.name||("string"==typeof e&&e.length>0?e:"Unknown")}function L(e,n){if(!e)return!1;var t=e.props?e.props.children:e.children;return n?t.length>0:!!t}function D(e){return e?e&&e.children?e.children:e.props&&e.props.children:[]}function B(e){return Array.isArray(e)?e:[e]}function U(e,n,i,a,o){if(""===n)return[];var s=a.transKeepBasicHtmlNodesFor||[],u=n&&new RegExp(s.join("|")).test(n);if(!e&&!u)return[n];var l={};!function e(n){B(n).forEach((function(n){"string"!=typeof n&&(L(n)?e(D(n)):"object"!==r(n)||t.isValidElement(n)||Object.assign(l,n))}))}(e);var f=i.services.interpolator.interpolate(n,c(c({},l),o),i.language),p=v("<0>".concat(f,"</0>"));function d(e,n,r){var i=D(e),a=h(i,n.children,r);return function(e){return"[object Array]"===Object.prototype.toString.call(e)&&e.every((function(e){return t.isValidElement(e)}))}(i)&&0===a.length?i:a}function m(e,n,r,i,a){e.dummy&&(e.children=n),r.push(t.cloneElement(e,c(c({},e.props),{},{key:i}),a?void 0:n))}function h(n,i,o){var l=B(n);return B(i).reduce((function(n,i,f){var p,g,y,v=i.children&&i.children[0]&&i.children[0].content;if("tag"===i.type){var b=l[parseInt(i.name,10)];!b&&1===o.length&&o[0][i.name]&&(b=o[0][i.name]),b||(b={});var O=0!==Object.keys(i.attrs).length?(p={props:i.attrs},(y=c({},g=b)).props=Object.assign(p.props,g.props),y):b,w=t.isValidElement(O),j=w&&L(i,!0)&&!i.voidElement,x=u&&"object"===r(O)&&O.dummy&&!w,E="object"===r(e)&&null!==e&&Object.hasOwnProperty.call(e,i.name);if("string"==typeof O)n.push(O);else if(L(O)||j){m(O,d(O,i,o),n,f)}else if(x){var S=h(l,i.children,o);n.push(t.cloneElement(O,c(c({},O.props),{},{key:f}),S))}else if(Number.isNaN(parseFloat(i.name))){if(E)m(O,d(O,i,o),n,f,i.voidElement);else if(a.transSupportBasicHtmlNodes&&s.indexOf(i.name)>-1)if(i.voidElement)n.push(t.createElement(i.name,{key:"".concat(i.name,"-").concat(f)}));else{var N=h(l,i.children,o);n.push(t.createElement(i.name,{key:"".concat(i.name,"-").concat(f)},N))}else if(i.voidElement)n.push("<".concat(i.name," />"));else{var I=h(l,i.children,o);n.push("<".concat(i.name,">").concat(I,"</").concat(i.name,">"))}}else if("object"!==r(O)||w)1===i.children.length&&v?n.push(t.cloneElement(O,c(c({},O.props),{},{key:f}),v)):n.push(t.cloneElement(O,c(c({},O.props),{},{key:f})));else{var k=i.children[0]?v:null;k&&n.push(k)}}else"text"===i.type&&n.push(i.content);return n}),[])}return D(h([{dummy:!0,children:e}],p,B(e||[]))[0])}function V(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.i18n,i=n.useContext(O)||{},a=i.i18n,o=i.defaultNS,s=r||a||S();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new x),!s){C("You will need to pass in an i18next instance by using initReactI18next");var l=function(e){return Array.isArray(e)?e[e.length-1]:e},f=[l,{},!1];return f.t=l,f.i18n={},f.ready=!1,f}s.options.react&&void 0!==s.options.react.wait&&C("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var p=c(c(c({},j()),s.options.react),t),d=p.useSuspense,m=e||o||s.options&&s.options.defaultNS;m="string"==typeof m?[m]:m||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(m);var h=(s.isInitialized||s.initializedStoreOnce)&&m.every((function(e){return T(e,s,p)}));function g(){return s.getFixedT(null,"fallback"===p.nsMode?m:m[0])}var y=n.useState(g),v=u(y,2),b=v[0],w=v[1],E=n.useRef(!0);n.useEffect((function(){var e=p.bindI18n,n=p.bindI18nStore;function t(){E.current&&w(g)}return E.current=!0,h||d||A(s,m,(function(){E.current&&w(g)})),e&&s&&s.on(e,t),n&&s&&s.store.on(n,t),function(){E.current=!1,e&&s&&e.split(" ").forEach((function(e){return s.off(e,t)})),n&&s&&n.split(" ").forEach((function(e){return s.store.off(e,t)}))}}),[s,m.join()]);var N=n.useRef(!0);n.useEffect((function(){E.current&&!N.current&&w(g),N.current=!1}),[s]);var I=[b,s,h];if(I.t=b,I.i18n=s,I.ready=h,h)return I;if(!h&&!d)return I;throw new Promise((function(e){A(s,m,(function(){e()}))}))}function K(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r.i18n,a=n.useContext(O)||{},o=a.i18n,c=i||o||S();c.options&&c.options.isClone||(e&&!c.initializedStoreOnce&&(c.services.resourceStore.data=e,c.options.ns=Object.values(e).reduce((function(e,n){return Object.keys(n).forEach((function(n){e.indexOf(n)<0&&e.push(n)})),e}),c.options.ns),c.initializedStoreOnce=!0,c.isInitialized=!0),t&&!c.initializedLanguageOnce&&(c.changeLanguage(t),c.initializedLanguageOnce=!0))}e.I18nContext=O,e.I18nextProvider=function(e){var t=e.i18n,r=e.defaultNS,i=e.children,a=n.useMemo((function(){return{i18n:t,defaultNS:r}}),[t,r]);return n.createElement(O.Provider,{value:a},i)},e.Trans=function(e){var i=e.children,a=e.count,o=e.parent,u=e.i18nKey,l=e.tOptions,f=void 0===l?{}:l,p=e.values,d=e.defaults,m=e.components,h=e.ns,g=e.i18n,y=e.t,v=s(e,["children","count","parent","i18nKey","tOptions","values","defaults","components","ns","i18n","t"]),b=n.useContext(O)||{},w=b.i18n,x=b.defaultNS,E=g||w||S();if(!E)return C("You will need to pass in an i18next instance by using i18nextReactModule"),i;var N=y||E.t.bind(E)||function(e){return e},I=c(c({},j()),E.options&&E.options.react),k=h||N.ns||x||E.options&&E.options.defaultNS;k="string"==typeof k?[k]:k||["translation"];var R=d||function e(n,i){if(!n)return"";var a="",o=B(n),c=i.transKeepBasicHtmlNodesFor||[];return o.forEach((function(n,o){if("string"==typeof n)a+="".concat(n);else if(t.isValidElement(n)){var u=Object.keys(n.props).length,l=c.indexOf(n.type)>-1,f=n.props.children;if(!f&&l&&0===u)a+="<".concat(n.type,"/>");else if(f||l&&0===u)if(n.props.i18nIsDynamicList)a+="<".concat(o,"></").concat(o,">");else if(l&&1===u&&"string"==typeof f)a+="<".concat(n.type,">").concat(f,"</").concat(n.type,">");else{var p=e(f,i);a+="<".concat(o,">").concat(p,"</").concat(o,">")}else a+="<".concat(o,"></").concat(o,">")}else if(null===n)P("Trans: the passed in value is invalid - seems you passed in a null child.");else if("object"===r(n)){var d=n.format,m=s(n,["format"]),h=Object.keys(m);if(1===h.length){var g=d?"".concat(h[0],", ").concat(d):h[0];a+="{{".concat(g,"}}")}else P("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",n)}else P("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.",n)})),a}(i,I)||I.transEmptyNodeValue||u,A=I.hashTransKey,T=u||(A?A(R):R),z=p?f.interpolation:{interpolation:c(c({},f.interpolation),{},{prefix:"#$?",suffix:"?$#"})},L=c(c(c(c({},f),{},{count:a},p),z),{},{defaultValue:R,ns:k}),D=U(m||i,T?N(T,L):R,E,I,L),V=void 0!==o?o:I.defaultTransParent;return V?t.createElement(V,v,D):D},e.Translation=function(e){var n=e.ns,t=e.children,r=u(V(n,s(e,["ns","children"])),3),i=r[0],a=r[1],o=r[2];return t(i,{i18n:a,lng:a.language},o)},e.composeInitialProps=I,e.date=function(){return""},e.getDefaults=j,e.getI18n=S,e.getInitialProps=k,e.initReactI18next=N,e.number=function(){return""},e.plural=function(){return""},e.select=function(){return""},e.selectOrdinal=function(){return""},e.setDefaults=w,e.setI18n=E,e.time=function(){return""},e.useSSR=K,e.useTranslation=V,e.withSSR=function(){return function(e){function n(n){var r=n.initialI18nStore,i=n.initialLanguage,a=s(n,["initialI18nStore","initialLanguage"]);return K(r,i),t.createElement(e,c({},a))}return n.getInitialProps=I(e),n.displayName="withI18nextSSR(".concat(z(e),")"),n.WrappedComponent=e,n}},e.withTranslation=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(r){function i(i){var a=i.forwardedRef,o=s(i,["forwardedRef"]),l=u(V(e,o),3),f=l[0],p=l[1],d=l[2],m=c(c({},o),{},{t:f,i18n:p,tReady:d});return n.withRef&&a?m.ref=a:!n.withRef&&a&&(m.forwardedRef=a),t.createElement(r,m)}i.displayName="withI18nextTranslation(".concat(z(r),")"),i.WrappedComponent=r;return n.withRef?t.forwardRef((function(e,n){return t.createElement(i,Object.assign({},e,{forwardedRef:n}))})):i}},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e=e||self).ReactI18next={},e.React)}(this,(function(e,n){"use strict";var t="default"in n?n.default:n;function r(e){return(r="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 i(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function c(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e,n){if(null==e)return{};var t,r,i=function(e,n){if(null==e)return{};var t,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}function u(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(t.push(o.value),!n||t.length!==n);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return l(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return l(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var f={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},p=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function d(e){var n={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},t=e.match(/<\/?([^\s]+?)[/\s>]/);if(t&&(n.name=t[1],(f[t[1]]||"/"===e.charAt(e.length-2))&&(n.voidElement=!0),n.name.startsWith("!--"))){var r=e.indexOf("--\x3e");return{type:"comment",comment:-1!==r?e.slice(4,r):""}}for(var i=new RegExp(p),a=null;null!==(a=i.exec(e));)if(a[0].trim())if(a[1]){var o=a[1].trim(),c=[o,""];o.indexOf("=")>-1&&(c=o.split("=")),n.attrs[c[0]]=c[1],i.lastIndex--}else a[2]&&(n.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return n}var m=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,h=/^\s*$/,g=Object.create(null);var y,v=function(e,n){n||(n={}),n.components||(n.components=g);var t,r=[],i=[],a=-1,o=!1;if(0!==e.indexOf("<")){var c=e.indexOf("<");r.push({type:"text",content:-1===c?e:e.substring(0,c)})}return e.replace(m,(function(c,s){if(o){if(c!=="</"+t.name+">")return;o=!1}var u,l="/"!==c.charAt(1),f=c.startsWith("\x3c!--"),p=s+c.length,m=e.charAt(p);if(f){var g=d(c);return a<0?(r.push(g),r):((u=i[a]).children.push(g),r)}if(l&&(a++,"tag"===(t=d(c)).type&&n.components[t.name]&&(t.type="component",o=!0),t.voidElement||o||!m||"<"===m||t.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),0===a&&r.push(t),(u=i[a-1])&&u.children.push(t),i[a]=t),(!l||t.voidElement)&&(a>-1&&(t.voidElement||t.name===c.slice(2,-1))&&(a--,t=-1===a?r:i[a]),!o&&"<"!==m&&m)){u=-1===a?r:i[a].children;var y=e.indexOf("<",p),v=e.slice(p,-1===y?void 0:y);h.test(v)&&(v=" "),(y>-1&&a+u.length>=0||" "!==v)&&u.push({type:"text",content:v})}})),r},b={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0},O=t.createContext();function w(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};b=c(c({},b),e)}function x(){return b}var j=function(){function e(){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.usedNamespaces={}}var n,t,r;return n=e,(t=[{key:"addUsedNamespaces",value:function(e){var n=this;e.forEach((function(e){n.usedNamespaces[e]||(n.usedNamespaces[e]=!0)}))}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}])&&i(n.prototype,t),r&&i(n,r),e}();function E(e){y=e}function S(){return y}var N={type:"3rdParty",init:function(e){w(e.options.react),E(e)}};function I(e){return function(n){return new Promise((function(t){var r=k();e.getInitialProps?e.getInitialProps(n).then((function(e){t(c(c({},e),r))})):t(r)}))}}function k(){var e=S(),n=e.reportNamespaces?e.reportNamespaces.getUsedNamespaces():[],t={},r={};return e.languages.forEach((function(t){r[t]={},n.forEach((function(n){r[t][n]=e.getResourceBundle(t,n)||{}}))})),t.initialI18nStore=r,t.initialLanguage=e.language,t}function P(){if(console&&console.warn){for(var e,n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];"string"==typeof t[0]&&(t[0]="react-i18next:: ".concat(t[0])),(e=console).warn.apply(e,t)}}var R={};function C(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];"string"==typeof n[0]&&R[n[0]]||("string"==typeof n[0]&&(R[n[0]]=new Date),P.apply(void 0,n))}function A(e,n,t){e.loadNamespaces(n,(function(){if(e.isInitialized)t();else{e.on("initialized",(function n(){setTimeout((function(){e.off("initialized",n)}),0),t()}))}}))}function T(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!n.languages||!n.languages.length)return C("i18n.languages were undefined or empty",n.languages),!0;var r=n.languages[0],i=!!n.options&&n.options.fallbackLng,a=n.languages[n.languages.length-1];if("cimode"===r.toLowerCase())return!0;var o=function(e,t){var r=n.services.backendConnector.state["".concat(e,"|").concat(t)];return-1===r||2===r};return!(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!o(n.isLanguageChangingTo,e))&&(!!n.hasResourceBundle(r,e)||(!n.services.backendConnector.backend||!(!o(r,e)||i&&!o(a,e))))}function z(e){return e.displayName||e.name||("string"==typeof e&&e.length>0?e:"Unknown")}function L(e,n){if(!e)return!1;var t=e.props?e.props.children:e.children;return n?t.length>0:!!t}function D(e){return e?e&&e.children?e.children:e.props&&e.props.children:[]}function B(e){return Array.isArray(e)?e:[e]}function U(e,n,i,a,o){if(""===n)return[];var s=a.transKeepBasicHtmlNodesFor||[],u=n&&new RegExp(s.join("|")).test(n);if(!e&&!u)return[n];var l={};!function e(n){B(n).forEach((function(n){"string"!=typeof n&&(L(n)?e(D(n)):"object"!==r(n)||t.isValidElement(n)||Object.assign(l,n))}))}(e);var f=i.services.interpolator.interpolate(n,c(c({},l),o),i.language),p=v("<0>".concat(f,"</0>"));function d(e,n,r){var i=D(e),a=h(i,n.children,r);return function(e){return"[object Array]"===Object.prototype.toString.call(e)&&e.every((function(e){return t.isValidElement(e)}))}(i)&&0===a.length?i:a}function m(e,n,r,i,a){e.dummy&&(e.children=n),r.push(t.cloneElement(e,c(c({},e.props),{},{key:i}),a?void 0:n))}function h(n,i,o){var l=B(n);return B(i).reduce((function(n,i,f){var p,g,y,v=i.children&&i.children[0]&&i.children[0].content;if("tag"===i.type){var b=l[parseInt(i.name,10)];!b&&1===o.length&&o[0][i.name]&&(b=o[0][i.name]),b||(b={});var O=0!==Object.keys(i.attrs).length?(p={props:i.attrs},(y=c({},g=b)).props=Object.assign(p.props,g.props),y):b,w=t.isValidElement(O),x=w&&L(i,!0)&&!i.voidElement,j=u&&"object"===r(O)&&O.dummy&&!w,E="object"===r(e)&&null!==e&&Object.hasOwnProperty.call(e,i.name);if("string"==typeof O)n.push(O);else if(L(O)||x){m(O,d(O,i,o),n,f)}else if(j){var S=h(l,i.children,o);n.push(t.cloneElement(O,c(c({},O.props),{},{key:f}),S))}else if(Number.isNaN(parseFloat(i.name))){if(E)m(O,d(O,i,o),n,f,i.voidElement);else if(a.transSupportBasicHtmlNodes&&s.indexOf(i.name)>-1)if(i.voidElement)n.push(t.createElement(i.name,{key:"".concat(i.name,"-").concat(f)}));else{var N=h(l,i.children,o);n.push(t.createElement(i.name,{key:"".concat(i.name,"-").concat(f)},N))}else if(i.voidElement)n.push("<".concat(i.name," />"));else{var I=h(l,i.children,o);n.push("<".concat(i.name,">").concat(I,"</").concat(i.name,">"))}}else if("object"!==r(O)||w)1===i.children.length&&v?n.push(t.cloneElement(O,c(c({},O.props),{},{key:f}),v)):n.push(t.cloneElement(O,c(c({},O.props),{},{key:f})));else{var k=i.children[0]?v:null;k&&n.push(k)}}else if("text"===i.type){var P=a.transWrapTextNodes;P?n.push(t.createElement(P,{key:"".concat(i.name,"-").concat(f)},i.content)):n.push(i.content)}return n}),[])}return D(h([{dummy:!0,children:e}],p,B(e||[]))[0])}function V(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.i18n,i=n.useContext(O)||{},a=i.i18n,o=i.defaultNS,s=r||a||S();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new j),!s){C("You will need to pass in an i18next instance by using initReactI18next");var l=function(e){return Array.isArray(e)?e[e.length-1]:e},f=[l,{},!1];return f.t=l,f.i18n={},f.ready=!1,f}s.options.react&&void 0!==s.options.react.wait&&C("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var p=c(c(c({},x()),s.options.react),t),d=p.useSuspense,m=e||o||s.options&&s.options.defaultNS;m="string"==typeof m?[m]:m||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(m);var h=(s.isInitialized||s.initializedStoreOnce)&&m.every((function(e){return T(e,s,p)}));function g(){return s.getFixedT(null,"fallback"===p.nsMode?m:m[0])}var y=n.useState(g),v=u(y,2),b=v[0],w=v[1],E=n.useRef(!0);n.useEffect((function(){var e=p.bindI18n,n=p.bindI18nStore;function t(){E.current&&w(g)}return E.current=!0,h||d||A(s,m,(function(){E.current&&w(g)})),e&&s&&s.on(e,t),n&&s&&s.store.on(n,t),function(){E.current=!1,e&&s&&e.split(" ").forEach((function(e){return s.off(e,t)})),n&&s&&n.split(" ").forEach((function(e){return s.store.off(e,t)}))}}),[s,m.join()]);var N=n.useRef(!0);n.useEffect((function(){E.current&&!N.current&&w(g),N.current=!1}),[s]);var I=[b,s,h];if(I.t=b,I.i18n=s,I.ready=h,h)return I;if(!h&&!d)return I;throw new Promise((function(e){A(s,m,(function(){e()}))}))}function K(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r.i18n,a=n.useContext(O)||{},o=a.i18n,c=i||o||S();c.options&&c.options.isClone||(e&&!c.initializedStoreOnce&&(c.services.resourceStore.data=e,c.options.ns=Object.values(e).reduce((function(e,n){return Object.keys(n).forEach((function(n){e.indexOf(n)<0&&e.push(n)})),e}),c.options.ns),c.initializedStoreOnce=!0,c.isInitialized=!0),t&&!c.initializedLanguageOnce&&(c.changeLanguage(t),c.initializedLanguageOnce=!0))}e.I18nContext=O,e.I18nextProvider=function(e){var t=e.i18n,r=e.defaultNS,i=e.children,a=n.useMemo((function(){return{i18n:t,defaultNS:r}}),[t,r]);return n.createElement(O.Provider,{value:a},i)},e.Trans=function(e){var i=e.children,a=e.count,o=e.parent,u=e.i18nKey,l=e.tOptions,f=void 0===l?{}:l,p=e.values,d=e.defaults,m=e.components,h=e.ns,g=e.i18n,y=e.t,v=s(e,["children","count","parent","i18nKey","tOptions","values","defaults","components","ns","i18n","t"]),b=n.useContext(O)||{},w=b.i18n,j=b.defaultNS,E=g||w||S();if(!E)return C("You will need to pass in an i18next instance by using i18nextReactModule"),i;var N=y||E.t.bind(E)||function(e){return e},I=c(c({},x()),E.options&&E.options.react),k=h||N.ns||j||E.options&&E.options.defaultNS;k="string"==typeof k?[k]:k||["translation"];var R=d||function e(n,i){if(!n)return"";var a="",o=B(n),c=i.transKeepBasicHtmlNodesFor||[];return o.forEach((function(n,o){if("string"==typeof n)a+="".concat(n);else if(t.isValidElement(n)){var u=Object.keys(n.props).length,l=c.indexOf(n.type)>-1,f=n.props.children;if(!f&&l&&0===u)a+="<".concat(n.type,"/>");else if(f||l&&0===u)if(n.props.i18nIsDynamicList)a+="<".concat(o,"></").concat(o,">");else if(l&&1===u&&"string"==typeof f)a+="<".concat(n.type,">").concat(f,"</").concat(n.type,">");else{var p=e(f,i);a+="<".concat(o,">").concat(p,"</").concat(o,">")}else a+="<".concat(o,"></").concat(o,">")}else if(null===n)P("Trans: the passed in value is invalid - seems you passed in a null child.");else if("object"===r(n)){var d=n.format,m=s(n,["format"]),h=Object.keys(m);if(1===h.length){var g=d?"".concat(h[0],", ").concat(d):h[0];a+="{{".concat(g,"}}")}else P("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",n)}else P("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.",n)})),a}(i,I)||I.transEmptyNodeValue||u,A=I.hashTransKey,T=u||(A?A(R):R),z=p?f.interpolation:{interpolation:c(c({},f.interpolation),{},{prefix:"#$?",suffix:"?$#"})},L=c(c(c(c({},f),{},{count:a},p),z),{},{defaultValue:R,ns:k}),D=U(m||i,T?N(T,L):R,E,I,L),V=void 0!==o?o:I.defaultTransParent;return V?t.createElement(V,v,D):D},e.Translation=function(e){var n=e.ns,t=e.children,r=u(V(n,s(e,["ns","children"])),3),i=r[0],a=r[1],o=r[2];return t(i,{i18n:a,lng:a.language},o)},e.composeInitialProps=I,e.date=function(){return""},e.getDefaults=x,e.getI18n=S,e.getInitialProps=k,e.initReactI18next=N,e.number=function(){return""},e.plural=function(){return""},e.select=function(){return""},e.selectOrdinal=function(){return""},e.setDefaults=w,e.setI18n=E,e.time=function(){return""},e.useSSR=K,e.useTranslation=V,e.withSSR=function(){return function(e){function n(n){var r=n.initialI18nStore,i=n.initialLanguage,a=s(n,["initialI18nStore","initialLanguage"]);return K(r,i),t.createElement(e,c({},a))}return n.getInitialProps=I(e),n.displayName="withI18nextSSR(".concat(z(e),")"),n.WrappedComponent=e,n}},e.withTranslation=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(r){function i(i){var a=i.forwardedRef,o=s(i,["forwardedRef"]),l=u(V(e,o),3),f=l[0],p=l[1],d=l[2],m=c(c({},o),{},{t:f,i18n:p,tReady:d});return n.withRef&&a?m.ref=a:!n.withRef&&a&&(m.forwardedRef=a),t.createElement(r,m)}i.displayName="withI18nextTranslation(".concat(z(r),")"),i.WrappedComponent=r;return n.withRef?t.forwardRef((function(e,n){return t.createElement(i,Object.assign({},e,{forwardedRef:n}))})):i}},Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -9,2 +9,3 @@ import React from 'react'; | ||
transSupportBasicHtmlNodes: true, | ||
transWrapTextNodes: '', | ||
transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'], | ||
@@ -33,3 +34,3 @@ // hashTransKey: key => key // calculate a key for Trans component based on defaultValue | ||
addUsedNamespaces(namespaces) { | ||
namespaces.forEach(ns => { | ||
namespaces.forEach((ns) => { | ||
if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true; | ||
@@ -62,8 +63,8 @@ }); | ||
export function composeInitialProps(ForComponent) { | ||
return ctx => | ||
new Promise(resolve => { | ||
return (ctx) => | ||
new Promise((resolve) => { | ||
const i18nInitialProps = getInitialProps(); | ||
if (ForComponent.getInitialProps) { | ||
ForComponent.getInitialProps(ctx).then(componentsInitialProps => { | ||
ForComponent.getInitialProps(ctx).then((componentsInitialProps) => { | ||
resolve({ | ||
@@ -100,5 +101,5 @@ ...componentsInitialProps, | ||
const initialI18nStore = {}; | ||
i18n.languages.forEach(l => { | ||
i18n.languages.forEach((l) => { | ||
initialI18nStore[l] = {}; | ||
namespaces.forEach(ns => { | ||
namespaces.forEach((ns) => { | ||
initialI18nStore[l][ns] = i18n.getResourceBundle(l, ns) || {}; | ||
@@ -105,0 +106,0 @@ }); |
@@ -245,3 +245,8 @@ import React, { useContext } from 'react'; | ||
} else if (node.type === 'text') { | ||
mem.push(node.content); | ||
const wrapTextNodes = i18nOptions.transWrapTextNodes; | ||
if (wrapTextNodes) { | ||
mem.push(React.createElement(wrapTextNodes, { key: `${node.name}-${i}` }, node.content)); | ||
} else { | ||
mem.push(node.content); | ||
} | ||
} | ||
@@ -248,0 +253,0 @@ return mem; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
327768
5804
Updated@babel/runtime@^7.14.0