next-i18next 6.0.2 → 6.0.3
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 +6 -1
- package/package.json +2 -2
- package/types.d.ts +5 -1
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ After creating and exporting your `NextI18Next` instance, you need to take the f
|
|
|
69
69
|
|
|
70
70
|
1. Create an `_app.js` file inside your `pages` directory, and wrap it with the `NextI18Next.appWithTranslation` higher order component (HOC). You can see this approach in the [examples/simple/pages/_app.js](./examples/simple/pages/_app.js).
|
|
71
71
|
Your app component must either extend `App` if it's a class component or define a `getInitialProps` if it's a functional component [(explanation here)](https://github.com/isaachinman/next-i18next/issues/615#issuecomment-575578375).
|
|
72
|
-
2. Create a `next.config.js` file inside your root directory if you want to use locale subpaths. You can see this approach in the [examples/simple/next.config.js](./examples/simple/next.config.js).
|
|
72
|
+
2. Create a `next.config.js` file inside your root directory if you want to use locale subpaths. You can see this approach in the [examples/simple/next.config.js](./examples/simple/next.config.js) (Next.js 9.5+ required).
|
|
73
73
|
|
|
74
74
|
Note: You can pass `shallowRender: true` into config options to avoid triggering getInitialProps when `changeLanguage` method is invoked.
|
|
75
75
|
|
|
@@ -217,6 +217,11 @@ _This table contains options which are specific to next-i18next. All other [i18n
|
|
|
217
217
|
- [`next export` is not supported.](https://github.com/isaachinman/next-i18next/issues/780)
|
|
218
218
|
- [To add a `lang` attribute to your top-level html DOM node, you must create a `_document.js` file.](https://github.com/isaachinman/next-i18next/issues/20#issuecomment-443461652)
|
|
219
219
|
- [Localising `next/head` requires special consideration due to NextJs internals](https://github.com/isaachinman/next-i18next/issues/251#issuecomment-479421852).
|
|
220
|
+
- [How to use multiple namespaces in the same component](https://github.com/isaachinman/next-i18next/issues/762#issuecomment-661348457)
|
|
221
|
+
|
|
222
|
+
## Usage with TypeScript
|
|
223
|
+
|
|
224
|
+
`next-i18next` is written in TypeScript and has full support for it. Refer to the usage guide [here](./TYPESCRIPT.md).
|
|
220
225
|
|
|
221
226
|
## Contributors
|
|
222
227
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-i18next",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.3",
|
|
4
4
|
"repository": "git@github.com:isaachinman/next-i18next.git",
|
|
5
5
|
"author": "Isaac Hinman <isaac@isaachinman.com>",
|
|
6
6
|
"funding": {
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"i18next-http-middleware": "^3.0.2",
|
|
110
110
|
"path-match": "^1.2.4",
|
|
111
111
|
"prop-types": "^15.6.2",
|
|
112
|
-
"react-i18next": "^11.7.
|
|
112
|
+
"react-i18next": "^11.7.3",
|
|
113
113
|
"url": "^0.11.0"
|
|
114
114
|
},
|
|
115
115
|
"peerDependencies": {
|
package/types.d.ts
CHANGED
|
@@ -45,7 +45,6 @@ export type Trans = (props: TransProps) => any
|
|
|
45
45
|
export type Link = React.ComponentClass<LinkProps>
|
|
46
46
|
export type Router = SingletonRouter
|
|
47
47
|
export type UseTranslation = typeof useTranslation
|
|
48
|
-
export type I18nContext = typeof I18nContext
|
|
49
48
|
export type AppWithTranslation = <P extends object>(Component: React.ComponentType<P> | React.ElementType<P>) => any
|
|
50
49
|
export type TFunction = I18NextTFunction
|
|
51
50
|
export type I18n = i18n
|
|
@@ -53,6 +52,11 @@ export type WithTranslationHocType = typeof withTranslation
|
|
|
53
52
|
export type WithTranslation = ReactI18nextWithTranslation
|
|
54
53
|
export type InitPromise = Promise<TFunction>
|
|
55
54
|
|
|
55
|
+
export {
|
|
56
|
+
I18nContext,
|
|
57
|
+
withTranslation,
|
|
58
|
+
}
|
|
59
|
+
|
|
56
60
|
declare class NextI18Next {
|
|
57
61
|
constructor(config: InitConfig);
|
|
58
62
|
Trans: Trans
|