next-i18next-static-site 0.2.4 → 0.2.6
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 +14 -8
- package/package.json +16 -8
package/README.md
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<h1>next-i18next-static-site</h1>
|
|
3
3
|
<p>i18next solution for static sites build with Next.js (static HTML export / <code>next export</code>).</p>
|
|
4
|
+
<p>
|
|
5
|
+
<a href="https://packagequality.com/#?package=next-i18next-static-site">
|
|
6
|
+
<img src="https://packagequality.com/shield/next-i18next-static-site.svg"/>
|
|
7
|
+
</a>
|
|
8
|
+
<a href="https://www.npmjs.com/package/next-i18next-static-site">
|
|
9
|
+
<img src="https://img.shields.io/github/v/release/xairoo/next-i18next-static-site?label=latest" alt="Github Stable Release" />
|
|
10
|
+
</a>
|
|
11
|
+
</p>
|
|
4
12
|
</div>
|
|
5
13
|
|
|
6
|
-
## i18next solution for Next.js
|
|
7
|
-
|
|
8
14
|
This package brings you `react-i18next` and `i18next` to your static sites build with the `next export` future from Next.js.
|
|
9
15
|
|
|
10
16
|
- 🗲 Translation is already rendered (SSG), client will receive the final translated site.
|
|
11
|
-
- 🚀 Automatic browser language detection.
|
|
12
|
-
- 🍪 Cookie stores the client language.
|
|
13
17
|
- 🔥 Hot reload works also when you update your locale (translation) files.
|
|
18
|
+
- 🚀 Automatic browser language detection can be realized.
|
|
19
|
+
- 🍪 Cookie stores the client language.
|
|
14
20
|
|
|
15
21
|
## Installation
|
|
16
22
|
|
|
@@ -18,10 +24,6 @@ This package brings you `react-i18next` and `i18next` to your static sites build
|
|
|
18
24
|
npm install --save next-i18next-static-site
|
|
19
25
|
```
|
|
20
26
|
|
|
21
|
-
## Configuration
|
|
22
|
-
|
|
23
|
-
You have to add a few environment variables to your `next.config.js`.
|
|
24
|
-
|
|
25
27
|
## Usage
|
|
26
28
|
|
|
27
29
|
Set the supported languages and the namespaces in your `next.config.js`:
|
|
@@ -98,3 +100,7 @@ export default App;
|
|
|
98
100
|
Now you are able to use `useTranslation`, `withTranslation`, `Translation` and `Trans` directly from `react-i18next` or from `next-i18next-static-site`.
|
|
99
101
|
|
|
100
102
|
> The [example Next.js site](https://github.com/xairoo/next-i18next-static-site/tree/main/apps/web-ts) provides a `Link` and `LinkText` (used for `Trans`) component and als a custom `404` page.
|
|
103
|
+
|
|
104
|
+
### Language detection
|
|
105
|
+
|
|
106
|
+
Please check the example [pages/index.tsx](https://github.com/xairoo/next-i18next-static-site/blob/main/examples/web-ts/pages/index.tsx). It contains a simple language detection and redirect solution.
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-i18next-static-site",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "i18next solution for static sites build with Next.js (static HTML export / next export)",
|
|
5
|
+
"homepage": "https://github.com/Xairoo/next-i18next-static-site",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/Xairoo/next-i18next-static-site/issues"
|
|
8
|
+
},
|
|
5
9
|
"main": "./dist/index.js",
|
|
6
10
|
"module": "./dist/index.mjs",
|
|
7
11
|
"types": "./dist/index.d.ts",
|
|
@@ -32,16 +36,14 @@
|
|
|
32
36
|
"release": "release-it"
|
|
33
37
|
},
|
|
34
38
|
"devDependencies": {
|
|
39
|
+
"@types/js-cookie": "^3.0.2",
|
|
35
40
|
"@types/react": "^17.0.37",
|
|
36
41
|
"@types/react-dom": "^17.0.11",
|
|
37
42
|
"eslint": "^7.32.0",
|
|
38
43
|
"eslint-config-custom": "*",
|
|
39
44
|
"release-it": "^15.5.0",
|
|
40
45
|
"tsconfig": "*",
|
|
41
|
-
"typescript": "^4.5.2"
|
|
42
|
-
},
|
|
43
|
-
"dependencies": {
|
|
44
|
-
"@types/js-cookie": "^3.0.2",
|
|
46
|
+
"typescript": "^4.5.2",
|
|
45
47
|
"i18next": "^21.10.0",
|
|
46
48
|
"js-cookie": "^3.0.1",
|
|
47
49
|
"next": "^13.0.0",
|
|
@@ -49,8 +51,14 @@
|
|
|
49
51
|
"react-i18next": "^11.18.6",
|
|
50
52
|
"tsup": "^6.3.0"
|
|
51
53
|
},
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"js-cookie": "^3.0.1"
|
|
54
56
|
},
|
|
55
|
-
"
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"i18next": "^21.10.0",
|
|
59
|
+
"js-cookie": "^3.0.1",
|
|
60
|
+
"next": "^13.0.0",
|
|
61
|
+
"react": "^18.2.0",
|
|
62
|
+
"react-i18next": "^11.18.6"
|
|
63
|
+
}
|
|
56
64
|
}
|