@lingui/react 5.5.0 → 5.5.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/dist/index-rsc.cjs +1 -1
- package/dist/index-rsc.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.mjs +1 -1
- package/dist/shared/{react.31c3b5fa.mjs → react.3519b71e.mjs} +21 -13
- package/dist/shared/{react.9788d7fd.cjs → react.6e08509a.cjs} +21 -13
- package/package.json +4 -4
package/dist/index-rsc.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const server = require('./server.cjs');
|
|
4
|
-
const TransNoContext = require('./shared/react.
|
|
4
|
+
const TransNoContext = require('./shared/react.6e08509a.cjs');
|
|
5
5
|
const React = require('react');
|
|
6
6
|
|
|
7
7
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
package/dist/index-rsc.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
const React = require('react');
|
|
5
|
-
const TransNoContext = require('./shared/react.
|
|
5
|
+
const TransNoContext = require('./shared/react.6e08509a.cjs');
|
|
6
6
|
|
|
7
7
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
8
8
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { T as TransNoContext } from './shared/react.
|
|
3
|
+
import { T as TransNoContext } from './shared/react.3519b71e.mjs';
|
|
4
4
|
|
|
5
5
|
const LinguiContext = React.createContext(null);
|
|
6
6
|
const useLinguiInternal = (devErrorMessage) => {
|
package/dist/server.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const TransNoContext = require('./shared/react.
|
|
3
|
+
const TransNoContext = require('./shared/react.6e08509a.cjs');
|
|
4
4
|
const React = require('react');
|
|
5
5
|
|
|
6
6
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
package/dist/server.mjs
CHANGED
|
@@ -20,10 +20,10 @@ const voidElementTags = {
|
|
|
20
20
|
menuitem: true
|
|
21
21
|
};
|
|
22
22
|
function formatElements(value, elements = {}) {
|
|
23
|
-
const uniqueId = makeCounter(0, "$lingui$");
|
|
24
23
|
const parts = value.split(tagRe);
|
|
25
24
|
if (parts.length === 1)
|
|
26
25
|
return value;
|
|
26
|
+
const uniqueId = makeCounter(0, "$lingui$");
|
|
27
27
|
const tree = [];
|
|
28
28
|
const before = parts.shift();
|
|
29
29
|
if (before)
|
|
@@ -77,18 +77,7 @@ function TransNoContext(props) {
|
|
|
77
77
|
formats,
|
|
78
78
|
lingui: { i18n, defaultComponent }
|
|
79
79
|
} = props;
|
|
80
|
-
const values =
|
|
81
|
-
const components = { ...props.components };
|
|
82
|
-
if (values) {
|
|
83
|
-
Object.keys(values).forEach((key) => {
|
|
84
|
-
const index = Object.keys(components).length;
|
|
85
|
-
if (typeof values[key] === "string" || typeof values[key] === "number") {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
components[index] = /* @__PURE__ */ React.createElement(React.Fragment, null, values[key]);
|
|
89
|
-
values[key] = `<${index}/>`;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
80
|
+
const { values, components } = getInterpolationValuesAndComponents(props);
|
|
92
81
|
const _translation = i18n && typeof i18n._ === "function" ? i18n._(id, values, { message, formats }) : id;
|
|
93
82
|
const translation = _translation ? formatElements(_translation, components) : null;
|
|
94
83
|
if (render === null || component === null) {
|
|
@@ -125,5 +114,24 @@ function TransNoContext(props) {
|
|
|
125
114
|
const RenderFragment = ({ children }) => {
|
|
126
115
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
127
116
|
};
|
|
117
|
+
const getInterpolationValuesAndComponents = (props) => {
|
|
118
|
+
if (!props.values) {
|
|
119
|
+
return {
|
|
120
|
+
values: void 0,
|
|
121
|
+
components: props.components
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
const values = { ...props.values };
|
|
125
|
+
const components = { ...props.components };
|
|
126
|
+
Object.entries(props.values).forEach(([key, valueForKey]) => {
|
|
127
|
+
if (typeof valueForKey === "string" || typeof valueForKey === "number") {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const index = Object.keys(components).length;
|
|
131
|
+
components[index] = /* @__PURE__ */ React.createElement(React.Fragment, null, valueForKey);
|
|
132
|
+
values[key] = `<${index}/>`;
|
|
133
|
+
});
|
|
134
|
+
return { values, components };
|
|
135
|
+
};
|
|
128
136
|
|
|
129
137
|
export { TransNoContext as T };
|
|
@@ -26,10 +26,10 @@ const voidElementTags = {
|
|
|
26
26
|
menuitem: true
|
|
27
27
|
};
|
|
28
28
|
function formatElements(value, elements = {}) {
|
|
29
|
-
const uniqueId = makeCounter(0, "$lingui$");
|
|
30
29
|
const parts = value.split(tagRe);
|
|
31
30
|
if (parts.length === 1)
|
|
32
31
|
return value;
|
|
32
|
+
const uniqueId = makeCounter(0, "$lingui$");
|
|
33
33
|
const tree = [];
|
|
34
34
|
const before = parts.shift();
|
|
35
35
|
if (before)
|
|
@@ -83,18 +83,7 @@ function TransNoContext(props) {
|
|
|
83
83
|
formats,
|
|
84
84
|
lingui: { i18n, defaultComponent }
|
|
85
85
|
} = props;
|
|
86
|
-
const values =
|
|
87
|
-
const components = { ...props.components };
|
|
88
|
-
if (values) {
|
|
89
|
-
Object.keys(values).forEach((key) => {
|
|
90
|
-
const index = Object.keys(components).length;
|
|
91
|
-
if (typeof values[key] === "string" || typeof values[key] === "number") {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
components[index] = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, values[key]);
|
|
95
|
-
values[key] = `<${index}/>`;
|
|
96
|
-
});
|
|
97
|
-
}
|
|
86
|
+
const { values, components } = getInterpolationValuesAndComponents(props);
|
|
98
87
|
const _translation = i18n && typeof i18n._ === "function" ? i18n._(id, values, { message, formats }) : id;
|
|
99
88
|
const translation = _translation ? formatElements(_translation, components) : null;
|
|
100
89
|
if (render === null || component === null) {
|
|
@@ -131,5 +120,24 @@ function TransNoContext(props) {
|
|
|
131
120
|
const RenderFragment = ({ children }) => {
|
|
132
121
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children);
|
|
133
122
|
};
|
|
123
|
+
const getInterpolationValuesAndComponents = (props) => {
|
|
124
|
+
if (!props.values) {
|
|
125
|
+
return {
|
|
126
|
+
values: void 0,
|
|
127
|
+
components: props.components
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
const values = { ...props.values };
|
|
131
|
+
const components = { ...props.components };
|
|
132
|
+
Object.entries(props.values).forEach(([key, valueForKey]) => {
|
|
133
|
+
if (typeof valueForKey === "string" || typeof valueForKey === "number") {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const index = Object.keys(components).length;
|
|
137
|
+
components[index] = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, valueForKey);
|
|
138
|
+
values[key] = `<${index}/>`;
|
|
139
|
+
});
|
|
140
|
+
return { values, components };
|
|
141
|
+
};
|
|
134
142
|
|
|
135
143
|
exports.TransNoContext = TransNoContext;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingui/react",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.2",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "React components for translations",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"macro/index.js"
|
|
80
80
|
],
|
|
81
81
|
"peerDependencies": {
|
|
82
|
-
"@lingui/babel-plugin-lingui-macro": "5.5.
|
|
82
|
+
"@lingui/babel-plugin-lingui-macro": "5.5.2",
|
|
83
83
|
"babel-plugin-macros": "2 || 3",
|
|
84
84
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
85
85
|
},
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
},
|
|
94
94
|
"dependencies": {
|
|
95
95
|
"@babel/runtime": "^7.20.13",
|
|
96
|
-
"@lingui/core": "5.5.
|
|
96
|
+
"@lingui/core": "5.5.2"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"@lingui/jest-mocks": "*",
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"react-dom": "^18.2.0",
|
|
106
106
|
"unbuild": "2.0.0"
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "197bcd9ab7eca588ba9436a2d20996f92deb7547"
|
|
109
109
|
}
|