@prosopo/locale 3.2.7 → 3.2.8
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/.turbo/turbo-build$colon$cjs.log +20 -20
- package/.turbo/turbo-build$colon$tsc.log +5 -5
- package/.turbo/turbo-build.log +22 -19
- package/CHANGELOG.md +6 -0
- package/dist/_virtual/_rolldown/runtime.js +3 -0
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/cjs/i18SharedOptions.cjs +8 -10
- package/dist/cjs/i18nBackend.cjs +29 -29
- package/dist/cjs/i18nFrontend.cjs +54 -61
- package/dist/cjs/i18nMiddleware.cjs +7 -6
- package/dist/cjs/index.cjs +13 -14
- package/dist/cjs/loadI18next.cjs +23 -33
- package/dist/cjs/locales/en/translation.cjs +487 -0
- package/dist/cjs/translationKey.cjs +14 -22
- package/dist/cjs/translations.cjs +39 -39
- package/dist/cjs/useTranslation.cjs +10 -6
- package/dist/cjs/util.cjs +6 -6
- package/dist/i18SharedOptions.js +9 -11
- package/dist/i18nBackend.js +25 -28
- package/dist/i18nFrontend.js +45 -57
- package/dist/i18nMiddleware.d.ts +2 -1
- package/dist/i18nMiddleware.d.ts.map +1 -1
- package/dist/i18nMiddleware.js +5 -6
- package/dist/i18nMiddleware.js.map +1 -1
- package/dist/index.js +5 -12
- package/dist/loadI18next.js +23 -34
- package/dist/locales/en/translation.js +473 -0
- package/dist/translationKey.js +15 -23
- package/dist/translations.js +37 -40
- package/dist/useTranslation.js +10 -8
- package/dist/util.js +7 -8
- package/package.json +6 -6
- package/src/i18nMiddleware.ts +6 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/.turbo/turbo-typecheck.log +0 -4
- package/dist/cjs/locales/en/translation.json.cjs +0 -47
- package/dist/locales/en/translation.json.js +0 -47
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/locale@3.2.
|
|
2
|
+
> @prosopo/locale@3.2.8 build:cjs
|
|
3
3
|
> NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
|
|
4
4
|
|
|
5
5
|
ViteCommonJSConfig: .
|
|
6
6
|
{ tsConfigPaths: [] }
|
|
7
7
|
{ externals: [] }
|
|
8
|
-
[
|
|
8
|
+
[33mThe plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the [1mresolve.tsconfigPaths[22m option. You can remove the plugin and set [1mresolve.tsconfigPaths: true[22m in your Vite config instead.[39m
|
|
9
|
+
[36mvite v8.1.5 [32mbuilding ssr environment for production...[36m[39m
|
|
9
10
|
Bundle build started
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
[32m✓[39m 11 modules transformed.
|
|
13
|
-
[33mEntry module "src/locales/en/translation.json" is using named and default exports together. Consumers of your bundle will have to use `..default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.[39m
|
|
14
|
-
[33mEntry module "src/i18nFrontend.ts" is using named and default exports together. Consumers of your bundle will have to use `..default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.[39m
|
|
15
|
-
[33mEntry module "src/i18nBackend.ts" is using named and default exports together. Consumers of your bundle will have to use `..default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.[39m
|
|
11
|
+
[2K
|
|
12
|
+
✓ 12 modules transformed.
|
|
16
13
|
rendering chunks...
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
computing gzip size...
|
|
15
|
+
dist/cjs/util.cjs 0.28 kB │ gzip: 0.17 kB
|
|
16
|
+
dist/cjs/useTranslation.cjs 0.35 kB │ gzip: 0.20 kB
|
|
17
|
+
dist/cjs/i18nMiddleware.cjs 0.36 kB │ gzip: 0.21 kB
|
|
18
|
+
dist/cjs/i18SharedOptions.cjs 0.42 kB │ gzip: 0.27 kB
|
|
19
|
+
dist/cjs/translationKey.cjs 0.64 kB │ gzip: 0.36 kB
|
|
20
|
+
dist/cjs/index.cjs 0.83 kB │ gzip: 0.27 kB
|
|
21
|
+
dist/cjs/translations.cjs 0.86 kB │ gzip: 0.46 kB
|
|
22
|
+
dist/cjs/loadI18next.cjs 0.90 kB │ gzip: 0.37 kB
|
|
23
|
+
dist/cjs/_virtual/_rolldown/runtime.cjs 1.00 kB │ gzip: 0.50 kB
|
|
24
|
+
dist/cjs/i18nBackend.cjs 1.36 kB │ gzip: 0.58 kB
|
|
25
|
+
dist/cjs/i18nFrontend.cjs 2.35 kB │ gzip: 0.84 kB
|
|
26
|
+
dist/cjs/locales/en/translation.cjs 15.72 kB │ gzip: 5.59 kB
|
|
27
|
+
|
|
28
|
+
[32m✓ built in 83ms[39m
|
|
29
29
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/locale/src/locales/ar/translation.json to /home/runner/work/captcha/captcha/packages/locale/dist/locales/ar/translation.json
|
|
30
30
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/locale/src/locales/az/translation.json to /home/runner/work/captcha/captcha/packages/locale/dist/locales/az/translation.json
|
|
31
31
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/locale/src/locales/cs/translation.json to /home/runner/work/captcha/captcha/packages/locale/dist/locales/cs/translation.json
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/locale@3.2.
|
|
2
|
+
> @prosopo/locale@3.2.8 build:tsc
|
|
3
3
|
> tsc --build --verbose
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
8:58:35 PM - Projects in this build:
|
|
6
6
|
* ../../dev/config/tsconfig.json
|
|
7
7
|
* tsconfig.json
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
8:58:36 PM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/webpack/webpack.config.ts' is older than output '../../dev/config/tsconfig.tsbuildinfo'
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
8:58:36 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
8:58:36 PM - Building project '/home/runner/work/captcha/captcha/packages/locale/tsconfig.json'...
|
|
14
14
|
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/locale@3.2.
|
|
2
|
+
> @prosopo/locale@3.2.8 build
|
|
3
3
|
> npm run build:cross-env -- --mode ${NODE_ENV:-development}
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @prosopo/locale@3.2.
|
|
6
|
+
> @prosopo/locale@3.2.8 build:cross-env
|
|
7
7
|
> vite build --config vite.esm.config.ts --mode production
|
|
8
8
|
|
|
9
9
|
ViteEsmConfig: .
|
|
10
10
|
{ tsConfigPaths: [] }
|
|
11
11
|
{ externals: [] }
|
|
12
|
-
[
|
|
12
|
+
[33mThe plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the [1mresolve.tsconfigPaths[22m option. You can remove the plugin and set [1mresolve.tsconfigPaths: true[22m in your Vite config instead.[39m
|
|
13
|
+
[36mvite v8.1.5 [32mbuilding ssr environment for production...[36m[39m
|
|
13
14
|
Bundle build started
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
[32m✓[39m 11 modules transformed.
|
|
15
|
+
[2K
|
|
16
|
+
✓ 12 modules transformed.
|
|
17
17
|
rendering chunks...
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
computing gzip size...
|
|
19
|
+
dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
|
|
20
|
+
dist/util.js 0.25 kB │ gzip: 0.16 kB
|
|
21
|
+
dist/i18nMiddleware.js 0.27 kB │ gzip: 0.18 kB
|
|
22
|
+
dist/useTranslation.js 0.30 kB │ gzip: 0.19 kB
|
|
23
|
+
dist/i18SharedOptions.js 0.37 kB │ gzip: 0.26 kB
|
|
24
|
+
dist/index.js 0.47 kB │ gzip: 0.20 kB
|
|
25
|
+
dist/translationKey.js 0.61 kB │ gzip: 0.36 kB
|
|
26
|
+
dist/translations.js 0.70 kB │ gzip: 0.39 kB
|
|
27
|
+
dist/loadI18next.js 0.84 kB │ gzip: 0.36 kB
|
|
28
|
+
dist/i18nBackend.js 0.91 kB │ gzip: 0.49 kB
|
|
29
|
+
dist/i18nFrontend.js 1.65 kB │ gzip: 0.74 kB
|
|
30
|
+
dist/locales/en/translation.js 15.49 kB │ gzip: 5.56 kB
|
|
31
|
+
|
|
32
|
+
[32m✓ built in 117ms[39m
|
|
30
33
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/locale/src/locales/ar/translation.json to /home/runner/work/captcha/captcha/packages/locale/dist/locales/ar/translation.json
|
|
31
34
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/locale/src/locales/az/translation.json to /home/runner/work/captcha/captcha/packages/locale/dist/locales/az/translation.json
|
|
32
35
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/locale/src/locales/cs/translation.json to /home/runner/work/captcha/captcha/packages/locale/dist/locales/cs/translation.json
|
|
@@ -35,8 +38,8 @@ rendering chunks...
|
|
|
35
38
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/locale/src/locales/en/translation.json to /home/runner/work/captcha/captcha/packages/locale/dist/locales/en/translation.json
|
|
36
39
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/locale/src/locales/es/translation.json to /home/runner/work/captcha/captcha/packages/locale/dist/locales/es/translation.json
|
|
37
40
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/locale/src/locales/fi/translation.json to /home/runner/work/captcha/captcha/packages/locale/dist/locales/fi/translation.json
|
|
38
|
-
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/locale/src/locales/hi/translation.json to /home/runner/work/captcha/captcha/packages/locale/dist/locales/hi/translation.json
|
|
39
41
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/locale/src/locales/fr/translation.json to /home/runner/work/captcha/captcha/packages/locale/dist/locales/fr/translation.json
|
|
42
|
+
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/locale/src/locales/hi/translation.json to /home/runner/work/captcha/captcha/packages/locale/dist/locales/hi/translation.json
|
|
40
43
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/locale/src/locales/hu/translation.json to /home/runner/work/captcha/captcha/packages/locale/dist/locales/hu/translation.json
|
|
41
44
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/locale/src/locales/id/translation.json to /home/runner/work/captcha/captcha/packages/locale/dist/locales/id/translation.json
|
|
42
45
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/locale/src/locales/it/translation.json to /home/runner/work/captcha/captcha/packages/locale/dist/locales/it/translation.json
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @prosopo/locale
|
|
2
2
|
|
|
3
|
+
## 3.2.8
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- 0e1171c: chore(deps): combined dependabot bumps (lodash, webpack-dev-server, sharp, i18next-http-middleware, actions/setup-node and transitive security updates)
|
|
7
|
+
- e14fce6: chore(deps): bump vite to 6.4.3 and mongoose to 8.24.1, and adjust types for the mongoose 8.24 Document/ObjectId changes
|
|
8
|
+
|
|
3
9
|
## 3.2.7
|
|
4
10
|
### Patch Changes
|
|
5
11
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.__toESM = __toESM;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
namespace: "translation",
|
|
9
|
-
supportedLngs: Object.values(translations.Languages),
|
|
10
|
-
nonExplicitSupportedLngs: false
|
|
1
|
+
const require_translations = require("./translations.cjs");
|
|
2
|
+
var i18nSharedOptions = {
|
|
3
|
+
debug: (typeof process !== "undefined" ? process.env?.PROSOPO_LOG_LEVEL : void 0) === "debug",
|
|
4
|
+
fallbackLng: require_translations.LanguageSchema.enum.en,
|
|
5
|
+
namespace: "translation",
|
|
6
|
+
supportedLngs: Object.values(require_translations.Languages),
|
|
7
|
+
nonExplicitSupportedLngs: false
|
|
11
8
|
};
|
|
9
|
+
//#endregion
|
|
12
10
|
exports.i18nSharedOptions = i18nSharedOptions;
|
package/dist/cjs/i18nBackend.cjs
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
);
|
|
1
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_util = require("./util.cjs");
|
|
3
|
+
const require_i18SharedOptions = require("./i18SharedOptions.cjs");
|
|
4
|
+
let i18next_http_middleware = require("i18next-http-middleware");
|
|
5
|
+
let i18next = require("i18next");
|
|
6
|
+
i18next = require_runtime.__toESM(i18next, 1);
|
|
7
|
+
let node_path = require("node:path");
|
|
8
|
+
node_path = require_runtime.__toESM(node_path, 1);
|
|
9
|
+
let i18next_fs_backend_cjs = require("i18next-fs-backend/cjs");
|
|
10
|
+
i18next_fs_backend_cjs = require_runtime.__toESM(i18next_fs_backend_cjs, 1);
|
|
11
|
+
//#region src/i18nBackend.ts
|
|
12
|
+
var loadPath = `${node_path.default.dirname(require("url").pathToFileURL(__filename).href)}/locales/{{lng}}/{{ns}}.json`.replace("file://", "");
|
|
14
13
|
function initializeI18n(i18nLoadedCallback) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
14
|
+
if (!i18next.default.isInitialized && require_util.isServerSide()) {
|
|
15
|
+
const lngDetector = new i18next_http_middleware.LanguageDetector(null, { order: [
|
|
16
|
+
"header",
|
|
17
|
+
"query",
|
|
18
|
+
"cookie"
|
|
19
|
+
] });
|
|
20
|
+
i18next.default.use(i18next_fs_backend_cjs.default).use(lngDetector).init({
|
|
21
|
+
...require_i18SharedOptions.i18nSharedOptions,
|
|
22
|
+
ns: ["translation"],
|
|
23
|
+
backend: { loadPath }
|
|
24
|
+
});
|
|
25
|
+
i18next.default.on("loaded", () => {
|
|
26
|
+
i18nLoadedCallback?.(i18next.default);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return i18next.default;
|
|
31
30
|
}
|
|
31
|
+
//#endregion
|
|
32
32
|
exports.default = initializeI18n;
|
|
33
33
|
exports.initializeI18n = initializeI18n;
|
|
@@ -1,67 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_i18SharedOptions = require("./i18SharedOptions.cjs");
|
|
3
|
+
let react_i18next = require("react-i18next");
|
|
4
|
+
let i18next = require("i18next");
|
|
5
|
+
i18next = require_runtime.__toESM(i18next, 1);
|
|
6
|
+
let i18next_browser_languagedetector = require("i18next-browser-languagedetector");
|
|
7
|
+
i18next_browser_languagedetector = require_runtime.__toESM(i18next_browser_languagedetector, 1);
|
|
8
|
+
let i18next_chained_backend = require("i18next-chained-backend");
|
|
9
|
+
i18next_chained_backend = require_runtime.__toESM(i18next_chained_backend, 1);
|
|
10
|
+
let i18next_http_backend = require("i18next-http-backend");
|
|
11
|
+
i18next_http_backend = require_runtime.__toESM(i18next_http_backend, 1);
|
|
12
|
+
let i18next_resources_to_backend = require("i18next-resources-to-backend");
|
|
13
|
+
i18next_resources_to_backend = require_runtime.__toESM(i18next_resources_to_backend, 1);
|
|
14
|
+
//#region src/i18nFrontend.ts
|
|
15
|
+
var reactOptions = {
|
|
16
|
+
react: { useSuspense: true },
|
|
17
|
+
detection: {
|
|
18
|
+
order: [
|
|
19
|
+
"navigator",
|
|
20
|
+
"htmlTag",
|
|
21
|
+
"path",
|
|
22
|
+
"subdomain"
|
|
23
|
+
],
|
|
24
|
+
caches: ["localStorage", "cookie"]
|
|
25
|
+
}
|
|
19
26
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
var getLoadPath = (language, namespace) => {
|
|
28
|
+
const filename = require("url").pathToFileURL(__filename).href.split("/").pop();
|
|
29
|
+
return `${require("url").pathToFileURL(__filename).href.replace(`/${filename}`, "")}/locales/${language}/${namespace}.json`;
|
|
23
30
|
};
|
|
24
31
|
function initializeI18n(i18nLoadedCallback, lng) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
)
|
|
51
|
-
],
|
|
52
|
-
backendOptions: [
|
|
53
|
-
{
|
|
54
|
-
loadPath: getLoadPath("{{lng}}", "{{ns}}")
|
|
55
|
-
}
|
|
56
|
-
]
|
|
57
|
-
},
|
|
58
|
-
...reactOptions
|
|
59
|
-
});
|
|
60
|
-
i18n.on("loaded", () => {
|
|
61
|
-
i18nLoadedCallback?.(i18n);
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return i18n;
|
|
32
|
+
if (!i18next.default.isInitialized) {
|
|
33
|
+
i18next.default.use(i18next_chained_backend.default).use(new i18next_browser_languagedetector.default(null, {
|
|
34
|
+
order: [
|
|
35
|
+
"cookie",
|
|
36
|
+
"localStorage",
|
|
37
|
+
"navigator"
|
|
38
|
+
],
|
|
39
|
+
lookupQuerystring: "lng",
|
|
40
|
+
lookupCookie: "i18next",
|
|
41
|
+
lookupLocalStorage: "i18nextLng",
|
|
42
|
+
caches: ["localStorage", "cookie"]
|
|
43
|
+
})).use(react_i18next.initReactI18next).init({
|
|
44
|
+
...require_i18SharedOptions.i18nSharedOptions,
|
|
45
|
+
...lng ? { lng } : {},
|
|
46
|
+
backend: {
|
|
47
|
+
backends: [i18next_http_backend.default, (0, i18next_resources_to_backend.default)((language, namespace) => import(getLoadPath(language, namespace)))],
|
|
48
|
+
backendOptions: [{ loadPath: getLoadPath("{{lng}}", "{{ns}}") }]
|
|
49
|
+
},
|
|
50
|
+
...reactOptions
|
|
51
|
+
});
|
|
52
|
+
i18next.default.on("loaded", () => {
|
|
53
|
+
i18nLoadedCallback?.(i18next.default);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return i18next.default;
|
|
65
57
|
}
|
|
58
|
+
//#endregion
|
|
66
59
|
exports.default = initializeI18n;
|
|
67
60
|
exports.initializeI18n = initializeI18n;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const require_loadI18next = require("./loadI18next.cjs");
|
|
2
|
+
let i18next_http_middleware = require("i18next-http-middleware");
|
|
3
|
+
//#region src/i18nMiddleware.ts
|
|
4
4
|
async function i18nMiddleware(options) {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const i18n = await require_loadI18next.default(true);
|
|
6
|
+
return (0, i18next_http_middleware.handle)(i18n, { ...options });
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
//#endregion
|
|
9
|
+
exports.default = i18nMiddleware;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.isClientSide =
|
|
14
|
-
exports.
|
|
15
|
-
exports.useTranslation =
|
|
2
|
+
const require_loadI18next = require("./loadI18next.cjs");
|
|
3
|
+
const require_i18nMiddleware = require("./i18nMiddleware.cjs");
|
|
4
|
+
const require_translations = require("./translations.cjs");
|
|
5
|
+
const require_util = require("./util.cjs");
|
|
6
|
+
const require_translationKey = require("./translationKey.cjs");
|
|
7
|
+
const require_useTranslation = require("./useTranslation.cjs");
|
|
8
|
+
exports.LanguageSchema = require_translations.LanguageSchema;
|
|
9
|
+
exports.Languages = require_translations.Languages;
|
|
10
|
+
exports.TranslationKeysSchema = require_translationKey.TranslationKeysSchema;
|
|
11
|
+
exports.i18nMiddleware = require_i18nMiddleware.default;
|
|
12
|
+
exports.isClientSide = require_util.isClientSide;
|
|
13
|
+
exports.loadI18next = require_loadI18next.default;
|
|
14
|
+
exports.useTranslation = require_useTranslation.default;
|
package/dist/cjs/loadI18next.cjs
CHANGED
|
@@ -1,36 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
return instance;
|
|
1
|
+
//#region src/loadI18next.ts
|
|
2
|
+
var i18nInstance;
|
|
3
|
+
var reconcileLanguage = async (instance, lng) => {
|
|
4
|
+
if (lng && instance.language !== lng) await instance.changeLanguage(lng);
|
|
5
|
+
return instance;
|
|
8
6
|
};
|
|
9
7
|
async function loadI18next(backend, lng) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} else {
|
|
27
|
-
void reconcileLanguage(i18nInstance, lng).then(resolve);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
} catch (e) {
|
|
32
|
-
reject(e);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
8
|
+
return new Promise((resolve, reject) => {
|
|
9
|
+
try {
|
|
10
|
+
if (backend) Promise.resolve().then(() => require("./i18nBackend.cjs")).then(({ default: initializeI18n }) => {
|
|
11
|
+
if (!i18nInstance) i18nInstance = initializeI18n(resolve);
|
|
12
|
+
else resolve(i18nInstance);
|
|
13
|
+
});
|
|
14
|
+
else Promise.resolve().then(() => require("./i18nFrontend.cjs")).then(({ default: initializeI18n }) => {
|
|
15
|
+
if (!i18nInstance) i18nInstance = initializeI18n((instance) => {
|
|
16
|
+
reconcileLanguage(instance, lng).then(resolve);
|
|
17
|
+
}, lng);
|
|
18
|
+
else reconcileLanguage(i18nInstance, lng).then(resolve);
|
|
19
|
+
});
|
|
20
|
+
} catch (e) {
|
|
21
|
+
reject(e);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
35
24
|
}
|
|
36
|
-
|
|
25
|
+
//#endregion
|
|
26
|
+
exports.default = loadI18next;
|