react-i18next 11.8.15 → 11.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ### 11.11.1
2
+
3
+ - feat(types): allow readonly namespaces in useTranslation [1339](https://github.com/i18next/react-i18next/pull/1339)
4
+
5
+ ### 11.11.0
6
+
7
+ - introduce `CustomTypeOptions` type definition and deprecate the `Resources` type definition [1328](https://github.com/i18next/react-i18next/pull/1328)
8
+
9
+ ### 11.10.0
10
+
11
+ - 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)
12
+
13
+ ### 11.9.0
14
+
15
+ - typescript/icu macro: add new syntax for interpolation of complex types [1316](https://github.com/i18next/react-i18next/pull/1316) -> [docs for template usage](https://react.i18next.com/misc/using-with-icu-format#tagged-template-for-icu)
16
+
1
17
  ### 11.8.15
2
18
 
3
19
  - ignore null children in Trans component [1307](https://github.com/i18next/react-i18next/issues/1307)
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015 i18next
3
+ Copyright (c) 2021 i18next
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -18,10 +18,10 @@
18
18
 
19
19
  ### IMPORTANT:
20
20
 
21
- Master Branch is the new v10 using hooks.
21
+ Master Branch is the newest version using hooks (>= v10).
22
22
 
23
23
  ```bash
24
- $ v10.0.0
24
+ $ >=v10.0.0
25
25
  npm i react-i18next
26
26
  ```
27
27
 
@@ -37,6 +37,7 @@ npm i react-i18next@legacy
37
37
  ### Documentation
38
38
 
39
39
  The documentation is published on [react.i18next.com](https://react.i18next.com)
40
+ The general i18next documentation is published on [www.i18next.com](https://www.i18next.com)
40
41
 
41
42
  ### What will my code look like?
42
43
 
@@ -66,10 +67,11 @@ Head over to the **interactive playground** at [codesandbox](https://codesandbox
66
67
 
67
68
  ### 📖 What others say
68
69
 
70
+ - [How to properly internationalize a React application using i18next](https://dev.to/adrai/how-to-properly-internationalize-a-react-application-using-i18next-3hdb) by Adriano Raiano
69
71
  - [I18n with React and i18next](https://alligator.io/react/i18n-with-react-and-i18next) via Alligator.io by Danny Hurlburt
70
72
  - [Ultimate Localization of React (Mobx) App with i18next](https://itnext.io/ultimate-localization-of-react-mobx-app-with-i18next-efab77712149) via itnext.io by Viktor Shevchenko
71
73
  - [Internationalization for react done right Using the i18next i18n ecosystem](https://reactjsexample.com/internationalization-for-react-done-right-using-the-i18next-i18n-ecosystem/) via reactjsexample.com
72
- - [Using i18next to translate React.js application](https://codetain.co/2018/05/using-i18next-to-translate-reactjs-application/) via codetain.co by Kasia Dadek
74
+ - [How to translate React application with react-i18next](https://codetain.com/blog/how-to-translate-react-application-with-react-i18next/) via codetain.co by Norbert Suski
73
75
  - [Building i18n with Gatsby](https://www.gatsbyjs.org/blog/2017-10-17-building-i18n-with-gatsby/) via gatsbyjs.org by Samuel Goudie
74
76
  - [Get your react.js application translated with style](https://medium.com/@jamuhl/get-your-react-js-application-translated-with-style-4ad090aefc2c) by Jan Mühlemann
75
77
  - [Translate your expo.io / react-native mobile application](https://medium.com/@jamuhl/translate-your-expo-io-react-native-mobile-application-aa220b2362d2) by Jan Mühlemann
@@ -102,10 +104,16 @@ $ npm install react-i18next
102
104
 
103
105
  - If you don't use a module loader it will be added to `window.reactI18next`
104
106
 
107
+ ### Do you like to read a more complete step by step tutorial?
108
+
109
+ [Here](https://dev.to/adrai/how-to-properly-internationalize-a-react-application-using-i18next-3hdb) you'll find a simple tutorial on how to best use react-i18next.
110
+ Some basics of i18next and some cool possibilities on how to optimize your localization workflow.
111
+
105
112
  ### Examples
106
113
 
107
114
  - [Example react](https://github.com/i18next/react-i18next/tree/master/example/react)
108
115
  - [Example react with typescript 4.1+](https://github.com/i18next/react-i18next/tree/master/example/react-typescript4.1)
116
+ - [Example locize.com](https://github.com/i18next/react-i18next/tree/master/example/locize)
109
117
 
110
118
  #### v9 samples
111
119
 
@@ -117,7 +125,7 @@ $ npm install react-i18next
117
125
  - [Example razzle](https://github.com/i18next/react-i18next/tree/master/example/v9.x.x/razzle-ssr)
118
126
  - [Example hashbase / beaker browser](https://github.com/i18next/react-i18next/tree/master/example/v9.x.x/dat)
119
127
  - [Example storybook](https://github.com/i18next/react-i18next/tree/master/example/v9.x.x/storybook)
120
- - [Example locize.com](https://github.com/i18next/react-i18next/tree/master/example/v9.x.x/locize-example)
128
+ - [Example locize.com](https://github.com/i18next/react-i18next/tree/master/example/v9.x.x/locize)
121
129
  - [Example test with jest](https://github.com/i18next/react-i18next/tree/master/example/v9.x.x/test-jest)
122
130
 
123
131
  ### Requirements
@@ -2,6 +2,44 @@ define(['exports', 'react'], function (exports, React) { 'use strict';
2
2
 
3
3
  var React__default = 'default' in React ? React['default'] : React;
4
4
 
5
+ function ownKeys(object, enumerableOnly) {
6
+ var keys = Object.keys(object);
7
+
8
+ if (Object.getOwnPropertySymbols) {
9
+ var symbols = Object.getOwnPropertySymbols(object);
10
+
11
+ if (enumerableOnly) {
12
+ symbols = symbols.filter(function (sym) {
13
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
14
+ });
15
+ }
16
+
17
+ keys.push.apply(keys, symbols);
18
+ }
19
+
20
+ return keys;
21
+ }
22
+
23
+ function _objectSpread2(target) {
24
+ for (var i = 1; i < arguments.length; i++) {
25
+ var source = arguments[i] != null ? arguments[i] : {};
26
+
27
+ if (i % 2) {
28
+ ownKeys(Object(source), true).forEach(function (key) {
29
+ _defineProperty(target, key, source[key]);
30
+ });
31
+ } else if (Object.getOwnPropertyDescriptors) {
32
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
33
+ } else {
34
+ ownKeys(Object(source)).forEach(function (key) {
35
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
36
+ });
37
+ }
38
+ }
39
+
40
+ return target;
41
+ }
42
+
5
43
  function _typeof(obj) {
6
44
  "@babel/helpers - typeof";
7
45
 
@@ -55,40 +93,6 @@ define(['exports', 'react'], function (exports, React) { 'use strict';
55
93
  return obj;
56
94
  }
57
95
 
58
- function ownKeys(object, enumerableOnly) {
59
- var keys = Object.keys(object);
60
-
61
- if (Object.getOwnPropertySymbols) {
62
- var symbols = Object.getOwnPropertySymbols(object);
63
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
64
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
65
- });
66
- keys.push.apply(keys, symbols);
67
- }
68
-
69
- return keys;
70
- }
71
-
72
- function _objectSpread2(target) {
73
- for (var i = 1; i < arguments.length; i++) {
74
- var source = arguments[i] != null ? arguments[i] : {};
75
-
76
- if (i % 2) {
77
- ownKeys(Object(source), true).forEach(function (key) {
78
- _defineProperty(target, key, source[key]);
79
- });
80
- } else if (Object.getOwnPropertyDescriptors) {
81
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
82
- } else {
83
- ownKeys(Object(source)).forEach(function (key) {
84
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
85
- });
86
- }
87
- }
88
-
89
- return target;
90
- }
91
-
92
96
  function _objectWithoutPropertiesLoose(source, excluded) {
93
97
  if (source == null) return {};
94
98
  var target = {};
@@ -134,14 +138,17 @@ define(['exports', 'react'], function (exports, React) { 'use strict';
134
138
  }
135
139
 
136
140
  function _iterableToArrayLimit(arr, i) {
137
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
141
+ var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]);
142
+
143
+ if (_i == null) return;
138
144
  var _arr = [];
139
145
  var _n = true;
140
146
  var _d = false;
141
- var _e = undefined;
147
+
148
+ var _s, _e;
142
149
 
143
150
  try {
144
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
151
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
145
152
  _arr.push(_s.value);
146
153
 
147
154
  if (i && _arr.length === i) break;
@@ -314,6 +321,7 @@ define(['exports', 'react'], function (exports, React) { 'use strict';
314
321
  bindI18nStore: '',
315
322
  transEmptyNodeValue: '',
316
323
  transSupportBasicHtmlNodes: true,
324
+ transWrapTextNodes: '',
317
325
  transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'],
318
326
  useSuspense: true
319
327
  };
@@ -462,6 +470,9 @@ define(['exports', 'react'], function (exports, React) { 'use strict';
462
470
  return Component.displayName || Component.name || (typeof Component === 'string' && Component.length > 0 ? Component : 'Unknown');
463
471
  }
464
472
 
473
+ var _excluded = ["format"],
474
+ _excluded2 = ["children", "count", "parent", "i18nKey", "tOptions", "values", "defaults", "components", "ns", "i18n", "t"];
475
+
465
476
  function hasChildren(node, checkLength) {
466
477
  if (!node) return false;
467
478
  var base = node.props ? node.props.children : node.children;
@@ -521,7 +532,7 @@ define(['exports', 'react'], function (exports, React) { 'use strict';
521
532
  warn("Trans: the passed in value is invalid - seems you passed in a null child.");
522
533
  } else if (_typeof(child) === 'object') {
523
534
  var format = child.format,
524
- clone = _objectWithoutProperties(child, ["format"]);
535
+ clone = _objectWithoutProperties(child, _excluded);
525
536
 
526
537
  var keys = Object.keys(clone);
527
538
 
@@ -636,7 +647,15 @@ define(['exports', 'react'], function (exports, React) { 'use strict';
636
647
  })));
637
648
  }
638
649
  } else if (node.type === 'text') {
639
- mem.push(node.content);
650
+ var wrapTextNodes = i18nOptions.transWrapTextNodes;
651
+
652
+ if (wrapTextNodes) {
653
+ mem.push(React__default.createElement(wrapTextNodes, {
654
+ key: "".concat(node.name, "-").concat(i)
655
+ }, node.content));
656
+ } else {
657
+ mem.push(node.content);
658
+ }
640
659
  }
641
660
 
642
661
  return mem;
@@ -663,7 +682,7 @@ define(['exports', 'react'], function (exports, React) { 'use strict';
663
682
  ns = _ref.ns,
664
683
  i18nFromProps = _ref.i18n,
665
684
  tFromProps = _ref.t,
666
- additionalProps = _objectWithoutProperties(_ref, ["children", "count", "parent", "i18nKey", "tOptions", "values", "defaults", "components", "ns", "i18n", "t"]);
685
+ additionalProps = _objectWithoutProperties(_ref, _excluded2);
667
686
 
668
687
  var _ref2 = React.useContext(I18nContext) || {},
669
688
  i18nFromContext = _ref2.i18n,
@@ -802,12 +821,13 @@ define(['exports', 'react'], function (exports, React) { 'use strict';
802
821
  });
803
822
  }
804
823
 
824
+ var _excluded$1 = ["forwardedRef"];
805
825
  function withTranslation(ns) {
806
826
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
807
827
  return function Extend(WrappedComponent) {
808
828
  function I18nextWithTranslation(_ref) {
809
829
  var forwardedRef = _ref.forwardedRef,
810
- rest = _objectWithoutProperties(_ref, ["forwardedRef"]);
830
+ rest = _objectWithoutProperties(_ref, _excluded$1);
811
831
 
812
832
  var _useTranslation = useTranslation(ns, rest),
813
833
  _useTranslation2 = _slicedToArray(_useTranslation, 3),
@@ -843,10 +863,11 @@ define(['exports', 'react'], function (exports, React) { 'use strict';
843
863
  };
844
864
  }
845
865
 
866
+ var _excluded$2 = ["ns", "children"];
846
867
  function Translation(props) {
847
868
  var ns = props.ns,
848
869
  children = props.children,
849
- options = _objectWithoutProperties(props, ["ns", "children"]);
870
+ options = _objectWithoutProperties(props, _excluded$2);
850
871
 
851
872
  var _useTranslation = useTranslation(ns, options),
852
873
  _useTranslation2 = _slicedToArray(_useTranslation, 3),
@@ -903,12 +924,13 @@ define(['exports', 'react'], function (exports, React) { 'use strict';
903
924
  }
904
925
  }
905
926
 
927
+ var _excluded$3 = ["initialI18nStore", "initialLanguage"];
906
928
  function withSSR() {
907
929
  return function Extend(WrappedComponent) {
908
930
  function I18nextWithSSR(_ref) {
909
931
  var initialI18nStore = _ref.initialI18nStore,
910
932
  initialLanguage = _ref.initialLanguage,
911
- rest = _objectWithoutProperties(_ref, ["initialI18nStore", "initialLanguage"]);
933
+ rest = _objectWithoutProperties(_ref, _excluded$3);
912
934
 
913
935
  useSSR(initialI18nStore, initialLanguage);
914
936
  return React__default.createElement(WrappedComponent, _objectSpread2({}, rest));
@@ -921,17 +943,42 @@ define(['exports', 'react'], function (exports, React) { 'use strict';
921
943
  };
922
944
  }
923
945
 
946
+ var date = function date() {
947
+ return '';
948
+ };
949
+ var time = function time() {
950
+ return '';
951
+ };
952
+ var number = function number() {
953
+ return '';
954
+ };
955
+ var select = function select() {
956
+ return '';
957
+ };
958
+ var plural = function plural() {
959
+ return '';
960
+ };
961
+ var selectOrdinal = function selectOrdinal() {
962
+ return '';
963
+ };
964
+
924
965
  exports.I18nContext = I18nContext;
925
966
  exports.I18nextProvider = I18nextProvider;
926
967
  exports.Trans = Trans;
927
968
  exports.Translation = Translation;
928
969
  exports.composeInitialProps = composeInitialProps;
970
+ exports.date = date;
929
971
  exports.getDefaults = getDefaults;
930
972
  exports.getI18n = getI18n;
931
973
  exports.getInitialProps = getInitialProps;
932
974
  exports.initReactI18next = initReactI18next;
975
+ exports.number = number;
976
+ exports.plural = plural;
977
+ exports.select = select;
978
+ exports.selectOrdinal = selectOrdinal;
933
979
  exports.setDefaults = setDefaults;
934
980
  exports.setI18n = setI18n;
981
+ exports.time = time;
935
982
  exports.useSSR = useSSR;
936
983
  exports.useTranslation = useTranslation;
937
984
  exports.withSSR = withSSR;
@@ -1 +1 @@
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 s(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 c(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,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(t.push(o.value),!n||t.length!==n);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.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(),s=[o,""];o.indexOf("=")>-1&&(s=o.split("=")),n.attrs[s[0]]=s[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 s=e.indexOf("<");r.push({type:"text",content:-1===s?e:e.substring(0,s)})}return e.replace(m,(function(s,c){if(o){if(s!=="</"+t.name+">")return;o=!1}var u,l="/"!==s.charAt(1),f=s.startsWith("\x3c!--"),p=c+s.length,m=e.charAt(p);if(f){var h=d(s);return a<0?(r.push(h),r):((u=i[a]).children.push(h),r)}if(l&&(a++,"tag"===(t=d(s)).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===s.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=s(s({},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(s(s({},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 c=a.transKeepBasicHtmlNodesFor||[],u=n&&new RegExp(c.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,s(s({},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,s(s({},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=s({},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,s(s({},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&&c.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,s(s({},O.props),{},{key:f}),v)):n.push(t.cloneElement(O,s(s({},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,c=r||a||x();if(c&&!c.reportNamespaces&&(c.reportNamespaces=new E),!c){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}c.options.react&&void 0!==c.options.react.wait&&C("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var p=s(s(s({},j()),c.options.react),t),d=p.useSuspense,m=e||o||c.options&&c.options.defaultNS;m="string"==typeof m?[m]:m||["translation"],c.reportNamespaces.addUsedNamespaces&&c.reportNamespaces.addUsedNamespaces(m);var g=(c.isInitialized||c.initializedStoreOnce)&&m.every((function(e){return T(e,c,p)}));function h(){return c.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(c,m,(function(){S.current&&w(h)})),e&&c&&c.on(e,t),n&&c&&c.store.on(n,t),function(){S.current=!1,e&&c&&e.split(" ").forEach((function(e){return c.off(e,t)})),n&&c&&n.split(" ").forEach((function(e){return c.store.off(e,t)}))}}),[c,m.join()]);var N=n.useRef(!0);n.useEffect((function(){S.current&&!N.current&&w(h),N.current=!1}),[c]);var I=[b,c,g];if(I.t=b,I.i18n=c,I.ready=g,g)return I;if(!g&&!d)return I;throw new Promise((function(e){A(c,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,s=i||o||x();s.options&&s.options.isClone||(e&&!s.initializedStoreOnce&&(s.services.resourceStore.data=e,s.options.ns=Object.values(e).reduce((function(e,n){return Object.keys(n).forEach((function(n){e.indexOf(n)<0&&e.push(n)})),e}),s.options.ns),s.initializedStoreOnce=!0,s.isInitialized=!0),t&&!s.initializedLanguageOnce&&(s.changeLanguage(t),s.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=c(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=s(s({},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),s=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=s.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=c(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:s(s({},f.interpolation),{},{prefix:"#$?",suffix:"?$#"})},L=s(s(s(s({},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,c(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.getDefaults=j,e.getI18n=x,e.getInitialProps=k,e.initReactI18next=N,e.setDefaults=w,e.setI18n=S,e.useSSR=K,e.useTranslation=V,e.withSSR=function(){return function(e){function n(n){var r=n.initialI18nStore,i=n.initialLanguage,a=c(n,["initialI18nStore","initialLanguage"]);return K(r,i),t.createElement(e,s({},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=c(i,["forwardedRef"]),l=u(V(e,o),3),f=l[0],p=l[1],d=l[2],m=s(s({},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})}));
1
+ define(["exports","react"],(function(e,n){"use strict";var t="default"in n?n.default:n;function r(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 i(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?r(Object(t),!0).forEach((function(n){c(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function a(e){return(a="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 o(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 c(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,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){var t=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==t)return;var r,i,a=[],o=!0,c=!1;try{for(t=t.call(e);!(o=(r=t.next()).done)&&(a.push(r.value),!n||a.length!==n);o=!0);}catch(e){c=!0,i=e}finally{try{o||null==t.return||t.return()}finally{if(c)throw i}}return a}(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 v,y=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 v=e.indexOf("<",p),y=e.slice(p,-1===v?void 0:v);h.test(y)&&(y=" "),(v>-1&&a+u.length>=0||" "!==y)&&u.push({type:"text",content:y})}})),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=i(i({},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)}}])&&o(n.prototype,t),r&&o(n,r),e}();function E(e){v=e}function S(){return v}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(i(i({},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")}var L=["format"],D=["children","count","parent","i18nKey","tOptions","values","defaults","components","ns","i18n","t"];function B(e,n){if(!e)return!1;var t=e.props?e.props.children:e.children;return n?t.length>0:!!t}function U(e){return e?e&&e.children?e.children:e.props&&e.props.children:[]}function V(e){return Array.isArray(e)?e:[e]}function K(e,n,r,o,c){if(""===n)return[];var s=o.transKeepBasicHtmlNodesFor||[],u=n&&new RegExp(s.join("|")).test(n);if(!e&&!u)return[n];var l={};!function e(n){V(n).forEach((function(n){"string"!=typeof n&&(B(n)?e(U(n)):"object"!==a(n)||t.isValidElement(n)||Object.assign(l,n))}))}(e);var f=r.services.interpolator.interpolate(n,i(i({},l),c),r.language),p=y("<0>".concat(f,"</0>"));function d(e,n,r){var i=U(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,a,o){e.dummy&&(e.children=n),r.push(t.cloneElement(e,i(i({},e.props),{},{key:a}),o?void 0:n))}function h(n,r,c){var l=V(n);return V(r).reduce((function(n,r,f){var p,g,v,y=r.children&&r.children[0]&&r.children[0].content;if("tag"===r.type){var b=l[parseInt(r.name,10)];!b&&1===c.length&&c[0][r.name]&&(b=c[0][r.name]),b||(b={});var O=0!==Object.keys(r.attrs).length?(p={props:r.attrs},(v=i({},g=b)).props=Object.assign(p.props,g.props),v):b,w=t.isValidElement(O),j=w&&B(r,!0)&&!r.voidElement,x=u&&"object"===a(O)&&O.dummy&&!w,E="object"===a(e)&&null!==e&&Object.hasOwnProperty.call(e,r.name);if("string"==typeof O)n.push(O);else if(B(O)||j){m(O,d(O,r,c),n,f)}else if(x){var S=h(l,r.children,c);n.push(t.cloneElement(O,i(i({},O.props),{},{key:f}),S))}else if(Number.isNaN(parseFloat(r.name))){if(E)m(O,d(O,r,c),n,f,r.voidElement);else if(o.transSupportBasicHtmlNodes&&s.indexOf(r.name)>-1)if(r.voidElement)n.push(t.createElement(r.name,{key:"".concat(r.name,"-").concat(f)}));else{var N=h(l,r.children,c);n.push(t.createElement(r.name,{key:"".concat(r.name,"-").concat(f)},N))}else if(r.voidElement)n.push("<".concat(r.name," />"));else{var I=h(l,r.children,c);n.push("<".concat(r.name,">").concat(I,"</").concat(r.name,">"))}}else if("object"!==a(O)||w)1===r.children.length&&y?n.push(t.cloneElement(O,i(i({},O.props),{},{key:f}),y)):n.push(t.cloneElement(O,i(i({},O.props),{},{key:f})));else{var k=r.children[0]?y:null;k&&n.push(k)}}else if("text"===r.type){var P=o.transWrapTextNodes;P?n.push(t.createElement(P,{key:"".concat(r.name,"-").concat(f)},r.content)):n.push(r.content)}return n}),[])}return U(h([{dummy:!0,children:e}],p,V(e||[]))[0])}function W(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.i18n,a=n.useContext(O)||{},o=a.i18n,c=a.defaultNS,s=r||o||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=i(i(i({},j()),s.options.react),t),d=p.useSuspense,m=e||c||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 v=n.useState(g),y=u(v,2),b=y[0],w=y[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()}))}))}var F=["forwardedRef"];var H=["ns","children"];function M(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))}var $=["initialI18nStore","initialLanguage"];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 r=e.children,o=e.count,c=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,v=e.t,y=s(e,D),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"),r;var N=v||E.t.bind(E)||function(e){return e},I=i(i({},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,r){if(!n)return"";var i="",o=V(n),c=r.transKeepBasicHtmlNodesFor||[];return o.forEach((function(n,o){if("string"==typeof n)i+="".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)i+="<".concat(n.type,"/>");else if(f||l&&0===u)if(n.props.i18nIsDynamicList)i+="<".concat(o,"></").concat(o,">");else if(l&&1===u&&"string"==typeof f)i+="<".concat(n.type,">").concat(f,"</").concat(n.type,">");else{var p=e(f,r);i+="<".concat(o,">").concat(p,"</").concat(o,">")}else i+="<".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"===a(n)){var d=n.format,m=s(n,L),h=Object.keys(m);if(1===h.length){var g=d?"".concat(h[0],", ").concat(d):h[0];i+="{{".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)})),i}(r,I)||I.transEmptyNodeValue||u,A=I.hashTransKey,T=u||(A?A(R):R),z=p?f.interpolation:{interpolation:i(i({},f.interpolation),{},{prefix:"#$?",suffix:"?$#"})},B=i(i(i(i({},f),{},{count:o},p),z),{},{defaultValue:R,ns:k}),U=K(m||r,T?N(T,B):R,E,I,B),W=void 0!==c?c:I.defaultTransParent;return W?t.createElement(W,y,U):U},e.Translation=function(e){var n=e.ns,t=e.children,r=u(W(n,s(e,H)),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=M,e.useTranslation=W,e.withSSR=function(){return function(e){function n(n){var r=n.initialI18nStore,a=n.initialLanguage,o=s(n,$);return M(r,a),t.createElement(e,i({},o))}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 a(a){var o=a.forwardedRef,c=s(a,F),l=u(W(e,c),3),f=l[0],p=l[1],d=l[2],m=i(i({},c),{},{t:f,i18n:p,tReady:d});return n.withRef&&o?m.ref=o:!n.withRef&&o&&(m.forwardedRef=o),t.createElement(r,m)}a.displayName="withI18nextTranslation(".concat(z(r),")"),a.WrappedComponent=r;return n.withRef?t.forwardRef((function(e,n){return t.createElement(a,Object.assign({},e,{forwardedRef:n}))})):a}},Object.defineProperty(e,"__esModule",{value:!0})}));
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
4
 
5
+ var _typeof3 = require("@babel/runtime/helpers/typeof");
6
+
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
@@ -24,7 +24,14 @@ var _context = require("./context");
24
24
 
25
25
  var _utils = require("./utils");
26
26
 
27
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
27
+ var _excluded = ["format"],
28
+ _excluded2 = ["children", "count", "parent", "i18nKey", "tOptions", "values", "defaults", "components", "ns", "i18n", "t"];
29
+
30
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
+
32
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
+
34
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
28
35
 
29
36
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
30
37
 
@@ -87,7 +94,7 @@ function nodesToString(children, i18nOptions) {
87
94
  (0, _utils.warn)("Trans: the passed in value is invalid - seems you passed in a null child.");
88
95
  } else if ((0, _typeof2["default"])(child) === 'object') {
89
96
  var format = child.format,
90
- clone = (0, _objectWithoutProperties2["default"])(child, ["format"]);
97
+ clone = (0, _objectWithoutProperties2["default"])(child, _excluded);
91
98
  var keys = Object.keys(clone);
92
99
 
93
100
  if (keys.length === 1) {
@@ -204,7 +211,15 @@ function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts) {
204
211
  })));
205
212
  }
206
213
  } else if (node.type === 'text') {
207
- mem.push(node.content);
214
+ var wrapTextNodes = i18nOptions.transWrapTextNodes;
215
+
216
+ if (wrapTextNodes) {
217
+ mem.push(_react["default"].createElement(wrapTextNodes, {
218
+ key: "".concat(node.name, "-").concat(i)
219
+ }, node.content));
220
+ } else {
221
+ mem.push(node.content);
222
+ }
208
223
  }
209
224
 
210
225
  return mem;
@@ -231,7 +246,7 @@ function Trans(_ref) {
231
246
  ns = _ref.ns,
232
247
  i18nFromProps = _ref.i18n,
233
248
  tFromProps = _ref.t,
234
- additionalProps = (0, _objectWithoutProperties2["default"])(_ref, ["children", "count", "parent", "i18nKey", "tOptions", "values", "defaults", "components", "ns", "i18n", "t"]);
249
+ additionalProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded2);
235
250
 
236
251
  var _ref2 = (0, _react.useContext)(_context.I18nContext) || {},
237
252
  i18nFromContext = _ref2.i18n,
@@ -13,10 +13,12 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
13
13
 
14
14
  var _useTranslation3 = require("./useTranslation");
15
15
 
16
+ var _excluded = ["ns", "children"];
17
+
16
18
  function Translation(props) {
17
19
  var ns = props.ns,
18
20
  children = props.children,
19
- options = (0, _objectWithoutProperties2["default"])(props, ["ns", "children"]);
21
+ options = (0, _objectWithoutProperties2["default"])(props, _excluded);
20
22
 
21
23
  var _useTranslation = (0, _useTranslation3.useTranslation)(ns, options),
22
24
  _useTranslation2 = (0, _slicedToArray2["default"])(_useTranslation, 3),
@@ -21,7 +21,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
21
21
 
22
22
  var _react = _interopRequireDefault(require("react"));
23
23
 
24
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
24
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
25
25
 
26
26
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
27
27
 
@@ -30,6 +30,7 @@ var defaultOptions = {
30
30
  bindI18nStore: '',
31
31
  transEmptyNodeValue: '',
32
32
  transSupportBasicHtmlNodes: true,
33
+ transWrapTextNodes: '',
33
34
  transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'],
34
35
  useSuspense: true
35
36
  };
@@ -93,6 +93,7 @@ Object.defineProperty(exports, "getInitialProps", {
93
93
  return _context.getInitialProps;
94
94
  }
95
95
  });
96
+ exports.selectOrdinal = exports.plural = exports.select = exports.number = exports.time = exports.date = void 0;
96
97
 
97
98
  var _Trans = require("./Trans");
98
99
 
@@ -108,4 +109,40 @@ var _withSSR = require("./withSSR");
108
109
 
109
110
  var _useSSR = require("./useSSR");
110
111
 
111
- var _context = require("./context");
112
+ var _context = require("./context");
113
+
114
+ var date = function date() {
115
+ return '';
116
+ };
117
+
118
+ exports.date = date;
119
+
120
+ var time = function time() {
121
+ return '';
122
+ };
123
+
124
+ exports.time = time;
125
+
126
+ var number = function number() {
127
+ return '';
128
+ };
129
+
130
+ exports.number = number;
131
+
132
+ var select = function select() {
133
+ return '';
134
+ };
135
+
136
+ exports.select = select;
137
+
138
+ var plural = function plural() {
139
+ return '';
140
+ };
141
+
142
+ exports.plural = plural;
143
+
144
+ var selectOrdinal = function selectOrdinal() {
145
+ return '';
146
+ };
147
+
148
+ exports.selectOrdinal = selectOrdinal;
@@ -17,7 +17,7 @@ var _context = require("./context");
17
17
 
18
18
  var _utils = require("./utils");
19
19
 
20
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
20
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
21
21
 
22
22
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
23
23
 
@@ -19,7 +19,9 @@ var _context = require("./context");
19
19
 
20
20
  var _utils = require("./utils");
21
21
 
22
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
22
+ var _excluded = ["initialI18nStore", "initialLanguage"];
23
+
24
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
23
25
 
24
26
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
25
27
 
@@ -28,7 +30,7 @@ function withSSR() {
28
30
  function I18nextWithSSR(_ref) {
29
31
  var initialI18nStore = _ref.initialI18nStore,
30
32
  initialLanguage = _ref.initialLanguage,
31
- rest = (0, _objectWithoutProperties2["default"])(_ref, ["initialI18nStore", "initialLanguage"]);
33
+ rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
32
34
  (0, _useSSR.useSSR)(initialI18nStore, initialLanguage);
33
35
  return _react["default"].createElement(WrappedComponent, _objectSpread({}, rest));
34
36
  }
@@ -19,7 +19,9 @@ var _useTranslation3 = require("./useTranslation");
19
19
 
20
20
  var _utils = require("./utils");
21
21
 
22
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
22
+ var _excluded = ["forwardedRef"];
23
+
24
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
23
25
 
24
26
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
25
27
 
@@ -28,7 +30,7 @@ function withTranslation(ns) {
28
30
  return function Extend(WrappedComponent) {
29
31
  function I18nextWithTranslation(_ref) {
30
32
  var forwardedRef = _ref.forwardedRef,
31
- rest = (0, _objectWithoutProperties2["default"])(_ref, ["forwardedRef"]);
33
+ rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
32
34
 
33
35
  var _useTranslation = (0, _useTranslation3.useTranslation)(ns, rest),
34
36
  _useTranslation2 = (0, _slicedToArray2["default"])(_useTranslation, 3),