@localazy/strapi-plugin 1.0.4 → 1.0.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/dist/_chunks/{App-CtS6CrNn.mjs → App-C0ogWaOz.mjs} +8 -4
- package/dist/_chunks/{App-NRmSxuW3.js → App-Dl58PZKy.js} +91 -87
- package/dist/_chunks/{ContentTransferSetup-CeKXlzw_.mjs → ContentTransferSetup-ClR8Nwv2.mjs} +41 -452
- package/dist/_chunks/{ContentTransferSetup-DGs8MZPj.js → ContentTransferSetup-DWQg9zDj.js} +91 -502
- package/dist/_chunks/{GlobalSettings-rOwd0Y0E.mjs → GlobalSettings-B_h5sPwa.mjs} +7 -4
- package/dist/_chunks/{GlobalSettings-CRMPRA3Y.js → GlobalSettings-BpY7BoXu.js} +43 -40
- package/dist/_chunks/{LanguagesSelector-Bd8VFHib.js → LanguagesSelector-Bfrsr3-P.js} +10 -8
- package/dist/_chunks/{LanguagesSelector-CeB7tVcb.mjs → LanguagesSelector-u9iDsQqB.mjs} +4 -2
- package/dist/_chunks/LocalazyPanel-BedTxk3C.js +83 -0
- package/dist/_chunks/LocalazyPanel-CuvdSJYx.mjs +83 -0
- package/dist/_chunks/LocalazyStatusColumn-955GpXAv.mjs +51 -0
- package/dist/_chunks/LocalazyStatusColumn-Bf1ntoc7.js +51 -0
- package/dist/_chunks/_commonjsHelpers-Bc2YnDe1.js +7 -0
- package/dist/_chunks/_commonjsHelpers-DWwsNxpa.mjs +8 -0
- package/dist/_chunks/en-CMWcM0nM.js +10 -0
- package/dist/_chunks/en-RX915msK.mjs +10 -0
- package/dist/_chunks/entry-exclusion-service-BlyFqyBY.mjs +60 -0
- package/dist/_chunks/entry-exclusion-service-bm-lp4za.js +60 -0
- package/dist/_chunks/{has-model-changed-gNSOSMBa.js → has-model-changed-B5SSh8XW.js} +4 -3
- package/dist/_chunks/{has-model-changed-DViUIQHk.mjs → has-model-changed-DIHY9LBA.mjs} +3 -2
- package/dist/_chunks/i18n-0dV2P-Hm.js +2378 -0
- package/dist/_chunks/i18n-RoETLXdU.mjs +2378 -0
- package/dist/_chunks/index-1he9s_bs.js +430 -0
- package/dist/_chunks/index-BIbKC7-V.mjs +432 -0
- package/dist/_chunks/{index-Dj68Ixl2.mjs → index-C15Goe6p.mjs} +120 -4
- package/dist/_chunks/{set-Cbi1yYuW.js → index-CaY3BYnQ.js} +878 -4379
- package/dist/_chunks/{set-Dnhh_SyE.mjs → index-DOCSzcPH.mjs} +907 -4409
- package/dist/_chunks/{index-Bbwk3kp3.js → index-Q3-srfXc.js} +142 -4
- package/dist/_chunks/initReactI18next-B0H8_DlW.js +60 -0
- package/dist/_chunks/initReactI18next-MHHxeg_9.mjs +61 -0
- package/dist/_chunks/{isEqual-CC-cEPwY.mjs → isEqual-BazjlHGf.mjs} +1 -1
- package/dist/_chunks/{isEqual-0M0aSdTT.js → isEqual-CrlZhAtq.js} +1 -1
- package/dist/_chunks/set-BRyy4Ra6.mjs +893 -0
- package/dist/_chunks/set-CmcBsVOP.js +891 -0
- package/dist/_chunks/useTranslation-BdIl-aLe.js +188 -0
- package/dist/_chunks/useTranslation-CZQ4lU1m.mjs +189 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/LocalazyPanel.d.ts +4 -0
- package/dist/admin/src/components/LocalazyStatusColumn.d.ts +3 -0
- package/dist/admin/src/index.d.ts +1 -0
- package/dist/admin/src/modules/entry-exclusion/services/entry-exclusion-service.d.ts +18 -0
- package/dist/admin/src/modules/plugin-settings/locale/en.d.ts +8 -0
- package/dist/server/index.js +202 -35
- package/dist/server/index.mjs +202 -35
- package/dist/server/src/controllers/entry-exclusion-controller.d.ts +21 -0
- package/dist/server/src/controllers/index.d.ts +7 -0
- package/dist/server/src/core/index.d.ts +6 -0
- package/dist/server/src/index.d.ts +15 -0
- package/dist/server/src/routes/entry-exclusion-routes.d.ts +9 -0
- package/dist/server/src/services/entry-exclusion-service.d.ts +23 -0
- package/dist/server/src/services/index.d.ts +8 -0
- package/package.json +2 -2
- package/dist/_chunks/en-BTf8goGM.mjs +0 -8
- package/dist/_chunks/en-CRtsEFtl.js +0 -8
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { createElement, isValidElement, cloneElement, Children, Fragment, useContext } from "react";
|
|
2
|
+
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-DWwsNxpa.mjs";
|
|
3
|
+
import { w as warnOnce, i as isString, a as warn, b as isObject, I as I18nContext } from "./useTranslation-CZQ4lU1m.mjs";
|
|
4
|
+
import { u } from "./useTranslation-CZQ4lU1m.mjs";
|
|
5
|
+
import { g as getI18n, a as getDefaults } from "./initReactI18next-MHHxeg_9.mjs";
|
|
6
|
+
import { i, s, b } from "./initReactI18next-MHHxeg_9.mjs";
|
|
7
|
+
var voidElements = {
|
|
8
|
+
"area": true,
|
|
9
|
+
"base": true,
|
|
10
|
+
"br": true,
|
|
11
|
+
"col": true,
|
|
12
|
+
"embed": true,
|
|
13
|
+
"hr": true,
|
|
14
|
+
"img": true,
|
|
15
|
+
"input": true,
|
|
16
|
+
"link": true,
|
|
17
|
+
"meta": true,
|
|
18
|
+
"param": true,
|
|
19
|
+
"source": true,
|
|
20
|
+
"track": true,
|
|
21
|
+
"wbr": true
|
|
22
|
+
};
|
|
23
|
+
const e = /* @__PURE__ */ getDefaultExportFromCjs(voidElements);
|
|
24
|
+
var t = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;
|
|
25
|
+
function n(n2) {
|
|
26
|
+
var r2 = { type: "tag", name: "", voidElement: false, attrs: {}, children: [] }, i3 = n2.match(/<\/?([^\s]+?)[/\s>]/);
|
|
27
|
+
if (i3 && (r2.name = i3[1], (e[i3[1]] || "/" === n2.charAt(n2.length - 2)) && (r2.voidElement = true), r2.name.startsWith("!--"))) {
|
|
28
|
+
var s3 = n2.indexOf("-->");
|
|
29
|
+
return { type: "comment", comment: -1 !== s3 ? n2.slice(4, s3) : "" };
|
|
30
|
+
}
|
|
31
|
+
for (var a2 = new RegExp(t), c2 = null; null !== (c2 = a2.exec(n2)); ) if (c2[0].trim()) if (c2[1]) {
|
|
32
|
+
var o = c2[1].trim(), l = [o, ""];
|
|
33
|
+
o.indexOf("=") > -1 && (l = o.split("=")), r2.attrs[l[0]] = l[1], a2.lastIndex--;
|
|
34
|
+
} else c2[2] && (r2.attrs[c2[2]] = c2[3].trim().substring(1, c2[3].length - 1));
|
|
35
|
+
return r2;
|
|
36
|
+
}
|
|
37
|
+
var r = /<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g, i2 = /^\s*$/, s2 = /* @__PURE__ */ Object.create(null);
|
|
38
|
+
function a(e2, t2) {
|
|
39
|
+
switch (t2.type) {
|
|
40
|
+
case "text":
|
|
41
|
+
return e2 + t2.content;
|
|
42
|
+
case "tag":
|
|
43
|
+
return e2 += "<" + t2.name + (t2.attrs ? function(e3) {
|
|
44
|
+
var t3 = [];
|
|
45
|
+
for (var n2 in e3) t3.push(n2 + '="' + e3[n2] + '"');
|
|
46
|
+
return t3.length ? " " + t3.join(" ") : "";
|
|
47
|
+
}(t2.attrs) : "") + (t2.voidElement ? "/>" : ">"), t2.voidElement ? e2 : e2 + t2.children.reduce(a, "") + "</" + t2.name + ">";
|
|
48
|
+
case "comment":
|
|
49
|
+
return e2 + "<!--" + t2.comment + "-->";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
var c = { parse: function(e2, t2) {
|
|
53
|
+
t2 || (t2 = {}), t2.components || (t2.components = s2);
|
|
54
|
+
var a2, c2 = [], o = [], l = -1, m = false;
|
|
55
|
+
if (0 !== e2.indexOf("<")) {
|
|
56
|
+
var u2 = e2.indexOf("<");
|
|
57
|
+
c2.push({ type: "text", content: -1 === u2 ? e2 : e2.substring(0, u2) });
|
|
58
|
+
}
|
|
59
|
+
return e2.replace(r, function(r2, s3) {
|
|
60
|
+
if (m) {
|
|
61
|
+
if (r2 !== "</" + a2.name + ">") return;
|
|
62
|
+
m = false;
|
|
63
|
+
}
|
|
64
|
+
var u3, f = "/" !== r2.charAt(1), h = r2.startsWith("<!--"), p = s3 + r2.length, d = e2.charAt(p);
|
|
65
|
+
if (h) {
|
|
66
|
+
var v = n(r2);
|
|
67
|
+
return l < 0 ? (c2.push(v), c2) : ((u3 = o[l]).children.push(v), c2);
|
|
68
|
+
}
|
|
69
|
+
if (f && (l++, "tag" === (a2 = n(r2)).type && t2.components[a2.name] && (a2.type = "component", m = true), a2.voidElement || m || !d || "<" === d || a2.children.push({ type: "text", content: e2.slice(p, e2.indexOf("<", p)) }), 0 === l && c2.push(a2), (u3 = o[l - 1]) && u3.children.push(a2), o[l] = a2), (!f || a2.voidElement) && (l > -1 && (a2.voidElement || a2.name === r2.slice(2, -1)) && (l--, a2 = -1 === l ? c2 : o[l]), !m && "<" !== d && d)) {
|
|
70
|
+
u3 = -1 === l ? c2 : o[l].children;
|
|
71
|
+
var x = e2.indexOf("<", p), g = e2.slice(p, -1 === x ? void 0 : x);
|
|
72
|
+
i2.test(g) && (g = " "), (x > -1 && l + u3.length >= 0 || " " !== g) && u3.push({ type: "text", content: g });
|
|
73
|
+
}
|
|
74
|
+
}), c2;
|
|
75
|
+
}, stringify: function(e2) {
|
|
76
|
+
return e2.reduce(function(e3, t2) {
|
|
77
|
+
return e3 + a("", t2);
|
|
78
|
+
}, "");
|
|
79
|
+
} };
|
|
80
|
+
const hasChildren = (node, checkLength) => {
|
|
81
|
+
if (!node) return false;
|
|
82
|
+
const base = node.props?.children ?? node.children;
|
|
83
|
+
if (checkLength) return base.length > 0;
|
|
84
|
+
return !!base;
|
|
85
|
+
};
|
|
86
|
+
const getChildren = (node) => {
|
|
87
|
+
if (!node) return [];
|
|
88
|
+
const children = node.props?.children ?? node.children;
|
|
89
|
+
return node.props?.i18nIsDynamicList ? getAsArray(children) : children;
|
|
90
|
+
};
|
|
91
|
+
const hasValidReactChildren = (children) => Array.isArray(children) && children.every(isValidElement);
|
|
92
|
+
const getAsArray = (data) => Array.isArray(data) ? data : [data];
|
|
93
|
+
const mergeProps = (source, target) => {
|
|
94
|
+
const newTarget = {
|
|
95
|
+
...target
|
|
96
|
+
};
|
|
97
|
+
newTarget.props = Object.assign(source.props, target.props);
|
|
98
|
+
return newTarget;
|
|
99
|
+
};
|
|
100
|
+
const nodesToString = (children, i18nOptions, i18n, i18nKey) => {
|
|
101
|
+
if (!children) return "";
|
|
102
|
+
let stringNode = "";
|
|
103
|
+
const childrenArray = getAsArray(children);
|
|
104
|
+
const keepArray = i18nOptions?.transSupportBasicHtmlNodes ? i18nOptions.transKeepBasicHtmlNodesFor ?? [] : [];
|
|
105
|
+
childrenArray.forEach((child, childIndex) => {
|
|
106
|
+
if (isString(child)) {
|
|
107
|
+
stringNode += `${child}`;
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (isValidElement(child)) {
|
|
111
|
+
const {
|
|
112
|
+
props,
|
|
113
|
+
type
|
|
114
|
+
} = child;
|
|
115
|
+
const childPropsCount = Object.keys(props).length;
|
|
116
|
+
const shouldKeepChild = keepArray.indexOf(type) > -1;
|
|
117
|
+
const childChildren = props.children;
|
|
118
|
+
if (!childChildren && shouldKeepChild && !childPropsCount) {
|
|
119
|
+
stringNode += `<${type}/>`;
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (!childChildren && (!shouldKeepChild || childPropsCount) || props.i18nIsDynamicList) {
|
|
123
|
+
stringNode += `<${childIndex}></${childIndex}>`;
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (shouldKeepChild && childPropsCount === 1 && isString(childChildren)) {
|
|
127
|
+
stringNode += `<${type}>${childChildren}</${type}>`;
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const content = nodesToString(childChildren, i18nOptions, i18n, i18nKey);
|
|
131
|
+
stringNode += `<${childIndex}>${content}</${childIndex}>`;
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (child === null) {
|
|
135
|
+
warn(i18n, "TRANS_NULL_VALUE", `Passed in a null value as child`, {
|
|
136
|
+
i18nKey
|
|
137
|
+
});
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (isObject(child)) {
|
|
141
|
+
const {
|
|
142
|
+
format,
|
|
143
|
+
...clone
|
|
144
|
+
} = child;
|
|
145
|
+
const keys = Object.keys(clone);
|
|
146
|
+
if (keys.length === 1) {
|
|
147
|
+
const value = format ? `${keys[0]}, ${format}` : keys[0];
|
|
148
|
+
stringNode += `{{${value}}}`;
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
warn(i18n, "TRANS_INVALID_OBJ", `Invalid child - Object should only have keys {{ value, format }} (format is optional).`, {
|
|
152
|
+
i18nKey,
|
|
153
|
+
child
|
|
154
|
+
});
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
warn(i18n, "TRANS_INVALID_VAR", `Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`, {
|
|
158
|
+
i18nKey,
|
|
159
|
+
child
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
return stringNode;
|
|
163
|
+
};
|
|
164
|
+
const renderNodes = (children, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape) => {
|
|
165
|
+
if (targetString === "") return [];
|
|
166
|
+
const keepArray = i18nOptions.transKeepBasicHtmlNodesFor || [];
|
|
167
|
+
const emptyChildrenButNeedsHandling = targetString && new RegExp(keepArray.map((keep) => `<${keep}`).join("|")).test(targetString);
|
|
168
|
+
if (!children && !emptyChildrenButNeedsHandling && !shouldUnescape) return [targetString];
|
|
169
|
+
const data = {};
|
|
170
|
+
const getData = (childs) => {
|
|
171
|
+
const childrenArray = getAsArray(childs);
|
|
172
|
+
childrenArray.forEach((child) => {
|
|
173
|
+
if (isString(child)) return;
|
|
174
|
+
if (hasChildren(child)) getData(getChildren(child));
|
|
175
|
+
else if (isObject(child) && !isValidElement(child)) Object.assign(data, child);
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
getData(children);
|
|
179
|
+
const ast = c.parse(`<0>${targetString}</0>`);
|
|
180
|
+
const opts = {
|
|
181
|
+
...data,
|
|
182
|
+
...combinedTOpts
|
|
183
|
+
};
|
|
184
|
+
const renderInner = (child, node, rootReactNode) => {
|
|
185
|
+
const childs = getChildren(child);
|
|
186
|
+
const mappedChildren = mapAST(childs, node.children, rootReactNode);
|
|
187
|
+
return hasValidReactChildren(childs) && mappedChildren.length === 0 || child.props?.i18nIsDynamicList ? childs : mappedChildren;
|
|
188
|
+
};
|
|
189
|
+
const pushTranslatedJSX = (child, inner, mem, i3, isVoid) => {
|
|
190
|
+
if (child.dummy) {
|
|
191
|
+
child.children = inner;
|
|
192
|
+
mem.push(cloneElement(child, {
|
|
193
|
+
key: i3
|
|
194
|
+
}, isVoid ? void 0 : inner));
|
|
195
|
+
} else {
|
|
196
|
+
mem.push(...Children.map([child], (c2) => {
|
|
197
|
+
const props = {
|
|
198
|
+
...c2.props
|
|
199
|
+
};
|
|
200
|
+
delete props.i18nIsDynamicList;
|
|
201
|
+
return createElement(c2.type, {
|
|
202
|
+
...props,
|
|
203
|
+
key: i3,
|
|
204
|
+
ref: c2.ref
|
|
205
|
+
}, isVoid ? null : inner);
|
|
206
|
+
}));
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
const mapAST = (reactNode, astNode, rootReactNode) => {
|
|
210
|
+
const reactNodes = getAsArray(reactNode);
|
|
211
|
+
const astNodes = getAsArray(astNode);
|
|
212
|
+
return astNodes.reduce((mem, node, i3) => {
|
|
213
|
+
const translationContent = node.children?.[0]?.content && i18n.services.interpolator.interpolate(node.children[0].content, opts, i18n.language);
|
|
214
|
+
if (node.type === "tag") {
|
|
215
|
+
let tmp = reactNodes[parseInt(node.name, 10)];
|
|
216
|
+
if (rootReactNode.length === 1 && !tmp) tmp = rootReactNode[0][node.name];
|
|
217
|
+
if (!tmp) tmp = {};
|
|
218
|
+
const child = Object.keys(node.attrs).length !== 0 ? mergeProps({
|
|
219
|
+
props: node.attrs
|
|
220
|
+
}, tmp) : tmp;
|
|
221
|
+
const isElement = isValidElement(child);
|
|
222
|
+
const isValidTranslationWithChildren = isElement && hasChildren(node, true) && !node.voidElement;
|
|
223
|
+
const isEmptyTransWithHTML = emptyChildrenButNeedsHandling && isObject(child) && child.dummy && !isElement;
|
|
224
|
+
const isKnownComponent = isObject(children) && Object.hasOwnProperty.call(children, node.name);
|
|
225
|
+
if (isString(child)) {
|
|
226
|
+
const value = i18n.services.interpolator.interpolate(child, opts, i18n.language);
|
|
227
|
+
mem.push(value);
|
|
228
|
+
} else if (hasChildren(child) || isValidTranslationWithChildren) {
|
|
229
|
+
const inner = renderInner(child, node, rootReactNode);
|
|
230
|
+
pushTranslatedJSX(child, inner, mem, i3);
|
|
231
|
+
} else if (isEmptyTransWithHTML) {
|
|
232
|
+
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
233
|
+
pushTranslatedJSX(child, inner, mem, i3);
|
|
234
|
+
} else if (Number.isNaN(parseFloat(node.name))) {
|
|
235
|
+
if (isKnownComponent) {
|
|
236
|
+
const inner = renderInner(child, node, rootReactNode);
|
|
237
|
+
pushTranslatedJSX(child, inner, mem, i3, node.voidElement);
|
|
238
|
+
} else if (i18nOptions.transSupportBasicHtmlNodes && keepArray.indexOf(node.name) > -1) {
|
|
239
|
+
if (node.voidElement) {
|
|
240
|
+
mem.push(createElement(node.name, {
|
|
241
|
+
key: `${node.name}-${i3}`
|
|
242
|
+
}));
|
|
243
|
+
} else {
|
|
244
|
+
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
245
|
+
mem.push(createElement(node.name, {
|
|
246
|
+
key: `${node.name}-${i3}`
|
|
247
|
+
}, inner));
|
|
248
|
+
}
|
|
249
|
+
} else if (node.voidElement) {
|
|
250
|
+
mem.push(`<${node.name} />`);
|
|
251
|
+
} else {
|
|
252
|
+
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
253
|
+
mem.push(`<${node.name}>${inner}</${node.name}>`);
|
|
254
|
+
}
|
|
255
|
+
} else if (isObject(child) && !isElement) {
|
|
256
|
+
const content = node.children[0] ? translationContent : null;
|
|
257
|
+
if (content) mem.push(content);
|
|
258
|
+
} else {
|
|
259
|
+
pushTranslatedJSX(child, translationContent, mem, i3, node.children.length !== 1 || !translationContent);
|
|
260
|
+
}
|
|
261
|
+
} else if (node.type === "text") {
|
|
262
|
+
const wrapTextNodes = i18nOptions.transWrapTextNodes;
|
|
263
|
+
const content = shouldUnescape ? i18nOptions.unescape(i18n.services.interpolator.interpolate(node.content, opts, i18n.language)) : i18n.services.interpolator.interpolate(node.content, opts, i18n.language);
|
|
264
|
+
if (wrapTextNodes) {
|
|
265
|
+
mem.push(createElement(wrapTextNodes, {
|
|
266
|
+
key: `${node.name}-${i3}`
|
|
267
|
+
}, content));
|
|
268
|
+
} else {
|
|
269
|
+
mem.push(content);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return mem;
|
|
273
|
+
}, []);
|
|
274
|
+
};
|
|
275
|
+
const result = mapAST([{
|
|
276
|
+
dummy: true,
|
|
277
|
+
children: children || []
|
|
278
|
+
}], ast, getAsArray(children || []));
|
|
279
|
+
return getChildren(result[0]);
|
|
280
|
+
};
|
|
281
|
+
const fixComponentProps = (component, index, translation) => {
|
|
282
|
+
const componentKey = component.key || index;
|
|
283
|
+
const comp = cloneElement(component, {
|
|
284
|
+
key: componentKey
|
|
285
|
+
});
|
|
286
|
+
if (!comp.props || !comp.props.children || translation.indexOf(`${index}/>`) < 0 && translation.indexOf(`${index} />`) < 0) {
|
|
287
|
+
return comp;
|
|
288
|
+
}
|
|
289
|
+
function Componentized() {
|
|
290
|
+
return createElement(Fragment, null, comp);
|
|
291
|
+
}
|
|
292
|
+
return createElement(Componentized);
|
|
293
|
+
};
|
|
294
|
+
const generateArrayComponents = (components, translation) => components.map((c2, index) => fixComponentProps(c2, index, translation));
|
|
295
|
+
const generateObjectComponents = (components, translation) => {
|
|
296
|
+
const componentMap = {};
|
|
297
|
+
Object.keys(components).forEach((c2) => {
|
|
298
|
+
Object.assign(componentMap, {
|
|
299
|
+
[c2]: fixComponentProps(components[c2], c2, translation)
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
return componentMap;
|
|
303
|
+
};
|
|
304
|
+
const generateComponents = (components, translation, i18n, i18nKey) => {
|
|
305
|
+
if (!components) return null;
|
|
306
|
+
if (Array.isArray(components)) {
|
|
307
|
+
return generateArrayComponents(components, translation);
|
|
308
|
+
}
|
|
309
|
+
if (isObject(components)) {
|
|
310
|
+
return generateObjectComponents(components, translation);
|
|
311
|
+
}
|
|
312
|
+
warnOnce(i18n, "TRANS_INVALID_COMPONENTS", `<Trans /> "components" prop expects an object or array`, {
|
|
313
|
+
i18nKey
|
|
314
|
+
});
|
|
315
|
+
return null;
|
|
316
|
+
};
|
|
317
|
+
function Trans$1({
|
|
318
|
+
children,
|
|
319
|
+
count,
|
|
320
|
+
parent,
|
|
321
|
+
i18nKey,
|
|
322
|
+
context,
|
|
323
|
+
tOptions = {},
|
|
324
|
+
values,
|
|
325
|
+
defaults,
|
|
326
|
+
components,
|
|
327
|
+
ns,
|
|
328
|
+
i18n: i18nFromProps,
|
|
329
|
+
t: tFromProps,
|
|
330
|
+
shouldUnescape,
|
|
331
|
+
...additionalProps
|
|
332
|
+
}) {
|
|
333
|
+
const i18n = i18nFromProps || getI18n();
|
|
334
|
+
if (!i18n) {
|
|
335
|
+
warnOnce(i18n, "NO_I18NEXT_INSTANCE", `Trans: You need to pass in an i18next instance using i18nextReactModule`, {
|
|
336
|
+
i18nKey
|
|
337
|
+
});
|
|
338
|
+
return children;
|
|
339
|
+
}
|
|
340
|
+
const t2 = tFromProps || i18n.t.bind(i18n) || ((k) => k);
|
|
341
|
+
const reactI18nextOptions = {
|
|
342
|
+
...getDefaults(),
|
|
343
|
+
...i18n.options?.react
|
|
344
|
+
};
|
|
345
|
+
let namespaces = ns || t2.ns || i18n.options?.defaultNS;
|
|
346
|
+
namespaces = isString(namespaces) ? [namespaces] : namespaces || ["translation"];
|
|
347
|
+
const nodeAsString = nodesToString(children, reactI18nextOptions, i18n, i18nKey);
|
|
348
|
+
const defaultValue = defaults || nodeAsString || reactI18nextOptions.transEmptyNodeValue || i18nKey;
|
|
349
|
+
const {
|
|
350
|
+
hashTransKey
|
|
351
|
+
} = reactI18nextOptions;
|
|
352
|
+
const key = i18nKey || (hashTransKey ? hashTransKey(nodeAsString || defaultValue) : nodeAsString || defaultValue);
|
|
353
|
+
if (i18n.options?.interpolation?.defaultVariables) {
|
|
354
|
+
values = values && Object.keys(values).length > 0 ? {
|
|
355
|
+
...values,
|
|
356
|
+
...i18n.options.interpolation.defaultVariables
|
|
357
|
+
} : {
|
|
358
|
+
...i18n.options.interpolation.defaultVariables
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
const interpolationOverride = values || count !== void 0 && !i18n.options?.interpolation?.alwaysFormat || !children ? tOptions.interpolation : {
|
|
362
|
+
interpolation: {
|
|
363
|
+
...tOptions.interpolation,
|
|
364
|
+
prefix: "#$?",
|
|
365
|
+
suffix: "?$#"
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
const combinedTOpts = {
|
|
369
|
+
...tOptions,
|
|
370
|
+
context: context || tOptions.context,
|
|
371
|
+
count,
|
|
372
|
+
...values,
|
|
373
|
+
...interpolationOverride,
|
|
374
|
+
defaultValue,
|
|
375
|
+
ns: namespaces
|
|
376
|
+
};
|
|
377
|
+
const translation = key ? t2(key, combinedTOpts) : defaultValue;
|
|
378
|
+
const generatedComponents = generateComponents(components, translation, i18n, i18nKey);
|
|
379
|
+
const content = renderNodes(generatedComponents || children, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape);
|
|
380
|
+
const useAsParent = parent ?? reactI18nextOptions.defaultTransParent;
|
|
381
|
+
return useAsParent ? createElement(useAsParent, additionalProps, content) : content;
|
|
382
|
+
}
|
|
383
|
+
function Trans({
|
|
384
|
+
children,
|
|
385
|
+
count,
|
|
386
|
+
parent,
|
|
387
|
+
i18nKey,
|
|
388
|
+
context,
|
|
389
|
+
tOptions = {},
|
|
390
|
+
values,
|
|
391
|
+
defaults,
|
|
392
|
+
components,
|
|
393
|
+
ns,
|
|
394
|
+
i18n: i18nFromProps,
|
|
395
|
+
t: tFromProps,
|
|
396
|
+
shouldUnescape,
|
|
397
|
+
...additionalProps
|
|
398
|
+
}) {
|
|
399
|
+
const {
|
|
400
|
+
i18n: i18nFromContext,
|
|
401
|
+
defaultNS: defaultNSFromContext
|
|
402
|
+
} = useContext(I18nContext) || {};
|
|
403
|
+
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
404
|
+
const t2 = tFromProps || i18n?.t.bind(i18n);
|
|
405
|
+
return Trans$1({
|
|
406
|
+
children,
|
|
407
|
+
count,
|
|
408
|
+
parent,
|
|
409
|
+
i18nKey,
|
|
410
|
+
context,
|
|
411
|
+
tOptions,
|
|
412
|
+
values,
|
|
413
|
+
defaults,
|
|
414
|
+
components,
|
|
415
|
+
ns: ns || t2?.ns || defaultNSFromContext || i18n?.options?.defaultNS,
|
|
416
|
+
i18n,
|
|
417
|
+
t: tFromProps,
|
|
418
|
+
shouldUnescape,
|
|
419
|
+
...additionalProps
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
export {
|
|
423
|
+
I18nContext,
|
|
424
|
+
Trans,
|
|
425
|
+
Trans$1 as TransWithoutContext,
|
|
426
|
+
getDefaults,
|
|
427
|
+
getI18n,
|
|
428
|
+
i as initReactI18next,
|
|
429
|
+
s as setDefaults,
|
|
430
|
+
b as setI18n,
|
|
431
|
+
u as useTranslation
|
|
432
|
+
};
|
|
@@ -2554,13 +2554,129 @@ const index = {
|
|
|
2554
2554
|
return Promise.all(
|
|
2555
2555
|
locales.map(async (locale) => {
|
|
2556
2556
|
try {
|
|
2557
|
-
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-
|
|
2557
|
+
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-RX915msK.mjs"), "./translations/fr.json": () => import("./fr-hkSxFuzl.mjs") }), `./translations/${locale}.json`, 3);
|
|
2558
2558
|
return { data, locale };
|
|
2559
2559
|
} catch {
|
|
2560
2560
|
return { data: {}, locale };
|
|
2561
2561
|
}
|
|
2562
2562
|
})
|
|
2563
2563
|
);
|
|
2564
|
+
},
|
|
2565
|
+
async bootstrap(app) {
|
|
2566
|
+
try {
|
|
2567
|
+
const contentManagerPlugin = app.getPlugin("content-manager");
|
|
2568
|
+
if (contentManagerPlugin?.apis?.addEditViewSidePanel) {
|
|
2569
|
+
const { default: LocalazyPanel } = await import("./LocalazyPanel-CuvdSJYx.mjs");
|
|
2570
|
+
const apis = contentManagerPlugin.apis;
|
|
2571
|
+
apis.addEditViewSidePanel([LocalazyPanel]);
|
|
2572
|
+
} else {
|
|
2573
|
+
console.warn('Localazy Plugin: Content Manager "addEditViewSidePanel" API not available');
|
|
2574
|
+
}
|
|
2575
|
+
const { default: LocalazyStatusColumn } = await import("./LocalazyStatusColumn-955GpXAv.mjs");
|
|
2576
|
+
app.registerHook("Admin/CM/pages/ListView/inject-column-in-table", (params) => {
|
|
2577
|
+
try {
|
|
2578
|
+
console.log("Localazy: Hook called with params:", params);
|
|
2579
|
+
const { displayedHeaders, layout } = params;
|
|
2580
|
+
if (!Array.isArray(displayedHeaders)) {
|
|
2581
|
+
return params;
|
|
2582
|
+
}
|
|
2583
|
+
const localazyStatusColumn = {
|
|
2584
|
+
name: "localazy_status",
|
|
2585
|
+
label: "Localazy Status",
|
|
2586
|
+
searchable: false,
|
|
2587
|
+
sortable: false,
|
|
2588
|
+
attribute: { type: "custom" },
|
|
2589
|
+
cellFormatter: (data, header, context) => {
|
|
2590
|
+
return React__default.createElement(LocalazyStatusColumn, {
|
|
2591
|
+
data,
|
|
2592
|
+
model: context?.model || ""
|
|
2593
|
+
});
|
|
2594
|
+
}
|
|
2595
|
+
};
|
|
2596
|
+
const updatedHeaders = [...displayedHeaders, localazyStatusColumn];
|
|
2597
|
+
return {
|
|
2598
|
+
displayedHeaders: updatedHeaders,
|
|
2599
|
+
layout
|
|
2600
|
+
};
|
|
2601
|
+
} catch (error) {
|
|
2602
|
+
console.error("Localazy: Error in hook:", error);
|
|
2603
|
+
return params;
|
|
2604
|
+
}
|
|
2605
|
+
});
|
|
2606
|
+
if (contentManagerPlugin?.apis?.addBulkAction) {
|
|
2607
|
+
const { useNotification } = await import("@strapi/strapi/admin");
|
|
2608
|
+
await import("./i18n-RoETLXdU.mjs");
|
|
2609
|
+
const { useTranslation } = await import("./index-BIbKC7-V.mjs");
|
|
2610
|
+
const ExcludeFromTranslationAction = (props) => {
|
|
2611
|
+
const { documents, model } = props;
|
|
2612
|
+
const { toggleNotification } = useNotification();
|
|
2613
|
+
const { t } = useTranslation();
|
|
2614
|
+
return {
|
|
2615
|
+
label: t("plugin_settings.bulk_action_exclude_from_translation"),
|
|
2616
|
+
variant: "secondary",
|
|
2617
|
+
onClick: async () => {
|
|
2618
|
+
try {
|
|
2619
|
+
toggleNotification({
|
|
2620
|
+
type: "info",
|
|
2621
|
+
message: t("plugin_settings.bulk_action_updating_entries")
|
|
2622
|
+
});
|
|
2623
|
+
const { default: EntryExclusionService } = await import("./entry-exclusion-service-BlyFqyBY.mjs");
|
|
2624
|
+
const documentIds = documents.map((doc) => doc.documentId);
|
|
2625
|
+
await EntryExclusionService.setMultipleEntriesExclusion(model, documentIds, true);
|
|
2626
|
+
toggleNotification({
|
|
2627
|
+
type: "success",
|
|
2628
|
+
message: t("plugin_settings.bulk_action_success_message"),
|
|
2629
|
+
timeout: 5e3
|
|
2630
|
+
});
|
|
2631
|
+
} catch (error) {
|
|
2632
|
+
console.error("Failed to exclude entries from translation:", error);
|
|
2633
|
+
toggleNotification({
|
|
2634
|
+
type: "danger",
|
|
2635
|
+
message: t("plugin_settings.bulk_action_failed_message")
|
|
2636
|
+
});
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
};
|
|
2640
|
+
};
|
|
2641
|
+
ExcludeFromTranslationAction.type = "exclude-translation";
|
|
2642
|
+
const IncludeToTranslationAction = ({ documents, model }) => {
|
|
2643
|
+
const { toggleNotification } = useNotification();
|
|
2644
|
+
const { t } = useTranslation();
|
|
2645
|
+
return {
|
|
2646
|
+
label: t("plugin_settings.bulk_action_include_to_translation"),
|
|
2647
|
+
variant: "secondary",
|
|
2648
|
+
onClick: async () => {
|
|
2649
|
+
try {
|
|
2650
|
+
toggleNotification({
|
|
2651
|
+
type: "info",
|
|
2652
|
+
message: t("plugin_settings.bulk_action_updating_entries")
|
|
2653
|
+
});
|
|
2654
|
+
const { default: EntryExclusionService } = await import("./entry-exclusion-service-BlyFqyBY.mjs");
|
|
2655
|
+
const documentIds = documents.map((doc) => doc.documentId);
|
|
2656
|
+
await EntryExclusionService.setMultipleEntriesExclusion(model, documentIds, false);
|
|
2657
|
+
toggleNotification({
|
|
2658
|
+
type: "success",
|
|
2659
|
+
message: t("plugin_settings.bulk_action_success_message"),
|
|
2660
|
+
timeout: 5e3
|
|
2661
|
+
});
|
|
2662
|
+
} catch (error) {
|
|
2663
|
+
console.error("Failed to include entries to translation:", error);
|
|
2664
|
+
toggleNotification({
|
|
2665
|
+
type: "danger",
|
|
2666
|
+
message: t("plugin_settings.bulk_action_failed_message")
|
|
2667
|
+
});
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
};
|
|
2671
|
+
};
|
|
2672
|
+
IncludeToTranslationAction.type = "include-translation";
|
|
2673
|
+
contentManagerPlugin.apis.addBulkAction([ExcludeFromTranslationAction, IncludeToTranslationAction]);
|
|
2674
|
+
} else {
|
|
2675
|
+
console.warn('Localazy Plugin: Content Manager "addBulkAction" API not available');
|
|
2676
|
+
}
|
|
2677
|
+
} catch (error) {
|
|
2678
|
+
console.error("Localazy Plugin: Error adding side panel:", error);
|
|
2679
|
+
}
|
|
2564
2680
|
}
|
|
2565
2681
|
};
|
|
2566
2682
|
const addMenuLink = (app) => {
|
|
@@ -2572,7 +2688,7 @@ const addMenuLink = (app) => {
|
|
|
2572
2688
|
defaultMessage: getTranslation("name")
|
|
2573
2689
|
},
|
|
2574
2690
|
Component: async () => {
|
|
2575
|
-
const { App } = await import("./App-
|
|
2691
|
+
const { App } = await import("./App-C0ogWaOz.mjs");
|
|
2576
2692
|
const { LocalazyIdentityProvider: LocalazyIdentityProvider2 } = await Promise.resolve().then(() => localazyIdentity);
|
|
2577
2693
|
const WrappedApp = () => React__default.createElement(LocalazyIdentityProvider2, {
|
|
2578
2694
|
children: React__default.createElement(React__default.Fragment, {}, [
|
|
@@ -2603,7 +2719,7 @@ const addSettingsSection = (app) => {
|
|
|
2603
2719
|
},
|
|
2604
2720
|
to: `/settings/${PLUGIN_ID}/global-settings`,
|
|
2605
2721
|
Component: async () => {
|
|
2606
|
-
const { GlobalSettings } = await import("./GlobalSettings-
|
|
2722
|
+
const { GlobalSettings } = await import("./GlobalSettings-B_h5sPwa.mjs");
|
|
2607
2723
|
const { LocalazyIdentityProvider: LocalazyIdentityProvider2 } = await Promise.resolve().then(() => localazyIdentity);
|
|
2608
2724
|
const WrappedGlobalSettings = () => React__default.createElement(LocalazyIdentityProvider2, { children: React__default.createElement(GlobalSettings, {}) });
|
|
2609
2725
|
return WrappedGlobalSettings;
|
|
@@ -2619,7 +2735,7 @@ const addSettingsSection = (app) => {
|
|
|
2619
2735
|
},
|
|
2620
2736
|
to: `/settings/${PLUGIN_ID}/content-transfer-setup`,
|
|
2621
2737
|
Component: async () => {
|
|
2622
|
-
const { ContentTransferSetup } = await import("./ContentTransferSetup-
|
|
2738
|
+
const { ContentTransferSetup } = await import("./ContentTransferSetup-ClR8Nwv2.mjs");
|
|
2623
2739
|
const { LocalazyIdentityProvider: LocalazyIdentityProvider2 } = await Promise.resolve().then(() => localazyIdentity);
|
|
2624
2740
|
const WrappedContentTransferSetup = () => React__default.createElement(LocalazyIdentityProvider2, {
|
|
2625
2741
|
children: React__default.createElement(React__default.Fragment, {}, [
|