next-i18next-static-site 1.0.0-dev.1 → 1.0.2
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 +15 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,24 +30,26 @@ npm install --save next-i18next-static-site
|
|
|
30
30
|
## Usage
|
|
31
31
|
|
|
32
32
|
> `publicRuntimeConfig` is deprecated by Next.js.
|
|
33
|
-
>
|
|
33
|
+
> I moved the configuration for `next-i18next-static-site` to environment variables.
|
|
34
34
|
|
|
35
35
|
Set the supported languages and the namespaces in your `next.config.js` or in your `.env.local`:
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
`next.config.js` example:
|
|
38
38
|
|
|
39
39
|
```js
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
module.exports = {
|
|
41
|
+
env: {
|
|
42
|
+
NEXT_PUBLIC_I18N_LANGUAGES: '["en", "de"]',
|
|
43
|
+
NEXT_PUBLIC_I18N_DEFAULT_LANGUAGE: "en",
|
|
44
|
+
NEXT_PUBLIC_I18N_NAMESPACES: '["common", "meta", "error"]',
|
|
45
|
+
NEXT_PUBLIC_I18N_DEFAULT_NAMESPACE: "common",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
46
48
|
```
|
|
47
49
|
|
|
48
|
-
Arrays have to be a string within `next.config.js`, just put them into brackets.
|
|
50
|
+
Arrays have to be a string within `next.config.js`, just put them into brackets, otherwise Next.js will throw an error.
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
`.env.local` example:
|
|
51
53
|
|
|
52
54
|
```
|
|
53
55
|
NEXT_PUBLIC_I18N_LANGUAGES=["en", "de"]
|
|
@@ -62,11 +64,9 @@ Add your locales like that:
|
|
|
62
64
|
📦project
|
|
63
65
|
┗ 📂locales
|
|
64
66
|
┣ 📂de
|
|
65
|
-
┃
|
|
66
|
-
┃ ┗ 📜...
|
|
67
|
+
┃ ┗ 📜common.json
|
|
67
68
|
┗ 📂en
|
|
68
|
-
|
|
69
|
-
┗ 📜...
|
|
69
|
+
┗ 📜common.json
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
> The locales folder structure could be changed, just update the locales loader to match your custom structure
|
|
@@ -146,7 +146,7 @@ export default function Home() {
|
|
|
146
146
|
> Custom language detection needed?
|
|
147
147
|
> Have a look at the [`languageDetection()`](https://github.com/xairoo/next-i18next-static-site/blob/main/packages/next-i18next-static-site/src/index.tsx) function.
|
|
148
148
|
|
|
149
|
-
## Online
|
|
149
|
+
## Online Example at Cloudflare Pages:
|
|
150
150
|
|
|
151
151
|
https://next-i18next-static-site.pages.dev/de
|
|
152
152
|
Source: [examples/web](https://github.com/xairoo/next-i18next-static-site/tree/main/examples/web)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-i18next-static-site",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "i18next solution for static sites build with Next.js (static HTML export / next export)",
|
|
5
5
|
"homepage": "https://github.com/Xairoo/next-i18next-static-site",
|
|
6
6
|
"bugs": {
|