next-i18next 9.0.0 → 10.0.0
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/README.md +16 -0
- package/dist/commonjs/appWithTranslation.js +2 -2
- package/dist/commonjs/config/createConfig.js +2 -2
- package/dist/commonjs/config/defaultConfig.js +1 -8
- package/dist/commonjs/createClient/browser.js +2 -2
- package/dist/commonjs/createClient/node.js +2 -2
- package/dist/commonjs/serverSideTranslations.js +2 -2
- package/dist/es/config/defaultConfig.js +1 -6
- package/dist/esm/config/defaultConfig.js +1 -8
- package/dist/types/config/defaultConfig.d.ts +0 -5
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -260,6 +260,8 @@ To migrate from previous versions to the version 8, check out the [v8-migration
|
|
|
260
260
|
|
|
261
261
|
## Notes
|
|
262
262
|
|
|
263
|
+
### Docker
|
|
264
|
+
|
|
263
265
|
For Docker deployment, note that if you use the `Dockerfile` from [Next.js docs](https://nextjs.org/docs/deployment#docker-image) do not forget to copy `next.config.js` and `next-i18next.config.js` into the Docker image.
|
|
264
266
|
|
|
265
267
|
```
|
|
@@ -267,6 +269,20 @@ COPY --from=builder /app/next.config.js ./next.config.js
|
|
|
267
269
|
COPY --from=builder /app/next-i18next.config.js ./next-i18next.config.js
|
|
268
270
|
```
|
|
269
271
|
|
|
272
|
+
### Asynchronous i18next backends
|
|
273
|
+
|
|
274
|
+
If you choose to use an i18next backend different to the built-in [i18next-fs-backend](https://github.com/i18next/i18next-fs-backend), you will need to ensure the translation resources are loaded before you call the `t` function.
|
|
275
|
+
Since [React suspense is not yet supported for SSR](https://github.com/isaachinman/next-i18next/issues/1255), this can be solved in 2 different ways:
|
|
276
|
+
|
|
277
|
+
**1) Preload the namespaces:**
|
|
278
|
+
|
|
279
|
+
Set the `ns` option, like in [this example](https://github.com/locize/next-i18next-locize/blob/main/next-i18next.config.js#L17). Doing this will ensure all translation resources are loaded on initialization.
|
|
280
|
+
|
|
281
|
+
**2) Check the ready flag:**
|
|
282
|
+
|
|
283
|
+
If you cannot or do not want to provide the `ns` array, calls to the `t` function will cause namespaces to be loaded on the fly. This means you'll need to handle the "not ready" state by checking `ready === true` or `props.tReady === true`. Not doing so will result in rendering your translations before they loaded, which will cause "save missing" be called despite the translations actually existing (just yet not loaded).
|
|
284
|
+
This can be done with the [useTranslation hook](https://react.i18next.com/latest/usetranslation-hook#not-using-suspense) or the [withTranslation HOC](https://react.i18next.com/latest/withtranslation-hoc#not-using-suspense).
|
|
285
|
+
|
|
270
286
|
## Contributors
|
|
271
287
|
|
|
272
288
|
Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
|
|
@@ -6,6 +6,8 @@ require("core-js/modules/es.symbol.js");
|
|
|
6
6
|
|
|
7
7
|
require("core-js/modules/es.array.filter.js");
|
|
8
8
|
|
|
9
|
+
require("core-js/modules/es.object.to-string.js");
|
|
10
|
+
|
|
9
11
|
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
10
12
|
|
|
11
13
|
require("core-js/modules/es.array.for-each.js");
|
|
@@ -20,8 +22,6 @@ require("core-js/modules/es.object.define-property.js");
|
|
|
20
22
|
|
|
21
23
|
require("core-js/modules/es.array.iterator.js");
|
|
22
24
|
|
|
23
|
-
require("core-js/modules/es.object.to-string.js");
|
|
24
|
-
|
|
25
25
|
require("core-js/modules/es.string.iterator.js");
|
|
26
26
|
|
|
27
27
|
require("core-js/modules/es.weak-map.js");
|
|
@@ -33,6 +33,8 @@ exports.createConfig = void 0;
|
|
|
33
33
|
|
|
34
34
|
require("core-js/modules/es.array.some.js");
|
|
35
35
|
|
|
36
|
+
require("core-js/modules/es.object.to-string.js");
|
|
37
|
+
|
|
36
38
|
require("core-js/modules/es.regexp.exec.js");
|
|
37
39
|
|
|
38
40
|
require("core-js/modules/es.string.replace.js");
|
|
@@ -47,8 +49,6 @@ require("core-js/modules/es.string.iterator.js");
|
|
|
47
49
|
|
|
48
50
|
require("core-js/modules/es.array.iterator.js");
|
|
49
51
|
|
|
50
|
-
require("core-js/modules/es.object.to-string.js");
|
|
51
|
-
|
|
52
52
|
require("core-js/modules/es.set.js");
|
|
53
53
|
|
|
54
54
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
@@ -24,19 +24,12 @@ var defaultConfig = {
|
|
|
24
24
|
return process.browser && typeof window !== 'undefined';
|
|
25
25
|
},
|
|
26
26
|
|
|
27
|
-
interpolation: {
|
|
28
|
-
escapeValue: false,
|
|
29
|
-
format: function format(value, _format) {
|
|
30
|
-
return _format === 'uppercase' ? value.toUpperCase() : value;
|
|
31
|
-
},
|
|
32
|
-
formatSeparator: ','
|
|
33
|
-
},
|
|
34
27
|
load: 'currentOnly',
|
|
35
28
|
localeExtension: LOCALE_EXTENSION,
|
|
36
29
|
localePath: LOCALE_PATH,
|
|
37
30
|
localeStructure: LOCALE_STRUCTURE,
|
|
38
31
|
react: {
|
|
39
|
-
useSuspense:
|
|
32
|
+
useSuspense: false
|
|
40
33
|
},
|
|
41
34
|
reloadOnPrerender: false,
|
|
42
35
|
serializeConfig: true,
|
|
@@ -11,10 +11,10 @@ exports["default"] = void 0;
|
|
|
11
11
|
|
|
12
12
|
require("core-js/modules/es.array.for-each.js");
|
|
13
13
|
|
|
14
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
|
15
|
-
|
|
16
14
|
require("core-js/modules/es.object.to-string.js");
|
|
17
15
|
|
|
16
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
17
|
+
|
|
18
18
|
require("core-js/modules/es.promise.js");
|
|
19
19
|
|
|
20
20
|
var _i18next = _interopRequireDefault(require("i18next"));
|
|
@@ -23,12 +23,12 @@ exports["default"] = void 0;
|
|
|
23
23
|
|
|
24
24
|
require("core-js/modules/es.array.some.js");
|
|
25
25
|
|
|
26
|
+
require("core-js/modules/es.object.to-string.js");
|
|
27
|
+
|
|
26
28
|
require("core-js/modules/es.array.for-each.js");
|
|
27
29
|
|
|
28
30
|
require("core-js/modules/web.dom-collections.for-each.js");
|
|
29
31
|
|
|
30
|
-
require("core-js/modules/es.object.to-string.js");
|
|
31
|
-
|
|
32
32
|
require("core-js/modules/es.promise.js");
|
|
33
33
|
|
|
34
34
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -45,6 +45,8 @@ require("core-js/modules/es.array.is-array.js");
|
|
|
45
45
|
|
|
46
46
|
require("core-js/modules/es.array.reduce.js");
|
|
47
47
|
|
|
48
|
+
require("core-js/modules/es.object.to-string.js");
|
|
49
|
+
|
|
48
50
|
require("core-js/modules/es.object.values.js");
|
|
49
51
|
|
|
50
52
|
require("core-js/modules/es.array.concat.js");
|
|
@@ -55,8 +57,6 @@ require("core-js/modules/es.string.iterator.js");
|
|
|
55
57
|
|
|
56
58
|
require("core-js/modules/es.array.iterator.js");
|
|
57
59
|
|
|
58
|
-
require("core-js/modules/es.object.to-string.js");
|
|
59
|
-
|
|
60
60
|
require("core-js/modules/es.set.js");
|
|
61
61
|
|
|
62
62
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
@@ -16,17 +16,12 @@ export const defaultConfig = {
|
|
|
16
16
|
return process.browser && typeof window !== 'undefined';
|
|
17
17
|
},
|
|
18
18
|
|
|
19
|
-
interpolation: {
|
|
20
|
-
escapeValue: false,
|
|
21
|
-
format: (value, format) => format === 'uppercase' ? value.toUpperCase() : value,
|
|
22
|
-
formatSeparator: ','
|
|
23
|
-
},
|
|
24
19
|
load: 'currentOnly',
|
|
25
20
|
localeExtension: LOCALE_EXTENSION,
|
|
26
21
|
localePath: LOCALE_PATH,
|
|
27
22
|
localeStructure: LOCALE_STRUCTURE,
|
|
28
23
|
react: {
|
|
29
|
-
useSuspense:
|
|
24
|
+
useSuspense: false
|
|
30
25
|
},
|
|
31
26
|
reloadOnPrerender: false,
|
|
32
27
|
serializeConfig: true,
|
|
@@ -16,19 +16,12 @@ export var defaultConfig = {
|
|
|
16
16
|
return process.browser && typeof window !== 'undefined';
|
|
17
17
|
},
|
|
18
18
|
|
|
19
|
-
interpolation: {
|
|
20
|
-
escapeValue: false,
|
|
21
|
-
format: function format(value, _format) {
|
|
22
|
-
return _format === 'uppercase' ? value.toUpperCase() : value;
|
|
23
|
-
},
|
|
24
|
-
formatSeparator: ','
|
|
25
|
-
},
|
|
26
19
|
load: 'currentOnly',
|
|
27
20
|
localeExtension: LOCALE_EXTENSION,
|
|
28
21
|
localePath: LOCALE_PATH,
|
|
29
22
|
localeStructure: LOCALE_STRUCTURE,
|
|
30
23
|
react: {
|
|
31
|
-
useSuspense:
|
|
24
|
+
useSuspense: false
|
|
32
25
|
},
|
|
33
26
|
reloadOnPrerender: false,
|
|
34
27
|
serializeConfig: true,
|
|
@@ -6,11 +6,6 @@ export declare const defaultConfig: {
|
|
|
6
6
|
locales: string[];
|
|
7
7
|
};
|
|
8
8
|
readonly initImmediate: boolean;
|
|
9
|
-
interpolation: {
|
|
10
|
-
escapeValue: boolean;
|
|
11
|
-
format: (value: string, format: string) => string;
|
|
12
|
-
formatSeparator: string;
|
|
13
|
-
};
|
|
14
9
|
load: string;
|
|
15
10
|
localeExtension: string;
|
|
16
11
|
localePath: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-i18next",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"repository": "git@github.com:isaachinman/next-i18next.git",
|
|
5
5
|
"author": "Isaac Hinman <isaac@isaachinman.com>",
|
|
6
6
|
"funding": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"run-example": "yarn build && cd examples/simple && yarn && yarn dev",
|
|
40
40
|
"run-example:prod": "yarn build:examples/simple && yarn --cwd examples/simple start",
|
|
41
41
|
"run-cypress": "cypress run --config-file cypress/cypress.json",
|
|
42
|
-
"test": "yarn check-types && yarn clean && yarn build && yarn build:examples/simple && bundlesize && NODE_ENV=test jest --
|
|
42
|
+
"test": "yarn check-types && yarn clean && yarn build && yarn build:examples/simple && bundlesize && NODE_ENV=test jest --maxWorkers=1 --silent",
|
|
43
43
|
"test:e2e": "start-server-and-test 'yarn --cwd examples/simple start' 3000 'yarn run-cypress'",
|
|
44
44
|
"contributors:check": "all-contributors check",
|
|
45
45
|
"contributors:add": "all-contributors add",
|
|
@@ -107,12 +107,15 @@
|
|
|
107
107
|
"@types/hoist-non-react-statics": "^3.3.1",
|
|
108
108
|
"core-js": "^3",
|
|
109
109
|
"hoist-non-react-statics": "^3.2.0",
|
|
110
|
-
"i18next": "^21.
|
|
110
|
+
"i18next": "^21.5.3",
|
|
111
111
|
"i18next-fs-backend": "^1.0.7",
|
|
112
112
|
"react-i18next": "^11.8.13"
|
|
113
113
|
},
|
|
114
114
|
"peerDependencies": {
|
|
115
115
|
"next": ">= 10.0.0",
|
|
116
116
|
"react": ">= 16.8.0"
|
|
117
|
+
},
|
|
118
|
+
"resolutions": {
|
|
119
|
+
"i18next-fs-backend": ">=1.1.4"
|
|
117
120
|
}
|
|
118
121
|
}
|