next-i18next 9.1.0 → 9.2.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.
Files changed (2) hide show
  1. package/README.md +16 -0
  2. package/package.json +2 -2
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)):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-i18next",
3
- "version": "9.1.0",
3
+ "version": "9.2.0",
4
4
  "repository": "git@github.com:isaachinman/next-i18next.git",
5
5
  "author": "Isaac Hinman <isaac@isaachinman.com>",
6
6
  "funding": {
@@ -107,7 +107,7 @@
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.4.1",
110
+ "i18next": "^21.5.3",
111
111
  "i18next-fs-backend": "^1.0.7",
112
112
  "react-i18next": "^11.8.13"
113
113
  },