react-i18next 12.1.0 → 12.1.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 +4 -0
- package/dist/commonjs/I18nextProvider.js +1 -1
- package/dist/commonjs/Trans.js +2 -2
- package/dist/commonjs/TransWithoutContext.js +3 -3
- package/dist/commonjs/Translation.js +1 -1
- package/dist/commonjs/context.js +3 -3
- package/dist/commonjs/defaults.js +1 -1
- package/dist/commonjs/index.js +9 -9
- package/dist/commonjs/initReactI18next.js +2 -2
- package/dist/commonjs/useSSR.js +1 -1
- package/dist/commonjs/useTranslation.js +2 -2
- package/dist/commonjs/withSSR.js +3 -3
- package/dist/commonjs/withTranslation.js +2 -2
- package/dist/es/I18nextProvider.js +1 -1
- package/dist/es/Trans.js +2 -2
- package/dist/es/TransWithoutContext.js +3 -3
- package/dist/es/Translation.js +1 -1
- package/dist/es/context.js +3 -3
- package/dist/es/defaults.js +1 -1
- package/dist/es/index.js +9 -9
- package/dist/es/initReactI18next.js +2 -2
- package/dist/es/package.json +1 -0
- package/dist/es/useSSR.js +1 -1
- package/dist/es/useTranslation.js +2 -2
- package/dist/es/withSSR.js +3 -3
- package/dist/es/withTranslation.js +2 -2
- package/package.json +4 -3
- package/src/I18nextProvider.js +1 -1
- package/src/Trans.js +2 -2
- package/src/TransWithoutContext.js +3 -3
- package/src/Translation.js +1 -1
- package/src/context.js +3 -3
- package/src/defaults.js +1 -1
- package/src/index.js +9 -9
- package/src/initReactI18next.js +2 -2
- package/src/useSSR.js +2 -2
- package/src/useTranslation.js +2 -2
- package/src/withSSR.js +3 -3
- package/src/withTranslation.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
### 12.1.1
|
|
2
|
+
|
|
3
|
+
- fix for node resolution [1589](https://github.com/i18next/react-i18next/issues/1589)
|
|
4
|
+
|
|
1
5
|
### 12.1.0
|
|
2
6
|
|
|
3
7
|
- context-less version of Trans component to be used for environments without react context [1588](https://github.com/i18next/react-i18next/pull/1588)
|
package/dist/commonjs/Trans.js
CHANGED
|
@@ -19,9 +19,9 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
19
19
|
|
|
20
20
|
var _react = require("react");
|
|
21
21
|
|
|
22
|
-
var _TransWithoutContext = require("./TransWithoutContext");
|
|
22
|
+
var _TransWithoutContext = require("./TransWithoutContext.js");
|
|
23
23
|
|
|
24
|
-
var _context = require("./context");
|
|
24
|
+
var _context = require("./context.js");
|
|
25
25
|
|
|
26
26
|
var _excluded = ["children", "count", "parent", "i18nKey", "context", "tOptions", "values", "defaults", "components", "ns", "i18n", "t", "shouldUnescape"];
|
|
27
27
|
|
|
@@ -18,11 +18,11 @@ var _react = require("react");
|
|
|
18
18
|
|
|
19
19
|
var _htmlParseStringify = _interopRequireDefault(require("html-parse-stringify"));
|
|
20
20
|
|
|
21
|
-
var _utils = require("./utils");
|
|
21
|
+
var _utils = require("./utils.js");
|
|
22
22
|
|
|
23
|
-
var _defaults = require("./defaults");
|
|
23
|
+
var _defaults = require("./defaults.js");
|
|
24
24
|
|
|
25
|
-
var _i18nInstance = require("./i18nInstance");
|
|
25
|
+
var _i18nInstance = require("./i18nInstance.js");
|
|
26
26
|
|
|
27
27
|
var _excluded = ["format"],
|
|
28
28
|
_excluded2 = ["children", "count", "parent", "i18nKey", "context", "tOptions", "values", "defaults", "components", "ns", "i18n", "t", "shouldUnescape"];
|
|
@@ -11,7 +11,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
11
11
|
|
|
12
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
13
|
|
|
14
|
-
var _useTranslation3 = require("./useTranslation");
|
|
14
|
+
var _useTranslation3 = require("./useTranslation.js");
|
|
15
15
|
|
|
16
16
|
var _excluded = ["ns", "children"];
|
|
17
17
|
|
package/dist/commonjs/context.js
CHANGED
|
@@ -47,11 +47,11 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
47
47
|
|
|
48
48
|
var _react = require("react");
|
|
49
49
|
|
|
50
|
-
var _defaults = require("./defaults");
|
|
50
|
+
var _defaults = require("./defaults.js");
|
|
51
51
|
|
|
52
|
-
var _i18nInstance = require("./i18nInstance");
|
|
52
|
+
var _i18nInstance = require("./i18nInstance.js");
|
|
53
53
|
|
|
54
|
-
var _initReactI18next = require("./initReactI18next");
|
|
54
|
+
var _initReactI18next = require("./initReactI18next.js");
|
|
55
55
|
|
|
56
56
|
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; }
|
|
57
57
|
|
|
@@ -10,7 +10,7 @@ exports.getDefaults = getDefaults;
|
|
|
10
10
|
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
|
|
13
|
-
var _unescape = require("./unescape");
|
|
13
|
+
var _unescape = require("./unescape.js");
|
|
14
14
|
|
|
15
15
|
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; }
|
|
16
16
|
|
package/dist/commonjs/index.js
CHANGED
|
@@ -101,23 +101,23 @@ Object.defineProperty(exports, "getInitialProps", {
|
|
|
101
101
|
});
|
|
102
102
|
exports.selectOrdinal = exports.plural = exports.select = exports.number = exports.time = exports.date = void 0;
|
|
103
103
|
|
|
104
|
-
var _Trans = require("./Trans");
|
|
104
|
+
var _Trans = require("./Trans.js");
|
|
105
105
|
|
|
106
|
-
var _TransWithoutContext = require("./TransWithoutContext");
|
|
106
|
+
var _TransWithoutContext = require("./TransWithoutContext.js");
|
|
107
107
|
|
|
108
|
-
var _useTranslation = require("./useTranslation");
|
|
108
|
+
var _useTranslation = require("./useTranslation.js");
|
|
109
109
|
|
|
110
|
-
var _withTranslation = require("./withTranslation");
|
|
110
|
+
var _withTranslation = require("./withTranslation.js");
|
|
111
111
|
|
|
112
|
-
var _Translation = require("./Translation");
|
|
112
|
+
var _Translation = require("./Translation.js");
|
|
113
113
|
|
|
114
|
-
var _I18nextProvider = require("./I18nextProvider");
|
|
114
|
+
var _I18nextProvider = require("./I18nextProvider.js");
|
|
115
115
|
|
|
116
|
-
var _withSSR = require("./withSSR");
|
|
116
|
+
var _withSSR = require("./withSSR.js");
|
|
117
117
|
|
|
118
|
-
var _useSSR = require("./useSSR");
|
|
118
|
+
var _useSSR = require("./useSSR.js");
|
|
119
119
|
|
|
120
|
-
var _context = require("./context");
|
|
120
|
+
var _context = require("./context.js");
|
|
121
121
|
|
|
122
122
|
var date = function date() {
|
|
123
123
|
return '';
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.initReactI18next = void 0;
|
|
7
7
|
|
|
8
|
-
var _defaults = require("./defaults");
|
|
8
|
+
var _defaults = require("./defaults.js");
|
|
9
9
|
|
|
10
|
-
var _i18nInstance = require("./i18nInstance");
|
|
10
|
+
var _i18nInstance = require("./i18nInstance.js");
|
|
11
11
|
|
|
12
12
|
var initReactI18next = {
|
|
13
13
|
type: '3rdParty',
|
package/dist/commonjs/useSSR.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.useSSR = useSSR;
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
-
var _context = require("./context");
|
|
10
|
+
var _context = require("./context.js");
|
|
11
11
|
|
|
12
12
|
function useSSR(initialI18nStore, initialLanguage) {
|
|
13
13
|
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
@@ -13,9 +13,9 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
13
13
|
|
|
14
14
|
var _react = require("react");
|
|
15
15
|
|
|
16
|
-
var _context = require("./context");
|
|
16
|
+
var _context = require("./context.js");
|
|
17
17
|
|
|
18
|
-
var _utils = require("./utils");
|
|
18
|
+
var _utils = require("./utils.js");
|
|
19
19
|
|
|
20
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
|
|
package/dist/commonjs/withSSR.js
CHANGED
|
@@ -13,11 +13,11 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
13
13
|
|
|
14
14
|
var _react = require("react");
|
|
15
15
|
|
|
16
|
-
var _useSSR = require("./useSSR");
|
|
16
|
+
var _useSSR = require("./useSSR.js");
|
|
17
17
|
|
|
18
|
-
var _context = require("./context");
|
|
18
|
+
var _context = require("./context.js");
|
|
19
19
|
|
|
20
|
-
var _utils = require("./utils");
|
|
20
|
+
var _utils = require("./utils.js");
|
|
21
21
|
|
|
22
22
|
var _excluded = ["initialI18nStore", "initialLanguage"];
|
|
23
23
|
|
|
@@ -15,9 +15,9 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
15
15
|
|
|
16
16
|
var _react = require("react");
|
|
17
17
|
|
|
18
|
-
var _useTranslation3 = require("./useTranslation");
|
|
18
|
+
var _useTranslation3 = require("./useTranslation.js");
|
|
19
19
|
|
|
20
|
-
var _utils = require("./utils");
|
|
20
|
+
var _utils = require("./utils.js");
|
|
21
21
|
|
|
22
22
|
var _excluded = ["forwardedRef"];
|
|
23
23
|
|
package/dist/es/Trans.js
CHANGED
|
@@ -7,8 +7,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
7
7
|
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) { _defineProperty(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; }
|
|
8
8
|
|
|
9
9
|
import { useContext } from 'react';
|
|
10
|
-
import { nodesToString, Trans as TransWithoutContext } from './TransWithoutContext';
|
|
11
|
-
import { getI18n, I18nContext } from './context';
|
|
10
|
+
import { nodesToString, Trans as TransWithoutContext } from './TransWithoutContext.js';
|
|
11
|
+
import { getI18n, I18nContext } from './context.js';
|
|
12
12
|
export { nodesToString };
|
|
13
13
|
export function Trans(_ref) {
|
|
14
14
|
var children = _ref.children,
|
|
@@ -10,9 +10,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
10
10
|
|
|
11
11
|
import { isValidElement, cloneElement, createElement } from 'react';
|
|
12
12
|
import HTML from 'html-parse-stringify';
|
|
13
|
-
import { warn, warnOnce } from './utils';
|
|
14
|
-
import { getDefaults } from './defaults';
|
|
15
|
-
import { getI18n } from './i18nInstance';
|
|
13
|
+
import { warn, warnOnce } from './utils.js';
|
|
14
|
+
import { getDefaults } from './defaults.js';
|
|
15
|
+
import { getI18n } from './i18nInstance.js';
|
|
16
16
|
|
|
17
17
|
function hasChildren(node, checkLength) {
|
|
18
18
|
if (!node) return false;
|
package/dist/es/Translation.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["ns", "children"];
|
|
4
|
-
import { useTranslation } from './useTranslation';
|
|
4
|
+
import { useTranslation } from './useTranslation.js';
|
|
5
5
|
export function Translation(props) {
|
|
6
6
|
var ns = props.ns,
|
|
7
7
|
children = props.children,
|
package/dist/es/context.js
CHANGED
|
@@ -7,9 +7,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
7
7
|
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) { _defineProperty(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; }
|
|
8
8
|
|
|
9
9
|
import { createContext } from 'react';
|
|
10
|
-
import { getDefaults, setDefaults } from './defaults';
|
|
11
|
-
import { getI18n, setI18n } from './i18nInstance';
|
|
12
|
-
import { initReactI18next } from './initReactI18next';
|
|
10
|
+
import { getDefaults, setDefaults } from './defaults.js';
|
|
11
|
+
import { getI18n, setI18n } from './i18nInstance.js';
|
|
12
|
+
import { initReactI18next } from './initReactI18next.js';
|
|
13
13
|
export { getDefaults, setDefaults, getI18n, setI18n, initReactI18next };
|
|
14
14
|
export var I18nContext = createContext();
|
|
15
15
|
export var ReportNamespaces = function () {
|
package/dist/es/defaults.js
CHANGED
|
@@ -4,7 +4,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
4
4
|
|
|
5
5
|
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) { _defineProperty(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; }
|
|
6
6
|
|
|
7
|
-
import { unescape } from './unescape';
|
|
7
|
+
import { unescape } from './unescape.js';
|
|
8
8
|
var defaultOptions = {
|
|
9
9
|
bindI18n: 'languageChanged',
|
|
10
10
|
bindI18nStore: '',
|
package/dist/es/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { Trans } from './Trans';
|
|
2
|
-
export { Trans as TransWithoutContext } from './TransWithoutContext';
|
|
3
|
-
export { useTranslation } from './useTranslation';
|
|
4
|
-
export { withTranslation } from './withTranslation';
|
|
5
|
-
export { Translation } from './Translation';
|
|
6
|
-
export { I18nextProvider } from './I18nextProvider';
|
|
7
|
-
export { withSSR } from './withSSR';
|
|
8
|
-
export { useSSR } from './useSSR';
|
|
9
|
-
export { I18nContext, initReactI18next, setDefaults, getDefaults, setI18n, getI18n, composeInitialProps, getInitialProps } from './context';
|
|
1
|
+
export { Trans } from './Trans.js';
|
|
2
|
+
export { Trans as TransWithoutContext } from './TransWithoutContext.js';
|
|
3
|
+
export { useTranslation } from './useTranslation.js';
|
|
4
|
+
export { withTranslation } from './withTranslation.js';
|
|
5
|
+
export { Translation } from './Translation.js';
|
|
6
|
+
export { I18nextProvider } from './I18nextProvider.js';
|
|
7
|
+
export { withSSR } from './withSSR.js';
|
|
8
|
+
export { useSSR } from './useSSR.js';
|
|
9
|
+
export { I18nContext, initReactI18next, setDefaults, getDefaults, setI18n, getI18n, composeInitialProps, getInitialProps } from './context.js';
|
|
10
10
|
export var date = function date() {
|
|
11
11
|
return '';
|
|
12
12
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module","version":"12.1.1"}
|
package/dist/es/useSSR.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { getI18n, I18nContext } from './context';
|
|
2
|
+
import { getI18n, I18nContext } from './context.js';
|
|
3
3
|
export function useSSR(initialI18nStore, initialLanguage) {
|
|
4
4
|
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
5
5
|
var i18nFromProps = props.i18n;
|
|
@@ -6,8 +6,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
6
6
|
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) { _defineProperty(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; }
|
|
7
7
|
|
|
8
8
|
import { useState, useEffect, useContext, useRef } from 'react';
|
|
9
|
-
import { getI18n, getDefaults, ReportNamespaces, I18nContext } from './context';
|
|
10
|
-
import { warnOnce, loadNamespaces, hasLoadedNamespace } from './utils';
|
|
9
|
+
import { getI18n, getDefaults, ReportNamespaces, I18nContext } from './context.js';
|
|
10
|
+
import { warnOnce, loadNamespaces, hasLoadedNamespace } from './utils.js';
|
|
11
11
|
|
|
12
12
|
var usePrevious = function usePrevious(value, ignore) {
|
|
13
13
|
var ref = useRef();
|
package/dist/es/withSSR.js
CHANGED
|
@@ -7,9 +7,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
7
7
|
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) { _defineProperty(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; }
|
|
8
8
|
|
|
9
9
|
import { createElement } from 'react';
|
|
10
|
-
import { useSSR } from './useSSR';
|
|
11
|
-
import { composeInitialProps } from './context';
|
|
12
|
-
import { getDisplayName } from './utils';
|
|
10
|
+
import { useSSR } from './useSSR.js';
|
|
11
|
+
import { composeInitialProps } from './context.js';
|
|
12
|
+
import { getDisplayName } from './utils.js';
|
|
13
13
|
export function withSSR() {
|
|
14
14
|
return function Extend(WrappedComponent) {
|
|
15
15
|
function I18nextWithSSR(_ref) {
|
|
@@ -8,8 +8,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
8
8
|
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) { _defineProperty(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; }
|
|
9
9
|
|
|
10
10
|
import { createElement, forwardRef as forwardRefReact } from 'react';
|
|
11
|
-
import { useTranslation } from './useTranslation';
|
|
12
|
-
import { getDisplayName } from './utils';
|
|
11
|
+
import { useTranslation } from './useTranslation.js';
|
|
12
|
+
import { getDisplayName } from './utils.js';
|
|
13
13
|
export function withTranslation(ns) {
|
|
14
14
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
15
15
|
return function Extend(WrappedComponent) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-i18next",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.1",
|
|
4
4
|
"description": "Internationalization for react done right. Using the i18next i18n ecosystem.",
|
|
5
5
|
"main": "dist/commonjs/index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -113,15 +113,16 @@
|
|
|
113
113
|
},
|
|
114
114
|
"scripts": {
|
|
115
115
|
"clean": "rimraf dist && mkdirp dist",
|
|
116
|
-
"copy": "cp-cli ./dist/umd/react-i18next.min.js ./react-i18next.min.js && cp-cli ./dist/umd/react-i18next.js ./react-i18next.js",
|
|
116
|
+
"copy": "cp-cli ./dist/umd/react-i18next.min.js ./react-i18next.min.js && cp-cli ./dist/umd/react-i18next.js ./react-i18next.js && echo '{\"type\":\"module\"}' > dist/es/package.json",
|
|
117
117
|
"build:es": "cross-env BABEL_ENV=jsnext babel src --out-dir dist/es",
|
|
118
118
|
"build:cjs": "babel src --out-dir dist/commonjs",
|
|
119
119
|
"build:umd": "rollup -c rollup.config.js --format umd && rollup -c rollup.config.js --format umd --uglify",
|
|
120
120
|
"build:amd": "rollup -c rollup.config.js --format amd && rollup -c rollup.config.js --format amd --uglify",
|
|
121
121
|
"build:iife": "rollup -c rollup.config.js --format iife && rollup -c rollup.config.js --format iife --uglify",
|
|
122
122
|
"build": "npm run clean && npm run build:cjs && npm run build:es && npm run build:umd && npm run build:amd && npm run copy",
|
|
123
|
+
"fix_dist_package": "node -e 'console.log(`{\"type\":\"module\",\"version\":\"${process.env.npm_package_version}\"}`)' > dist/es/package.json",
|
|
123
124
|
"preversion": "npm run build && git push",
|
|
124
|
-
"postversion": "git push && git push --tags",
|
|
125
|
+
"postversion": "npm run fix_dist_package && git push && git push --tags",
|
|
125
126
|
"pretest": "npm run test:typescript && npm run test:typescript:noninterop && npm run test:typescript:customtypes",
|
|
126
127
|
"test": "cross-env BABEL_ENV=development jest --no-cache",
|
|
127
128
|
"test:watch": "cross-env BABEL_ENV=development jest --no-cache --watch",
|
package/src/I18nextProvider.js
CHANGED
package/src/Trans.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { nodesToString, Trans as TransWithoutContext } from './TransWithoutContext';
|
|
3
|
-
import { getI18n, I18nContext } from './context';
|
|
2
|
+
import { nodesToString, Trans as TransWithoutContext } from './TransWithoutContext.js';
|
|
3
|
+
import { getI18n, I18nContext } from './context.js';
|
|
4
4
|
|
|
5
5
|
export { nodesToString };
|
|
6
6
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isValidElement, cloneElement, createElement } from 'react';
|
|
2
2
|
import HTML from 'html-parse-stringify';
|
|
3
|
-
import { warn, warnOnce } from './utils';
|
|
4
|
-
import { getDefaults } from './defaults';
|
|
5
|
-
import { getI18n } from './i18nInstance';
|
|
3
|
+
import { warn, warnOnce } from './utils.js';
|
|
4
|
+
import { getDefaults } from './defaults.js';
|
|
5
|
+
import { getI18n } from './i18nInstance.js';
|
|
6
6
|
|
|
7
7
|
function hasChildren(node, checkLength) {
|
|
8
8
|
if (!node) return false;
|
package/src/Translation.js
CHANGED
package/src/context.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
|
-
import { getDefaults, setDefaults } from './defaults';
|
|
3
|
-
import { getI18n, setI18n } from './i18nInstance';
|
|
4
|
-
import { initReactI18next } from './initReactI18next';
|
|
2
|
+
import { getDefaults, setDefaults } from './defaults.js';
|
|
3
|
+
import { getI18n, setI18n } from './i18nInstance.js';
|
|
4
|
+
import { initReactI18next } from './initReactI18next.js';
|
|
5
5
|
|
|
6
6
|
export { getDefaults, setDefaults, getI18n, setI18n, initReactI18next };
|
|
7
7
|
|
package/src/defaults.js
CHANGED
package/src/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { Trans } from './Trans';
|
|
2
|
-
export { Trans as TransWithoutContext } from './TransWithoutContext';
|
|
3
|
-
export { useTranslation } from './useTranslation';
|
|
4
|
-
export { withTranslation } from './withTranslation';
|
|
5
|
-
export { Translation } from './Translation';
|
|
6
|
-
export { I18nextProvider } from './I18nextProvider';
|
|
7
|
-
export { withSSR } from './withSSR';
|
|
8
|
-
export { useSSR } from './useSSR';
|
|
1
|
+
export { Trans } from './Trans.js';
|
|
2
|
+
export { Trans as TransWithoutContext } from './TransWithoutContext.js';
|
|
3
|
+
export { useTranslation } from './useTranslation.js';
|
|
4
|
+
export { withTranslation } from './withTranslation.js';
|
|
5
|
+
export { Translation } from './Translation.js';
|
|
6
|
+
export { I18nextProvider } from './I18nextProvider.js';
|
|
7
|
+
export { withSSR } from './withSSR.js';
|
|
8
|
+
export { useSSR } from './useSSR.js';
|
|
9
9
|
|
|
10
10
|
export {
|
|
11
11
|
I18nContext,
|
|
@@ -16,7 +16,7 @@ export {
|
|
|
16
16
|
getI18n,
|
|
17
17
|
composeInitialProps,
|
|
18
18
|
getInitialProps,
|
|
19
|
-
} from './context';
|
|
19
|
+
} from './context.js';
|
|
20
20
|
|
|
21
21
|
// dummy functions for icu.macro support
|
|
22
22
|
|
package/src/initReactI18next.js
CHANGED
package/src/useSSR.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { getI18n, I18nContext } from './context';
|
|
2
|
+
import { getI18n, I18nContext } from './context.js';
|
|
3
3
|
|
|
4
4
|
export function useSSR(initialI18nStore, initialLanguage, props = {}) {
|
|
5
5
|
const { i18n: i18nFromProps } = props;
|
|
@@ -16,7 +16,7 @@ export function useSSR(initialI18nStore, initialLanguage, props = {}) {
|
|
|
16
16
|
|
|
17
17
|
// add namespaces to the config - so a languageChange call loads all namespaces needed
|
|
18
18
|
i18n.options.ns = Object.values(initialI18nStore).reduce((mem, lngResources) => {
|
|
19
|
-
Object.keys(lngResources).forEach(ns => {
|
|
19
|
+
Object.keys(lngResources).forEach((ns) => {
|
|
20
20
|
if (mem.indexOf(ns) < 0) mem.push(ns);
|
|
21
21
|
});
|
|
22
22
|
return mem;
|
package/src/useTranslation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState, useEffect, useContext, useRef } from 'react';
|
|
2
|
-
import { getI18n, getDefaults, ReportNamespaces, I18nContext } from './context';
|
|
3
|
-
import { warnOnce, loadNamespaces, hasLoadedNamespace } from './utils';
|
|
2
|
+
import { getI18n, getDefaults, ReportNamespaces, I18nContext } from './context.js';
|
|
3
|
+
import { warnOnce, loadNamespaces, hasLoadedNamespace } from './utils.js';
|
|
4
4
|
|
|
5
5
|
const usePrevious = (value, ignore) => {
|
|
6
6
|
const ref = useRef();
|
package/src/withSSR.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createElement } from 'react';
|
|
2
|
-
import { useSSR } from './useSSR';
|
|
3
|
-
import { composeInitialProps } from './context';
|
|
4
|
-
import { getDisplayName } from './utils';
|
|
2
|
+
import { useSSR } from './useSSR.js';
|
|
3
|
+
import { composeInitialProps } from './context.js';
|
|
4
|
+
import { getDisplayName } from './utils.js';
|
|
5
5
|
|
|
6
6
|
export function withSSR() {
|
|
7
7
|
return function Extend(WrappedComponent) {
|
package/src/withTranslation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createElement, forwardRef as forwardRefReact } from 'react';
|
|
2
|
-
import { useTranslation } from './useTranslation';
|
|
3
|
-
import { getDisplayName } from './utils';
|
|
2
|
+
import { useTranslation } from './useTranslation.js';
|
|
3
|
+
import { getDisplayName } from './utils.js';
|
|
4
4
|
|
|
5
5
|
export function withTranslation(ns, options = {}) {
|
|
6
6
|
return function Extend(WrappedComponent) {
|