@strapi/i18n 0.0.0-experimental.145e7d7ddefd1aef71aaf3d9bb86440d013035bf → 0.0.0-experimental.1610404a03d98b65f497f9adda35815021b8fd76
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/{SettingsPage-CPNFX0bZ.mjs → SettingsPage-BWEhlJzY.mjs} +4 -4
- package/dist/_chunks/SettingsPage-BWEhlJzY.mjs.map +1 -0
- package/dist/_chunks/{SettingsPage-C-1h_H38.js → SettingsPage-DqW7hbxl.js} +5 -6
- package/dist/_chunks/SettingsPage-DqW7hbxl.js.map +1 -0
- package/dist/_chunks/{en-CwI88-PP.js → en-BKBz3tro.js} +10 -4
- package/dist/_chunks/en-BKBz3tro.js.map +1 -0
- package/dist/_chunks/{en-CtekP_47.mjs → en-DlXfy6Gy.mjs} +10 -4
- package/dist/_chunks/en-DlXfy6Gy.mjs.map +1 -0
- package/dist/_chunks/{index-jpk39Rxo.js → index-93hDLj9o.js} +267 -41
- package/dist/_chunks/index-93hDLj9o.js.map +1 -0
- package/dist/_chunks/{index-CgjpU2bY.mjs → index-C6Fyjx-i.mjs} +269 -42
- package/dist/_chunks/index-C6Fyjx-i.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/CMHeaderActions.d.ts +28 -3
- package/dist/admin/src/components/CreateLocale.d.ts +6 -6
- package/dist/admin/src/utils/clean.d.ts +4 -0
- package/dist/server/index.js +368 -488
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +368 -487
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts +1 -4
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +1 -11
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +0 -8
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts +0 -2
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/package.json +10 -10
- package/dist/_chunks/SettingsPage-C-1h_H38.js.map +0 -1
- package/dist/_chunks/SettingsPage-CPNFX0bZ.mjs.map +0 -1
- package/dist/_chunks/en-CtekP_47.mjs.map +0 -1
- package/dist/_chunks/en-CwI88-PP.js.map +0 -1
- package/dist/_chunks/index-CgjpU2bY.mjs.map +0 -1
- package/dist/_chunks/index-jpk39Rxo.js.map +0 -1
- package/dist/server/src/migrations/content-type/disable/index.d.ts +0 -3
- package/dist/server/src/migrations/content-type/disable/index.d.ts.map +0 -1
- package/dist/server/src/migrations/content-type/enable/index.d.ts +0 -3
- package/dist/server/src/migrations/content-type/enable/index.d.ts.map +0 -1
- package/dist/server/src/services/entity-service-decorator.d.ts +0 -29
- package/dist/server/src/services/entity-service-decorator.d.ts.map +0 -1
- package/strapi-server.js +0 -3
@@ -15,8 +15,7 @@ const qs = require("qs");
|
|
15
15
|
const omit = require("lodash/omit");
|
16
16
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
17
17
|
function _interopNamespace(e) {
|
18
|
-
if (e && e.__esModule)
|
19
|
-
return e;
|
18
|
+
if (e && e.__esModule) return e;
|
20
19
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
21
20
|
if (e) {
|
22
21
|
for (const k in e) {
|
@@ -37,13 +36,20 @@ const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
37
36
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
38
37
|
const qs__namespace = /* @__PURE__ */ _interopNamespace(qs);
|
39
38
|
const omit__default = /* @__PURE__ */ _interopDefault(omit);
|
40
|
-
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
39
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
41
40
|
const v = glob[path];
|
42
41
|
if (v) {
|
43
42
|
return typeof v === "function" ? v() : Promise.resolve(v);
|
44
43
|
}
|
45
44
|
return new Promise((_, reject) => {
|
46
|
-
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
45
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
46
|
+
reject.bind(
|
47
|
+
null,
|
48
|
+
new Error(
|
49
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
50
|
+
)
|
51
|
+
)
|
52
|
+
);
|
47
53
|
});
|
48
54
|
};
|
49
55
|
const pluginId = "i18n";
|
@@ -241,6 +247,86 @@ const relationsApi = i18nApi.injectEndpoints({
|
|
241
247
|
})
|
242
248
|
});
|
243
249
|
const { useGetManyDraftRelationCountQuery } = relationsApi;
|
250
|
+
const cleanData = (data, schema, components) => {
|
251
|
+
const cleanedData = removeFields(data, [
|
252
|
+
"createdAt",
|
253
|
+
"createdBy",
|
254
|
+
"updatedAt",
|
255
|
+
"updatedBy",
|
256
|
+
"id",
|
257
|
+
"documentId",
|
258
|
+
"publishedAt",
|
259
|
+
"strapi_stage",
|
260
|
+
"strapi_assignee",
|
261
|
+
"locale",
|
262
|
+
"status"
|
263
|
+
]);
|
264
|
+
const cleanedDataWithoutPasswordAndRelation = recursiveRemoveFieldTypes(
|
265
|
+
cleanedData,
|
266
|
+
schema,
|
267
|
+
components,
|
268
|
+
["relation", "password"]
|
269
|
+
);
|
270
|
+
return cleanedDataWithoutPasswordAndRelation;
|
271
|
+
};
|
272
|
+
const removeFields = (data, fields) => {
|
273
|
+
return Object.keys(data).reduce((acc, current) => {
|
274
|
+
if (fields.includes(current)) {
|
275
|
+
return acc;
|
276
|
+
}
|
277
|
+
acc[current] = data[current];
|
278
|
+
return acc;
|
279
|
+
}, {});
|
280
|
+
};
|
281
|
+
const recursiveRemoveFieldTypes = (data, schema, components, fields) => {
|
282
|
+
return Object.keys(data).reduce((acc, current) => {
|
283
|
+
const attribute = schema.attributes[current] ?? { type: void 0 };
|
284
|
+
if (fields.includes(attribute.type)) {
|
285
|
+
return acc;
|
286
|
+
}
|
287
|
+
if (attribute.type === "dynamiczone") {
|
288
|
+
acc[current] = data[current].map((componentValue, index2) => {
|
289
|
+
const { id: _, ...rest } = recursiveRemoveFieldTypes(
|
290
|
+
componentValue,
|
291
|
+
components[componentValue.__component],
|
292
|
+
components,
|
293
|
+
fields
|
294
|
+
);
|
295
|
+
return {
|
296
|
+
...rest,
|
297
|
+
__temp_key__: index2 + 1
|
298
|
+
};
|
299
|
+
});
|
300
|
+
} else if (attribute.type === "component") {
|
301
|
+
const { repeatable, component } = attribute;
|
302
|
+
if (repeatable) {
|
303
|
+
acc[current] = (data[current] ?? []).map((compoData, index2) => {
|
304
|
+
const { id: _, ...rest } = recursiveRemoveFieldTypes(
|
305
|
+
compoData,
|
306
|
+
components[component],
|
307
|
+
components,
|
308
|
+
fields
|
309
|
+
);
|
310
|
+
return {
|
311
|
+
...rest,
|
312
|
+
__temp_key__: index2 + 1
|
313
|
+
};
|
314
|
+
});
|
315
|
+
} else {
|
316
|
+
const { id: _, ...rest } = recursiveRemoveFieldTypes(
|
317
|
+
data[current] ?? {},
|
318
|
+
components[component],
|
319
|
+
components,
|
320
|
+
fields
|
321
|
+
);
|
322
|
+
acc[current] = rest;
|
323
|
+
}
|
324
|
+
} else {
|
325
|
+
acc[current] = data[current];
|
326
|
+
}
|
327
|
+
return acc;
|
328
|
+
}, {});
|
329
|
+
};
|
244
330
|
const isErrorMessageDescriptor = (object) => {
|
245
331
|
return typeof object === "object" && object !== null && "id" in object && "defaultMessage" in object;
|
246
332
|
};
|
@@ -435,6 +521,48 @@ const BulkLocaleActionModal = ({
|
|
435
521
|
] }) })
|
436
522
|
] });
|
437
523
|
};
|
524
|
+
const statusVariants = {
|
525
|
+
draft: "secondary",
|
526
|
+
published: "success",
|
527
|
+
modified: "alternative"
|
528
|
+
};
|
529
|
+
const LocaleOption = ({
|
530
|
+
isDraftAndPublishEnabled,
|
531
|
+
locale,
|
532
|
+
status,
|
533
|
+
entryExists
|
534
|
+
}) => {
|
535
|
+
const { formatMessage } = reactIntl.useIntl();
|
536
|
+
if (!entryExists) {
|
537
|
+
return formatMessage(
|
538
|
+
{
|
539
|
+
id: getTranslation("CMEditViewLocalePicker.locale.create"),
|
540
|
+
defaultMessage: "Create <bold>{locale}</bold> locale"
|
541
|
+
},
|
542
|
+
{
|
543
|
+
bold: (locale2) => /* @__PURE__ */ jsxRuntime.jsx("b", { children: locale2 }),
|
544
|
+
locale: locale.name
|
545
|
+
}
|
546
|
+
);
|
547
|
+
}
|
548
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", gap: 1, justifyContent: "space-between", children: [
|
549
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: locale.name }),
|
550
|
+
isDraftAndPublishEnabled ? /* @__PURE__ */ jsxRuntime.jsx(
|
551
|
+
designSystem.Status,
|
552
|
+
{
|
553
|
+
display: "flex",
|
554
|
+
paddingLeft: "6px",
|
555
|
+
paddingRight: "6px",
|
556
|
+
paddingTop: "2px",
|
557
|
+
paddingBottom: "2px",
|
558
|
+
showBullet: false,
|
559
|
+
size: "S",
|
560
|
+
variant: statusVariants[status],
|
561
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
562
|
+
}
|
563
|
+
) : null
|
564
|
+
] });
|
565
|
+
};
|
438
566
|
const LocalePickerAction = ({
|
439
567
|
document,
|
440
568
|
meta,
|
@@ -446,7 +574,13 @@ const LocalePickerAction = ({
|
|
446
574
|
const [{ query: query2 }, setQuery] = strapiAdmin.useQueryParams();
|
447
575
|
const { hasI18n, canCreate, canRead } = useI18n();
|
448
576
|
const { data: locales = [] } = useGetLocalesQuery();
|
449
|
-
const
|
577
|
+
const currentDesiredLocale = query2.plugins?.i18n?.locale;
|
578
|
+
const { schema } = strapiAdmin$1.unstable_useDocument({
|
579
|
+
model,
|
580
|
+
collectionType,
|
581
|
+
documentId,
|
582
|
+
params: { locale: currentDesiredLocale }
|
583
|
+
});
|
450
584
|
const handleSelect = React__namespace.useCallback(
|
451
585
|
(value) => {
|
452
586
|
setQuery({
|
@@ -464,53 +598,47 @@ const LocalePickerAction = ({
|
|
464
598
|
if (!Array.isArray(locales) || !hasI18n) {
|
465
599
|
return;
|
466
600
|
}
|
467
|
-
const currentDesiredLocale = query2.plugins?.i18n?.locale;
|
468
601
|
const doesLocaleExist = locales.find((loc) => loc.code === currentDesiredLocale);
|
469
602
|
const defaultLocale = locales.find((locale) => locale.isDefault);
|
470
603
|
if (!doesLocaleExist && defaultLocale?.code) {
|
471
604
|
handleSelect(defaultLocale.code);
|
472
605
|
}
|
473
|
-
}, [handleSelect, hasI18n, locales,
|
474
|
-
|
475
|
-
return null;
|
476
|
-
}
|
477
|
-
const currentLocale = query2.plugins?.i18n?.locale || locales.find((loc) => loc.isDefault)?.code;
|
606
|
+
}, [handleSelect, hasI18n, locales, currentDesiredLocale]);
|
607
|
+
const currentLocale = Array.isArray(locales) ? locales.find((locale) => locale.code === currentDesiredLocale) : void 0;
|
478
608
|
const allCurrentLocales = [
|
479
|
-
{ status: getDocumentStatus(document, meta), locale: currentLocale },
|
609
|
+
{ status: getDocumentStatus(document, meta), locale: currentLocale?.code },
|
480
610
|
...meta?.availableLocales ?? []
|
481
611
|
];
|
612
|
+
if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {
|
613
|
+
return null;
|
614
|
+
}
|
482
615
|
return {
|
483
616
|
label: formatMessage({
|
484
617
|
id: getTranslation("Settings.locales.modal.locales.label"),
|
485
618
|
defaultMessage: "Locales"
|
486
619
|
}),
|
487
620
|
options: locales.map((locale) => {
|
621
|
+
const entryWithLocaleExists = allCurrentLocales.some((doc) => doc.locale === locale.code);
|
488
622
|
const currentLocaleDoc = allCurrentLocales.find(
|
489
623
|
(doc) => "locale" in doc ? doc.locale === locale.code : false
|
490
624
|
);
|
491
|
-
const
|
492
|
-
const permissionsToCheck = currentLocaleDoc ? canCreate : canRead;
|
493
|
-
const statusVariant = status === "draft" ? "primary" : status === "published" ? "success" : "alternative";
|
625
|
+
const permissionsToCheck = currentLocaleDoc ? canRead : canCreate;
|
494
626
|
return {
|
495
627
|
disabled: !permissionsToCheck.includes(locale.code),
|
496
628
|
value: locale.code,
|
497
|
-
label:
|
498
|
-
|
499
|
-
designSystem.Status,
|
629
|
+
label: /* @__PURE__ */ jsxRuntime.jsx(
|
630
|
+
LocaleOption,
|
500
631
|
{
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
paddingBottom: "2px",
|
506
|
-
showBullet: false,
|
507
|
-
size: "S",
|
508
|
-
variant: statusVariant,
|
509
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
632
|
+
isDraftAndPublishEnabled: !!schema?.options?.draftAndPublish,
|
633
|
+
locale,
|
634
|
+
status: currentLocaleDoc?.status,
|
635
|
+
entryExists: entryWithLocaleExists
|
510
636
|
}
|
511
|
-
)
|
637
|
+
),
|
638
|
+
startIcon: !entryWithLocaleExists ? /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}) : null
|
512
639
|
};
|
513
640
|
}),
|
641
|
+
customizeContent: () => currentLocale?.name,
|
514
642
|
onSelect: handleSelect,
|
515
643
|
value: currentLocale
|
516
644
|
};
|
@@ -526,6 +654,95 @@ const getDocumentStatus = (document, meta) => {
|
|
526
654
|
}
|
527
655
|
return docStatus;
|
528
656
|
};
|
657
|
+
const FillFromAnotherLocaleAction = ({
|
658
|
+
documentId,
|
659
|
+
meta,
|
660
|
+
model,
|
661
|
+
collectionType
|
662
|
+
}) => {
|
663
|
+
const { formatMessage } = reactIntl.useIntl();
|
664
|
+
const [{ query: query2 }] = strapiAdmin.useQueryParams();
|
665
|
+
const currentDesiredLocale = query2.plugins?.i18n?.locale;
|
666
|
+
const [localeSelected, setLocaleSelected] = React__namespace.useState(null);
|
667
|
+
const setValues = strapiAdmin.useForm("FillFromAnotherLocale", (state) => state.setValues);
|
668
|
+
const { getDocument } = strapiAdmin$1.unstable_useDocumentActions();
|
669
|
+
const { schema, components } = strapiAdmin$1.unstable_useDocument({
|
670
|
+
model,
|
671
|
+
documentId,
|
672
|
+
collectionType,
|
673
|
+
params: { locale: currentDesiredLocale }
|
674
|
+
});
|
675
|
+
const { data: locales = [] } = useGetLocalesQuery();
|
676
|
+
const availableLocales = Array.isArray(locales) ? locales.filter((locale) => meta?.availableLocales.some((l) => l.locale === locale.code)) : [];
|
677
|
+
const fillFromLocale = (onClose) => async () => {
|
678
|
+
const response = await getDocument({
|
679
|
+
collectionType,
|
680
|
+
model,
|
681
|
+
documentId,
|
682
|
+
params: { locale: localeSelected }
|
683
|
+
});
|
684
|
+
if (!response || !schema) {
|
685
|
+
return;
|
686
|
+
}
|
687
|
+
const { data } = response;
|
688
|
+
const cleanedData = cleanData(data, schema, components);
|
689
|
+
setValues(cleanedData);
|
690
|
+
onClose();
|
691
|
+
};
|
692
|
+
return {
|
693
|
+
type: "icon",
|
694
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Download, {}),
|
695
|
+
disabled: availableLocales.length === 0,
|
696
|
+
label: formatMessage({
|
697
|
+
id: getTranslation("CMEditViewCopyLocale.copy-text"),
|
698
|
+
defaultMessage: "Fill in from another locale"
|
699
|
+
}),
|
700
|
+
dialog: {
|
701
|
+
type: "dialog",
|
702
|
+
title: formatMessage({
|
703
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.title"),
|
704
|
+
defaultMessage: "Confirmation"
|
705
|
+
}),
|
706
|
+
content: ({ onClose }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
707
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 3, children: [
|
708
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.WarningCircle, { width: "24px", height: "24px", fill: "danger600" }),
|
709
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", children: formatMessage({
|
710
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.body"),
|
711
|
+
defaultMessage: "Your current content will be erased and filled by the content of the selected locale:"
|
712
|
+
}) }),
|
713
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { width: "100%", children: [
|
714
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
715
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.field.label"),
|
716
|
+
defaultMessage: "Locale"
|
717
|
+
}) }),
|
718
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
719
|
+
designSystem.SingleSelect,
|
720
|
+
{
|
721
|
+
value: localeSelected,
|
722
|
+
placeholder: formatMessage({
|
723
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.field.placeholder"),
|
724
|
+
defaultMessage: "Select one locale..."
|
725
|
+
}),
|
726
|
+
onChange: (value) => setLocaleSelected(value),
|
727
|
+
children: availableLocales.map((locale) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: locale.code, children: locale.name }, locale.code))
|
728
|
+
}
|
729
|
+
)
|
730
|
+
] })
|
731
|
+
] }) }),
|
732
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, width: "100%", children: [
|
733
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { flex: "auto", variant: "tertiary", onClick: onClose, children: formatMessage({
|
734
|
+
id: getTranslation("CMEditViewCopyLocale.cancel-text"),
|
735
|
+
defaultMessage: "No, cancel"
|
736
|
+
}) }),
|
737
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { flex: "auto", variant: "success", onClick: fillFromLocale(onClose), children: formatMessage({
|
738
|
+
id: getTranslation("CMEditViewCopyLocale.submit-text"),
|
739
|
+
defaultMessage: "Yes, fill in"
|
740
|
+
}) })
|
741
|
+
] }) })
|
742
|
+
] })
|
743
|
+
}
|
744
|
+
};
|
745
|
+
};
|
529
746
|
const DeleteLocaleAction = ({
|
530
747
|
document,
|
531
748
|
documentId,
|
@@ -537,16 +754,23 @@ const DeleteLocaleAction = ({
|
|
537
754
|
const { toggleNotification } = strapiAdmin.useNotification();
|
538
755
|
const { delete: deleteAction } = strapiAdmin$1.unstable_useDocumentActions();
|
539
756
|
const { hasI18n, canDelete } = useI18n();
|
757
|
+
const [{ query: query2 }] = strapiAdmin.useQueryParams();
|
758
|
+
const { data: locales = [] } = useGetLocalesQuery();
|
759
|
+
const currentDesiredLocale = query2.plugins?.i18n?.locale;
|
760
|
+
const locale = !("error" in locales) && locales.find((loc) => loc.code === currentDesiredLocale);
|
540
761
|
if (!hasI18n) {
|
541
762
|
return null;
|
542
763
|
}
|
543
764
|
return {
|
544
765
|
disabled: document?.locale && !canDelete.includes(document.locale) || !document || !document.id,
|
545
766
|
position: ["header", "table-row"],
|
546
|
-
label: formatMessage(
|
547
|
-
|
548
|
-
|
549
|
-
|
767
|
+
label: formatMessage(
|
768
|
+
{
|
769
|
+
id: getTranslation("actions.delete.label"),
|
770
|
+
defaultMessage: "Delete entry ({locale})"
|
771
|
+
},
|
772
|
+
{ locale: locale && locale.name }
|
773
|
+
),
|
550
774
|
icon: /* @__PURE__ */ jsxRuntime.jsx(StyledTrash, {}),
|
551
775
|
variant: "danger",
|
552
776
|
dialog: {
|
@@ -563,7 +787,12 @@ const DeleteLocaleAction = ({
|
|
563
787
|
}) })
|
564
788
|
] }),
|
565
789
|
onConfirm: async () => {
|
566
|
-
|
790
|
+
const unableToDelete = (
|
791
|
+
// We are unable to delete a collection type without a document ID
|
792
|
+
// & unable to delete generally if there is no document locale
|
793
|
+
collectionType !== "single-types" && !documentId || !document?.locale
|
794
|
+
);
|
795
|
+
if (unableToDelete) {
|
567
796
|
console.error(
|
568
797
|
"You're trying to delete a document without an id or locale, this is likely a bug with Strapi. Please open an issue."
|
569
798
|
);
|
@@ -622,7 +851,7 @@ const BulkLocaleAction = ({
|
|
622
851
|
}
|
623
852
|
},
|
624
853
|
{
|
625
|
-
skip: !hasI18n
|
854
|
+
skip: !hasI18n || !baseLocale
|
626
855
|
}
|
627
856
|
);
|
628
857
|
const { data: localesMetadata = [] } = useGetLocalesQuery(hasI18n ? void 0 : query.skipToken);
|
@@ -1196,9 +1425,6 @@ const localeMiddleware = (ctx) => (next) => (permissions) => {
|
|
1196
1425
|
return next(revisedPermissions);
|
1197
1426
|
};
|
1198
1427
|
const prefixPluginTranslations = (trad, pluginId2) => {
|
1199
|
-
if (!pluginId2) {
|
1200
|
-
throw new TypeError("pluginId can't be empty");
|
1201
|
-
}
|
1202
1428
|
return Object.keys(trad).reduce((acc, current) => {
|
1203
1429
|
acc[`${pluginId2}.${current}`] = trad[current];
|
1204
1430
|
return acc;
|
@@ -1268,11 +1494,11 @@ const index = {
|
|
1268
1494
|
},
|
1269
1495
|
id: "internationalization",
|
1270
1496
|
to: "internationalization",
|
1271
|
-
Component: () => Promise.resolve().then(() => require("./SettingsPage-
|
1497
|
+
Component: () => Promise.resolve().then(() => require("./SettingsPage-DqW7hbxl.js")).then((mod) => ({ default: mod.ProtectedSettingsPage })),
|
1272
1498
|
permissions: PERMISSIONS.accessMain
|
1273
1499
|
});
|
1274
1500
|
const contentManager = app.getPlugin("content-manager");
|
1275
|
-
contentManager.apis.addDocumentHeaderAction([LocalePickerAction]);
|
1501
|
+
contentManager.apis.addDocumentHeaderAction([LocalePickerAction, FillFromAnotherLocaleAction]);
|
1276
1502
|
contentManager.apis.addDocumentAction((actions) => {
|
1277
1503
|
const indexOfDeleteAction = actions.findIndex((action) => action.type === "delete");
|
1278
1504
|
actions.splice(indexOfDeleteAction, 0, DeleteLocaleAction);
|
@@ -1386,7 +1612,7 @@ const index = {
|
|
1386
1612
|
async registerTrads({ locales }) {
|
1387
1613
|
const importedTrads = await Promise.all(
|
1388
1614
|
locales.map((locale) => {
|
1389
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-DtWiGdHl.js")), "./translations/dk.json": () => Promise.resolve().then(() => require("./dk-D8C-casx.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-
|
1615
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-DtWiGdHl.js")), "./translations/dk.json": () => Promise.resolve().then(() => require("./dk-D8C-casx.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-BKBz3tro.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-DS-XFGSw.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-BTjekDpq.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-DmcGUBQ3.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-Cn5RYonZ.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BMBgVL3s.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-CarUU76c.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-DSHIXAa3.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CukOviB0.js")) }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
|
1390
1616
|
return {
|
1391
1617
|
data: prefixPluginTranslations(data, pluginId),
|
1392
1618
|
locale
|
@@ -1410,4 +1636,4 @@ exports.useDeleteLocaleMutation = useDeleteLocaleMutation;
|
|
1410
1636
|
exports.useGetDefaultLocalesQuery = useGetDefaultLocalesQuery;
|
1411
1637
|
exports.useGetLocalesQuery = useGetLocalesQuery;
|
1412
1638
|
exports.useUpdateLocaleMutation = useUpdateLocaleMutation;
|
1413
|
-
//# sourceMappingURL=index-
|
1639
|
+
//# sourceMappingURL=index-93hDLj9o.js.map
|