next-i18next-static-site 0.2.1
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/LICENSE +21 -0
- package/README.md +100 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +169 -0
- package/dist/index.mjs +131 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Marcel Zurreck
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>next-i18next-static-site</h1>
|
|
3
|
+
<p>i18next solution for static sites build with Next.js (static HTML export / <code>next export</code>).</p>
|
|
4
|
+
</div>
|
|
5
|
+
|
|
6
|
+
## i18next solution for Next.js
|
|
7
|
+
|
|
8
|
+
This package brings you `react-i18next` and `i18next` to your static sites build with the `next export` future from Next.js.
|
|
9
|
+
|
|
10
|
+
- 🗲 Translation is already rendered (SSG), client will receive the final translated site.
|
|
11
|
+
- 🚀 Automatic browser language detection.
|
|
12
|
+
- 🍪 Cookie stores the client language.
|
|
13
|
+
- 🔥 Hot reload works also when you update your locale (translation) files.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
npm install --save next-i18next-static-site
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Configuration
|
|
22
|
+
|
|
23
|
+
You have to add a few environment variables to your `next.config.js`.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Set the supported languages and the namespaces in your `next.config.js`:
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
publicRuntimeConfig: {
|
|
31
|
+
i18n: {
|
|
32
|
+
languages: ["en", "de"],
|
|
33
|
+
defaultLanguage: "en",
|
|
34
|
+
namespaces: ["common", "meta", "error"],
|
|
35
|
+
defaultNamespace: "common",
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Add your locales like that:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
📦project
|
|
44
|
+
┣ 📂locales
|
|
45
|
+
┃ ┣ 📂de
|
|
46
|
+
┃ ┃ ┣ 📜common.json
|
|
47
|
+
┃ ┗ 📂en
|
|
48
|
+
┃ ┃ ┣ 📜common.json
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
> The locales folder structure could be changed, just update the locales loader to match your custom structure
|
|
52
|
+
|
|
53
|
+
Finally implement the locales loader and the `I18nProvider` like this in your `_app.js`:
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
import {
|
|
57
|
+
I18nProvider,
|
|
58
|
+
languages,
|
|
59
|
+
defaultLanguage,
|
|
60
|
+
namespaces,
|
|
61
|
+
defaultNamespace,
|
|
62
|
+
} from "next-i18next-static-site";
|
|
63
|
+
|
|
64
|
+
// Load all locales, required for next-i18next-static-site
|
|
65
|
+
export const locales = {};
|
|
66
|
+
languages.map((language) => {
|
|
67
|
+
locales[language] = {};
|
|
68
|
+
|
|
69
|
+
namespaces.map((namespace) => {
|
|
70
|
+
locales[language][namespace] = require("./../locales/" +
|
|
71
|
+
language +
|
|
72
|
+
"/" +
|
|
73
|
+
namespace +
|
|
74
|
+
".json");
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const App = function ({ Component, pageProps }) {
|
|
79
|
+
// i18n options
|
|
80
|
+
const i18n = {
|
|
81
|
+
languages,
|
|
82
|
+
defaultLanguage,
|
|
83
|
+
namespaces,
|
|
84
|
+
defaultNamespace,
|
|
85
|
+
locales,
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<I18nProvider i18n={i18n}>
|
|
90
|
+
<Component {...pageProps} />
|
|
91
|
+
</I18nProvider>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export default App;
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Now you are able to use `useTranslation`, `withTranslation`, `Translation` and `Trans` directly from `react-i18next` or from `next-i18next-static-site`.
|
|
99
|
+
|
|
100
|
+
> 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.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { i18n } from 'i18next';
|
|
2
|
+
export { Trans, Translation, useTranslation, withTranslation } from 'react-i18next';
|
|
3
|
+
|
|
4
|
+
declare const languages: string[];
|
|
5
|
+
declare const defaultLanguage: string;
|
|
6
|
+
declare const namespaces: string[];
|
|
7
|
+
declare const defaultNamespace: string;
|
|
8
|
+
declare const defaultNamespace2: string;
|
|
9
|
+
declare const cookieName: string;
|
|
10
|
+
declare const i18nextInstance: (language: string, locales: object) => i18n;
|
|
11
|
+
declare const I18nProvider: (props: any) => any;
|
|
12
|
+
declare function getAllLanguageSlugs(): {
|
|
13
|
+
params: {
|
|
14
|
+
lang: string;
|
|
15
|
+
};
|
|
16
|
+
}[];
|
|
17
|
+
declare function getLanguage(lang: string): string;
|
|
18
|
+
|
|
19
|
+
export { I18nProvider, cookieName, defaultLanguage, defaultNamespace, defaultNamespace2, getAllLanguageSlugs, getLanguage, i18nextInstance, languages, namespaces };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
|
|
26
|
+
// src/index.tsx
|
|
27
|
+
var src_exports = {};
|
|
28
|
+
__export(src_exports, {
|
|
29
|
+
I18nProvider: () => I18nProvider,
|
|
30
|
+
Trans: () => import_react_i18next.Trans,
|
|
31
|
+
Translation: () => import_react_i18next.Translation,
|
|
32
|
+
cookieName: () => cookieName,
|
|
33
|
+
defaultLanguage: () => defaultLanguage,
|
|
34
|
+
defaultNamespace: () => defaultNamespace,
|
|
35
|
+
defaultNamespace2: () => defaultNamespace2,
|
|
36
|
+
getAllLanguageSlugs: () => getAllLanguageSlugs,
|
|
37
|
+
getLanguage: () => getLanguage,
|
|
38
|
+
i18nextInstance: () => i18nextInstance,
|
|
39
|
+
languages: () => languages,
|
|
40
|
+
namespaces: () => namespaces,
|
|
41
|
+
useTranslation: () => import_react_i18next.useTranslation,
|
|
42
|
+
withTranslation: () => import_react_i18next.withTranslation
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(src_exports);
|
|
45
|
+
var import_config = __toESM(require("next/config"));
|
|
46
|
+
var import_router = require("next/router");
|
|
47
|
+
var import_react = require("react");
|
|
48
|
+
var import_js_cookie = __toESM(require("js-cookie"));
|
|
49
|
+
var import_i18next = __toESM(require("i18next"));
|
|
50
|
+
var import_react_i18next = require("react-i18next");
|
|
51
|
+
var { publicRuntimeConfig } = (0, import_config.default)();
|
|
52
|
+
var defaultConfig = {
|
|
53
|
+
allowHydration: true,
|
|
54
|
+
languages: ["en"],
|
|
55
|
+
defaultLanguage: "en",
|
|
56
|
+
namespaces: ["common"],
|
|
57
|
+
defaultNamespace: "common",
|
|
58
|
+
cookieName: "lang",
|
|
59
|
+
cookieOptions: { expires: 365, path: "/" }
|
|
60
|
+
};
|
|
61
|
+
var config = {
|
|
62
|
+
...defaultConfig,
|
|
63
|
+
languages: publicRuntimeConfig.i18n.languages,
|
|
64
|
+
defaultLanguage: publicRuntimeConfig.i18n.defaultLanguage,
|
|
65
|
+
namespaces: publicRuntimeConfig.i18n.namespaces,
|
|
66
|
+
defaultNamespace: publicRuntimeConfig.i18n.defaultNamespace
|
|
67
|
+
};
|
|
68
|
+
var languages = config.languages;
|
|
69
|
+
var defaultLanguage = config.defaultLanguage;
|
|
70
|
+
var namespaces = config.namespaces;
|
|
71
|
+
var defaultNamespace = config.defaultNamespace;
|
|
72
|
+
var defaultNamespace2 = config.defaultNamespace;
|
|
73
|
+
var cookieName = config.cookieName;
|
|
74
|
+
var createI18nextInstance = (locales, language) => {
|
|
75
|
+
const plugins = [
|
|
76
|
+
import_react_i18next.initReactI18next
|
|
77
|
+
];
|
|
78
|
+
const i18nInstance = import_i18next.default;
|
|
79
|
+
plugins.map((plugin) => i18nInstance.use(plugin));
|
|
80
|
+
i18nInstance.init({
|
|
81
|
+
resources: locales,
|
|
82
|
+
cleanCode: true,
|
|
83
|
+
lng: language,
|
|
84
|
+
supportedLngs: config.languages,
|
|
85
|
+
fallbackLng: language ? language : config.defaultLanguage,
|
|
86
|
+
ns: config.namespaces,
|
|
87
|
+
defaultNS: config.defaultNamespace,
|
|
88
|
+
interpolation: {
|
|
89
|
+
escapeValue: false
|
|
90
|
+
},
|
|
91
|
+
react: {
|
|
92
|
+
useSuspense: false
|
|
93
|
+
},
|
|
94
|
+
load: "languageOnly"
|
|
95
|
+
});
|
|
96
|
+
return i18nInstance;
|
|
97
|
+
};
|
|
98
|
+
var globalI18nextInstance = null;
|
|
99
|
+
var i18nextInstance = (language, locales) => {
|
|
100
|
+
if (!globalI18nextInstance) {
|
|
101
|
+
globalI18nextInstance = createI18nextInstance(locales, language);
|
|
102
|
+
return globalI18nextInstance;
|
|
103
|
+
} else {
|
|
104
|
+
globalI18nextInstance.changeLanguage(language);
|
|
105
|
+
return globalI18nextInstance;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
var loaded = false;
|
|
109
|
+
var I18nProvider = (props) => {
|
|
110
|
+
var _a;
|
|
111
|
+
const [hydration, setHydration] = (0, import_react.useState)(false);
|
|
112
|
+
const options = { ...config, ...props.i18n };
|
|
113
|
+
if (!((_a = props.i18n) == null ? void 0 : _a.locales)) {
|
|
114
|
+
throw new Error("locales object was not passed into I18nProvider");
|
|
115
|
+
}
|
|
116
|
+
const router = (0, import_router.useRouter)();
|
|
117
|
+
const { asPath, query } = router;
|
|
118
|
+
const slug = asPath.split("/")[1];
|
|
119
|
+
const langSlug = config.languages.includes(slug) && slug;
|
|
120
|
+
const language = (query.lang || langSlug || config.defaultLanguage).toString();
|
|
121
|
+
const pathLocale = (query.lang || langSlug).toString();
|
|
122
|
+
if (pathLocale && pathLocale !== "false") {
|
|
123
|
+
import_js_cookie.default.set(config.cookieName, pathLocale, config.cookieOptions);
|
|
124
|
+
}
|
|
125
|
+
if (!loaded) {
|
|
126
|
+
i18nextInstance(language, props.i18n.locales);
|
|
127
|
+
}
|
|
128
|
+
const { i18n: i18n2 } = (0, import_react_i18next.useTranslation)();
|
|
129
|
+
(0, import_react.useEffect)(() => {
|
|
130
|
+
i18n2.services.resourceStore.data = props.i18n.locales;
|
|
131
|
+
i18n2.changeLanguage(language);
|
|
132
|
+
}, [props.i18n.locales]);
|
|
133
|
+
(0, import_react.useEffect)(() => {
|
|
134
|
+
loaded = true;
|
|
135
|
+
i18n2.changeLanguage(language);
|
|
136
|
+
}, [language]);
|
|
137
|
+
(0, import_react.useEffect)(() => {
|
|
138
|
+
const hasWindow = typeof window !== "undefined";
|
|
139
|
+
if (hasWindow && options.allowHydration) {
|
|
140
|
+
setHydration(true);
|
|
141
|
+
}
|
|
142
|
+
}, []);
|
|
143
|
+
return hydration ? props.children : null;
|
|
144
|
+
};
|
|
145
|
+
function getAllLanguageSlugs() {
|
|
146
|
+
return config.languages.map((lang) => {
|
|
147
|
+
return { params: { lang } };
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function getLanguage(lang) {
|
|
151
|
+
return config.languages.includes(lang) ? lang : config.defaultLanguage;
|
|
152
|
+
}
|
|
153
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
154
|
+
0 && (module.exports = {
|
|
155
|
+
I18nProvider,
|
|
156
|
+
Trans,
|
|
157
|
+
Translation,
|
|
158
|
+
cookieName,
|
|
159
|
+
defaultLanguage,
|
|
160
|
+
defaultNamespace,
|
|
161
|
+
defaultNamespace2,
|
|
162
|
+
getAllLanguageSlugs,
|
|
163
|
+
getLanguage,
|
|
164
|
+
i18nextInstance,
|
|
165
|
+
languages,
|
|
166
|
+
namespaces,
|
|
167
|
+
useTranslation,
|
|
168
|
+
withTranslation
|
|
169
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// src/index.tsx
|
|
2
|
+
import getConfig from "next/config";
|
|
3
|
+
import { useRouter } from "next/router";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import Cookies from "js-cookie";
|
|
6
|
+
import i18next from "i18next";
|
|
7
|
+
import {
|
|
8
|
+
initReactI18next,
|
|
9
|
+
useTranslation,
|
|
10
|
+
withTranslation,
|
|
11
|
+
Translation,
|
|
12
|
+
Trans
|
|
13
|
+
} from "react-i18next";
|
|
14
|
+
var { publicRuntimeConfig } = getConfig();
|
|
15
|
+
var defaultConfig = {
|
|
16
|
+
allowHydration: true,
|
|
17
|
+
languages: ["en"],
|
|
18
|
+
defaultLanguage: "en",
|
|
19
|
+
namespaces: ["common"],
|
|
20
|
+
defaultNamespace: "common",
|
|
21
|
+
cookieName: "lang",
|
|
22
|
+
cookieOptions: { expires: 365, path: "/" }
|
|
23
|
+
};
|
|
24
|
+
var config = {
|
|
25
|
+
...defaultConfig,
|
|
26
|
+
languages: publicRuntimeConfig.i18n.languages,
|
|
27
|
+
defaultLanguage: publicRuntimeConfig.i18n.defaultLanguage,
|
|
28
|
+
namespaces: publicRuntimeConfig.i18n.namespaces,
|
|
29
|
+
defaultNamespace: publicRuntimeConfig.i18n.defaultNamespace
|
|
30
|
+
};
|
|
31
|
+
var languages = config.languages;
|
|
32
|
+
var defaultLanguage = config.defaultLanguage;
|
|
33
|
+
var namespaces = config.namespaces;
|
|
34
|
+
var defaultNamespace = config.defaultNamespace;
|
|
35
|
+
var defaultNamespace2 = config.defaultNamespace;
|
|
36
|
+
var cookieName = config.cookieName;
|
|
37
|
+
var createI18nextInstance = (locales, language) => {
|
|
38
|
+
const plugins = [
|
|
39
|
+
initReactI18next
|
|
40
|
+
];
|
|
41
|
+
const i18nInstance = i18next;
|
|
42
|
+
plugins.map((plugin) => i18nInstance.use(plugin));
|
|
43
|
+
i18nInstance.init({
|
|
44
|
+
resources: locales,
|
|
45
|
+
cleanCode: true,
|
|
46
|
+
lng: language,
|
|
47
|
+
supportedLngs: config.languages,
|
|
48
|
+
fallbackLng: language ? language : config.defaultLanguage,
|
|
49
|
+
ns: config.namespaces,
|
|
50
|
+
defaultNS: config.defaultNamespace,
|
|
51
|
+
interpolation: {
|
|
52
|
+
escapeValue: false
|
|
53
|
+
},
|
|
54
|
+
react: {
|
|
55
|
+
useSuspense: false
|
|
56
|
+
},
|
|
57
|
+
load: "languageOnly"
|
|
58
|
+
});
|
|
59
|
+
return i18nInstance;
|
|
60
|
+
};
|
|
61
|
+
var globalI18nextInstance = null;
|
|
62
|
+
var i18nextInstance = (language, locales) => {
|
|
63
|
+
if (!globalI18nextInstance) {
|
|
64
|
+
globalI18nextInstance = createI18nextInstance(locales, language);
|
|
65
|
+
return globalI18nextInstance;
|
|
66
|
+
} else {
|
|
67
|
+
globalI18nextInstance.changeLanguage(language);
|
|
68
|
+
return globalI18nextInstance;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var loaded = false;
|
|
72
|
+
var I18nProvider = (props) => {
|
|
73
|
+
var _a;
|
|
74
|
+
const [hydration, setHydration] = useState(false);
|
|
75
|
+
const options = { ...config, ...props.i18n };
|
|
76
|
+
if (!((_a = props.i18n) == null ? void 0 : _a.locales)) {
|
|
77
|
+
throw new Error("locales object was not passed into I18nProvider");
|
|
78
|
+
}
|
|
79
|
+
const router = useRouter();
|
|
80
|
+
const { asPath, query } = router;
|
|
81
|
+
const slug = asPath.split("/")[1];
|
|
82
|
+
const langSlug = config.languages.includes(slug) && slug;
|
|
83
|
+
const language = (query.lang || langSlug || config.defaultLanguage).toString();
|
|
84
|
+
const pathLocale = (query.lang || langSlug).toString();
|
|
85
|
+
if (pathLocale && pathLocale !== "false") {
|
|
86
|
+
Cookies.set(config.cookieName, pathLocale, config.cookieOptions);
|
|
87
|
+
}
|
|
88
|
+
if (!loaded) {
|
|
89
|
+
i18nextInstance(language, props.i18n.locales);
|
|
90
|
+
}
|
|
91
|
+
const { i18n: i18n2 } = useTranslation();
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
i18n2.services.resourceStore.data = props.i18n.locales;
|
|
94
|
+
i18n2.changeLanguage(language);
|
|
95
|
+
}, [props.i18n.locales]);
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
loaded = true;
|
|
98
|
+
i18n2.changeLanguage(language);
|
|
99
|
+
}, [language]);
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
const hasWindow = typeof window !== "undefined";
|
|
102
|
+
if (hasWindow && options.allowHydration) {
|
|
103
|
+
setHydration(true);
|
|
104
|
+
}
|
|
105
|
+
}, []);
|
|
106
|
+
return hydration ? props.children : null;
|
|
107
|
+
};
|
|
108
|
+
function getAllLanguageSlugs() {
|
|
109
|
+
return config.languages.map((lang) => {
|
|
110
|
+
return { params: { lang } };
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function getLanguage(lang) {
|
|
114
|
+
return config.languages.includes(lang) ? lang : config.defaultLanguage;
|
|
115
|
+
}
|
|
116
|
+
export {
|
|
117
|
+
I18nProvider,
|
|
118
|
+
Trans,
|
|
119
|
+
Translation,
|
|
120
|
+
cookieName,
|
|
121
|
+
defaultLanguage,
|
|
122
|
+
defaultNamespace,
|
|
123
|
+
defaultNamespace2,
|
|
124
|
+
getAllLanguageSlugs,
|
|
125
|
+
getLanguage,
|
|
126
|
+
i18nextInstance,
|
|
127
|
+
languages,
|
|
128
|
+
namespaces,
|
|
129
|
+
useTranslation,
|
|
130
|
+
withTranslation
|
|
131
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "next-i18next-static-site",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "i18next solution for static sites build with Next.js (static HTML export / next export)",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/**"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git://github.com/Xairoo/next-i18next-static-site.git"
|
|
15
|
+
},
|
|
16
|
+
"author": "Marcel Zurreck <marcel.zurreck@gmail.com> (https://marcel.zurreck.com)",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"nextjs",
|
|
19
|
+
"authentication",
|
|
20
|
+
"jwt",
|
|
21
|
+
"static-site"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "rm -rf dist && mkdir dist && tsup src/index.tsx --format esm,cjs --dts --external react",
|
|
25
|
+
"dev": "tsup src/index.tsx --format esm,cjs --watch --dts",
|
|
26
|
+
"lint": "TIMING=1 eslint \"**/*.ts*\"",
|
|
27
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/react": "^17.0.37",
|
|
31
|
+
"@types/react-dom": "^17.0.11",
|
|
32
|
+
"eslint": "^7.32.0",
|
|
33
|
+
"eslint-config-custom": "*",
|
|
34
|
+
"tsconfig": "*",
|
|
35
|
+
"typescript": "^4.5.2"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@types/js-cookie": "^3.0.2",
|
|
39
|
+
"i18next": "^21.10.0",
|
|
40
|
+
"js-cookie": "^3.0.1",
|
|
41
|
+
"react": "^18.2.0",
|
|
42
|
+
"next": "^13.0.0",
|
|
43
|
+
"react-i18next": "^11.18.6",
|
|
44
|
+
"tsup": "^6.3.0"
|
|
45
|
+
},
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/Xairoo/next-i18next-static-site/issues"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/Xairoo/next-i18next-static-site#readme"
|
|
50
|
+
}
|