next-i18next 4.1.0 → 4.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.
package/README.md
CHANGED
|
@@ -87,6 +87,8 @@ After creating and exporting your `NextI18Next` instance, you need to take the f
|
|
|
87
87
|
```
|
|
88
88
|
For more info, see [the NextJs section on custom servers](https://github.com/zeit/next.js#custom-server-and-routing).
|
|
89
89
|
|
|
90
|
+
Note: You can pass `shallowRender: true` into config options to avoid triggering getInitialProps when `changeLanguage` method is invoked.
|
|
91
|
+
|
|
90
92
|
That's it! Your app is ready to go. You can now use the `NextI18Next.withTranslation` HOC to make your components or pages translatable, based on namespaces:
|
|
91
93
|
|
|
92
94
|
```jsx
|
|
@@ -249,6 +251,7 @@ MyPage.getInitialProps = async({ req }) => {
|
|
|
249
251
|
| `strictMode` | `true` |
|
|
250
252
|
| `use` (for plugins) | `[]` |
|
|
251
253
|
| `customDetectors` | `[]` |
|
|
254
|
+
| `shallowRender` | `false` |
|
|
252
255
|
|
|
253
256
|
_This table contains options which are specific to next-i18next. All other [i18next options](https://www.i18next.com/overview/configuration-options) can be passed in as well._
|
|
254
257
|
|
|
@@ -117,7 +117,9 @@ var appWithTranslation = function appWithTranslation(WrappedComponent) {
|
|
|
117
117
|
as = _lngPathCorrector.as,
|
|
118
118
|
href = _lngPathCorrector.href;
|
|
119
119
|
|
|
120
|
-
router.replace(href, as
|
|
120
|
+
router.replace(href, as, {
|
|
121
|
+
shallow: config.shallowRender
|
|
122
|
+
});
|
|
121
123
|
}
|
|
122
124
|
};
|
|
123
125
|
|
package/package.json
CHANGED