@nimpl/i18n 2.0.1-canary.0 → 3.0.0-canary.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/ClientTranslation.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type I18nOptions } from "./types";
|
|
|
3
3
|
type ClientTranslationProps = {
|
|
4
4
|
term: string;
|
|
5
5
|
components?: {
|
|
6
|
-
[key: string]:
|
|
6
|
+
[key: string]: React.ReactElement;
|
|
7
7
|
};
|
|
8
8
|
query?: I18nOptions["query"];
|
|
9
9
|
removeUnusedQueries?: I18nOptions["removeUnusedQueries"];
|
package/ServerTranslation.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type I18nOptions } from "./types";
|
|
|
3
3
|
type ServerTranslationProps = {
|
|
4
4
|
term: string;
|
|
5
5
|
components?: {
|
|
6
|
-
[key: string]:
|
|
6
|
+
[key: string]: React.ReactElement;
|
|
7
7
|
};
|
|
8
8
|
query?: I18nOptions["query"];
|
|
9
9
|
removeUnusedQueries?: I18nOptions["removeUnusedQueries"];
|
package/dist/lib/Translation.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
@@ -35,7 +36,7 @@ const Translation = ({ term, text, components }) => {
|
|
|
35
36
|
if (component) {
|
|
36
37
|
const children = parts
|
|
37
38
|
.slice(targetTag.position + 1, tagIndex + 1)
|
|
38
|
-
.filter((c) => Boolean(c.props.children));
|
|
39
|
+
.filter((c) => Boolean(c && typeof c === "object" && "props" in c && c.props.children));
|
|
39
40
|
parts.splice(targetTag.position + 1, // parts на 1 больше
|
|
40
41
|
tagIndex - targetTag.position, react_1.default.cloneElement(component, { key: `${tagIndex}-${targetIndex}` }, children.length ? children : component.props.children));
|
|
41
42
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nimpl/i18n",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-canary.0",
|
|
4
4
|
"description": "i18n library for working with translations in server and client components",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./ClientTranslation": {
|
|
@@ -59,16 +59,16 @@
|
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/node": "16.11.12",
|
|
61
61
|
"@types/object-path": "0.11.4",
|
|
62
|
-
"@types/react": "
|
|
62
|
+
"@types/react": "19.1.1",
|
|
63
63
|
"@types/webpack": "5.28.5",
|
|
64
|
-
"react": "
|
|
64
|
+
"react": "19.1.0",
|
|
65
65
|
"typescript": "5.3.2"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"react": ">=
|
|
68
|
+
"react": ">= 19.1.0"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@nimpl/getters": "1.
|
|
71
|
+
"@nimpl/getters": "2.1.1",
|
|
72
72
|
"html-entities": "2.4.0",
|
|
73
73
|
"object-path": "0.11.8"
|
|
74
74
|
}
|