@strapi/i18n 0.0.0-experimental.f6c00790e260ea5a9b6b86abac5fea02b05d569c → 0.0.0-experimental.f736daceb203b33d9ed36a1149e21f2814d1935c
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-BjxjwEOb.mjs → SettingsPage-B-KzAqT3.mjs} +4 -4
- package/dist/_chunks/SettingsPage-B-KzAqT3.mjs.map +1 -0
- package/dist/_chunks/{SettingsPage-CfTmCkup.js → SettingsPage-hyOi94O9.js} +5 -6
- package/dist/_chunks/SettingsPage-hyOi94O9.js.map +1 -0
- package/dist/_chunks/{de-DtWiGdHl.js → de-BOhNX_-5.js} +1 -2
- package/dist/_chunks/de-BOhNX_-5.js.map +1 -0
- package/dist/_chunks/{de-9eCAqqrB.mjs → de-D80IRBP9.mjs} +1 -2
- package/dist/_chunks/de-D80IRBP9.mjs.map +1 -0
- package/dist/_chunks/{dk-2qBjxt-P.mjs → dk-CJ6Zzz78.mjs} +1 -2
- package/dist/_chunks/dk-CJ6Zzz78.mjs.map +1 -0
- package/dist/_chunks/{dk-D8C-casx.js → dk-cjXm0p3m.js} +1 -2
- package/dist/_chunks/dk-cjXm0p3m.js.map +1 -0
- package/dist/_chunks/{en-2xztdZE1.mjs → en-BTyF7WVW.mjs} +5 -5
- package/dist/_chunks/en-BTyF7WVW.mjs.map +1 -0
- package/dist/_chunks/{en-DWpfm8h5.js → en-UlC0jh2t.js} +5 -5
- package/dist/_chunks/en-UlC0jh2t.js.map +1 -0
- package/dist/_chunks/{es-DlmMVaBG.mjs → es-V8WnPN7w.mjs} +1 -2
- package/dist/_chunks/es-V8WnPN7w.mjs.map +1 -0
- package/dist/_chunks/{es-DS-XFGSw.js → es-hr9b_HLp.js} +1 -2
- package/dist/_chunks/es-hr9b_HLp.js.map +1 -0
- package/dist/_chunks/{fr-BTjekDpq.js → fr-BFmBbE0H.js} +1 -2
- package/dist/_chunks/fr-BFmBbE0H.js.map +1 -0
- package/dist/_chunks/{fr-3S6ke71d.mjs → fr-F94noFiV.mjs} +1 -2
- package/dist/_chunks/fr-F94noFiV.mjs.map +1 -0
- package/dist/_chunks/{index-D-qx3tz4.mjs → index-BcYj5jo9.mjs} +114 -89
- package/dist/_chunks/index-BcYj5jo9.mjs.map +1 -0
- package/dist/_chunks/{index-5XLZwzwx.js → index-C8NzsAKp.js} +114 -90
- package/dist/_chunks/index-C8NzsAKp.js.map +1 -0
- package/dist/_chunks/{ko-DmcGUBQ3.js → ko-C40pNQ9b.js} +1 -2
- package/dist/_chunks/ko-C40pNQ9b.js.map +1 -0
- package/dist/_chunks/{ko-qTjQ8IMw.mjs → ko-CF-P3Car.mjs} +1 -2
- package/dist/_chunks/ko-CF-P3Car.mjs.map +1 -0
- package/dist/_chunks/{pl-B67TSHqT.mjs → pl-Dxr9RUmD.mjs} +1 -2
- package/dist/_chunks/pl-Dxr9RUmD.mjs.map +1 -0
- package/dist/_chunks/{pl-Cn5RYonZ.js → pl-JtWBy-JQ.js} +1 -2
- package/dist/_chunks/pl-JtWBy-JQ.js.map +1 -0
- package/dist/_chunks/{ru-hagMa57T.mjs → ru-B-4sVwXN.mjs} +1 -2
- package/dist/_chunks/ru-B-4sVwXN.mjs.map +1 -0
- package/dist/_chunks/{ru-BMBgVL3s.js → ru-COSWt3Nu.js} +1 -2
- package/dist/_chunks/ru-COSWt3Nu.js.map +1 -0
- package/dist/_chunks/{tr-CarUU76c.js → tr-BVj1O5ch.js} +1 -2
- package/dist/_chunks/tr-BVj1O5ch.js.map +1 -0
- package/dist/_chunks/{tr-Dw_jmkG-.mjs → tr-Ccu6Yj11.mjs} +1 -2
- package/dist/_chunks/tr-Ccu6Yj11.mjs.map +1 -0
- package/dist/_chunks/{zh-57YM4amO.mjs → zh-BIz395Ms.mjs} +1 -2
- package/dist/_chunks/zh-BIz395Ms.mjs.map +1 -0
- package/dist/_chunks/{zh-Hans-Dyc-aR-h.mjs → zh-Hans-Bfo6_TCM.mjs} +1 -2
- package/dist/_chunks/zh-Hans-Bfo6_TCM.mjs.map +1 -0
- package/dist/_chunks/{zh-Hans-DSHIXAa3.js → zh-Hans-DIEm_EMC.js} +1 -2
- package/dist/_chunks/zh-Hans-DIEm_EMC.js.map +1 -0
- package/dist/_chunks/{zh-CukOviB0.js → zh-wkBPBkhc.js} +1 -2
- package/dist/_chunks/zh-wkBPBkhc.js.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 +5 -3
- package/dist/admin/src/components/CreateLocale.d.ts +6 -6
- package/dist/admin/src/components/LocaleListCell.d.ts +4 -4
- package/dist/server/index.js +397 -486
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +398 -486
- 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 +7 -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 +6 -8
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/sanitize/index.d.ts +11 -0
- package/dist/server/src/services/sanitize/index.d.ts.map +1 -0
- package/dist/server/src/utils/index.d.ts +2 -2
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/package.json +13 -14
- package/dist/_chunks/SettingsPage-BjxjwEOb.mjs.map +0 -1
- package/dist/_chunks/SettingsPage-CfTmCkup.js.map +0 -1
- package/dist/_chunks/de-9eCAqqrB.mjs.map +0 -1
- package/dist/_chunks/de-DtWiGdHl.js.map +0 -1
- package/dist/_chunks/dk-2qBjxt-P.mjs.map +0 -1
- package/dist/_chunks/dk-D8C-casx.js.map +0 -1
- package/dist/_chunks/en-2xztdZE1.mjs.map +0 -1
- package/dist/_chunks/en-DWpfm8h5.js.map +0 -1
- package/dist/_chunks/es-DS-XFGSw.js.map +0 -1
- package/dist/_chunks/es-DlmMVaBG.mjs.map +0 -1
- package/dist/_chunks/fr-3S6ke71d.mjs.map +0 -1
- package/dist/_chunks/fr-BTjekDpq.js.map +0 -1
- package/dist/_chunks/index-5XLZwzwx.js.map +0 -1
- package/dist/_chunks/index-D-qx3tz4.mjs.map +0 -1
- package/dist/_chunks/ko-DmcGUBQ3.js.map +0 -1
- package/dist/_chunks/ko-qTjQ8IMw.mjs.map +0 -1
- package/dist/_chunks/pl-B67TSHqT.mjs.map +0 -1
- package/dist/_chunks/pl-Cn5RYonZ.js.map +0 -1
- package/dist/_chunks/ru-BMBgVL3s.js.map +0 -1
- package/dist/_chunks/ru-hagMa57T.mjs.map +0 -1
- package/dist/_chunks/tr-CarUU76c.js.map +0 -1
- package/dist/_chunks/tr-Dw_jmkG-.mjs.map +0 -1
- package/dist/_chunks/zh-57YM4amO.mjs.map +0 -1
- package/dist/_chunks/zh-CukOviB0.js.map +0 -1
- package/dist/_chunks/zh-Hans-DSHIXAa3.js.map +0 -1
- package/dist/_chunks/zh-Hans-Dyc-aR-h.mjs.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
@@ -3,7 +3,7 @@ import * as yup from "yup";
|
|
3
3
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
4
4
|
import * as React from "react";
|
5
5
|
import { Typography, Dialog, Field, Checkbox, Flex, Button, Modal, Box, Status, IconButton, Tooltip, SingleSelect, SingleSelectOption, VisuallyHidden, useCollator, Popover } from "@strapi/design-system";
|
6
|
-
import { WarningCircle, Pencil, CrossCircle, CheckCircle, ArrowsCounterClockwise, Trash, Download, ListPlus, Cross, Earth, EarthStriked, CaretDown } from "@strapi/icons";
|
6
|
+
import { WarningCircle, Pencil, CrossCircle, CheckCircle, ArrowsCounterClockwise, Trash, Plus, Download, ListPlus, Cross, Earth, EarthStriked, CaretDown } from "@strapi/icons";
|
7
7
|
import { useIntl } from "react-intl";
|
8
8
|
import { styled } from "styled-components";
|
9
9
|
import { skipToken } from "@reduxjs/toolkit/query";
|
@@ -13,13 +13,20 @@ import { useParams, Link, useNavigate, matchPath } from "react-router-dom";
|
|
13
13
|
import * as qs from "qs";
|
14
14
|
import { stringify } from "qs";
|
15
15
|
import omit from "lodash/omit";
|
16
|
-
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
16
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
17
17
|
const v = glob[path];
|
18
18
|
if (v) {
|
19
19
|
return typeof v === "function" ? v() : Promise.resolve(v);
|
20
20
|
}
|
21
21
|
return new Promise((_, reject) => {
|
22
|
-
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
22
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
23
|
+
reject.bind(
|
24
|
+
null,
|
25
|
+
new Error(
|
26
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
27
|
+
)
|
28
|
+
)
|
29
|
+
);
|
23
30
|
});
|
24
31
|
};
|
25
32
|
const pluginId = "i18n";
|
@@ -228,7 +235,8 @@ const cleanData = (data, schema, components) => {
|
|
228
235
|
"publishedAt",
|
229
236
|
"strapi_stage",
|
230
237
|
"strapi_assignee",
|
231
|
-
"locale"
|
238
|
+
"locale",
|
239
|
+
"status"
|
232
240
|
]);
|
233
241
|
const cleanedDataWithoutPasswordAndRelation = recursiveRemoveFieldTypes(
|
234
242
|
cleanedData,
|
@@ -458,7 +466,6 @@ const BulkLocaleActionModal = ({
|
|
458
466
|
paddingRight: "6px",
|
459
467
|
paddingTop: "2px",
|
460
468
|
paddingBottom: "2px",
|
461
|
-
showBullet: false,
|
462
469
|
size: "S",
|
463
470
|
variant: statusVariant,
|
464
471
|
children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
@@ -490,6 +497,47 @@ const BulkLocaleActionModal = ({
|
|
490
497
|
] }) })
|
491
498
|
] });
|
492
499
|
};
|
500
|
+
const statusVariants = {
|
501
|
+
draft: "secondary",
|
502
|
+
published: "success",
|
503
|
+
modified: "alternative"
|
504
|
+
};
|
505
|
+
const LocaleOption = ({
|
506
|
+
isDraftAndPublishEnabled,
|
507
|
+
locale,
|
508
|
+
status,
|
509
|
+
entryExists
|
510
|
+
}) => {
|
511
|
+
const { formatMessage } = useIntl();
|
512
|
+
if (!entryExists) {
|
513
|
+
return formatMessage(
|
514
|
+
{
|
515
|
+
id: getTranslation("CMEditViewLocalePicker.locale.create"),
|
516
|
+
defaultMessage: "Create <bold>{locale}</bold> locale"
|
517
|
+
},
|
518
|
+
{
|
519
|
+
bold: (locale2) => /* @__PURE__ */ jsx("b", { children: locale2 }),
|
520
|
+
locale: locale.name
|
521
|
+
}
|
522
|
+
);
|
523
|
+
}
|
524
|
+
return /* @__PURE__ */ jsxs(Flex, { width: "100%", gap: 1, justifyContent: "space-between", children: [
|
525
|
+
/* @__PURE__ */ jsx(Typography, { children: locale.name }),
|
526
|
+
isDraftAndPublishEnabled ? /* @__PURE__ */ jsx(
|
527
|
+
Status,
|
528
|
+
{
|
529
|
+
display: "flex",
|
530
|
+
paddingLeft: "6px",
|
531
|
+
paddingRight: "6px",
|
532
|
+
paddingTop: "2px",
|
533
|
+
paddingBottom: "2px",
|
534
|
+
size: "S",
|
535
|
+
variant: statusVariants[status],
|
536
|
+
children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
537
|
+
}
|
538
|
+
) : null
|
539
|
+
] });
|
540
|
+
};
|
493
541
|
const LocalePickerAction = ({
|
494
542
|
document,
|
495
543
|
meta,
|
@@ -531,46 +579,44 @@ const LocalePickerAction = ({
|
|
531
579
|
handleSelect(defaultLocale.code);
|
532
580
|
}
|
533
581
|
}, [handleSelect, hasI18n, locales, currentDesiredLocale]);
|
534
|
-
const currentLocale = Array.isArray(locales) ? locales.find((locale) => locale.code === currentDesiredLocale)
|
582
|
+
const currentLocale = Array.isArray(locales) ? locales.find((locale) => locale.code === currentDesiredLocale) : void 0;
|
535
583
|
const allCurrentLocales = [
|
536
|
-
{ status: getDocumentStatus(document, meta), locale: currentLocale },
|
537
|
-
...
|
584
|
+
{ status: getDocumentStatus(document, meta), locale: currentLocale?.code },
|
585
|
+
...document?.localizations ?? []
|
538
586
|
];
|
539
587
|
if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {
|
540
588
|
return null;
|
541
589
|
}
|
590
|
+
const displayedLocales = locales.filter((locale) => {
|
591
|
+
return canRead.includes(locale.code);
|
592
|
+
});
|
542
593
|
return {
|
543
594
|
label: formatMessage({
|
544
595
|
id: getTranslation("Settings.locales.modal.locales.label"),
|
545
596
|
defaultMessage: "Locales"
|
546
597
|
}),
|
547
|
-
options:
|
598
|
+
options: displayedLocales.map((locale) => {
|
599
|
+
const entryWithLocaleExists = allCurrentLocales.some((doc) => doc.locale === locale.code);
|
548
600
|
const currentLocaleDoc = allCurrentLocales.find(
|
549
601
|
(doc) => "locale" in doc ? doc.locale === locale.code : false
|
550
602
|
);
|
551
|
-
const
|
552
|
-
const permissionsToCheck = currentLocaleDoc ? canCreate : canRead;
|
553
|
-
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
603
|
+
const permissionsToCheck = currentLocaleDoc ? canRead : canCreate;
|
554
604
|
return {
|
555
605
|
disabled: !permissionsToCheck.includes(locale.code),
|
556
606
|
value: locale.code,
|
557
|
-
label:
|
558
|
-
|
559
|
-
Status,
|
607
|
+
label: /* @__PURE__ */ jsx(
|
608
|
+
LocaleOption,
|
560
609
|
{
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
paddingBottom: "2px",
|
566
|
-
showBullet: false,
|
567
|
-
size: "S",
|
568
|
-
variant: statusVariant,
|
569
|
-
children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
610
|
+
isDraftAndPublishEnabled: !!schema?.options?.draftAndPublish,
|
611
|
+
locale,
|
612
|
+
status: currentLocaleDoc?.status,
|
613
|
+
entryExists: entryWithLocaleExists
|
570
614
|
}
|
571
|
-
)
|
615
|
+
),
|
616
|
+
startIcon: !entryWithLocaleExists ? /* @__PURE__ */ jsx(Plus, {}) : null
|
572
617
|
};
|
573
618
|
}),
|
619
|
+
customizeContent: () => currentLocale?.name,
|
574
620
|
onSelect: handleSelect,
|
575
621
|
value: currentLocale
|
576
622
|
};
|
@@ -594,6 +640,7 @@ const FillFromAnotherLocaleAction = ({
|
|
594
640
|
}) => {
|
595
641
|
const { formatMessage } = useIntl();
|
596
642
|
const [{ query }] = useQueryParams();
|
643
|
+
const { hasI18n } = useI18n();
|
597
644
|
const currentDesiredLocale = query.plugins?.i18n?.locale;
|
598
645
|
const [localeSelected, setLocaleSelected] = React.useState(null);
|
599
646
|
const setValues = useForm("FillFromAnotherLocale", (state) => state.setValues);
|
@@ -621,6 +668,9 @@ const FillFromAnotherLocaleAction = ({
|
|
621
668
|
setValues(cleanedData);
|
622
669
|
onClose();
|
623
670
|
};
|
671
|
+
if (!hasI18n) {
|
672
|
+
return null;
|
673
|
+
}
|
624
674
|
return {
|
625
675
|
type: "icon",
|
626
676
|
icon: /* @__PURE__ */ jsx(Download, {}),
|
@@ -686,16 +736,23 @@ const DeleteLocaleAction = ({
|
|
686
736
|
const { toggleNotification } = useNotification();
|
687
737
|
const { delete: deleteAction } = unstable_useDocumentActions();
|
688
738
|
const { hasI18n, canDelete } = useI18n();
|
739
|
+
const [{ query }] = useQueryParams();
|
740
|
+
const { data: locales = [] } = useGetLocalesQuery();
|
741
|
+
const currentDesiredLocale = query.plugins?.i18n?.locale;
|
742
|
+
const locale = !("error" in locales) && locales.find((loc) => loc.code === currentDesiredLocale);
|
689
743
|
if (!hasI18n) {
|
690
744
|
return null;
|
691
745
|
}
|
692
746
|
return {
|
693
747
|
disabled: document?.locale && !canDelete.includes(document.locale) || !document || !document.id,
|
694
748
|
position: ["header", "table-row"],
|
695
|
-
label: formatMessage(
|
696
|
-
|
697
|
-
|
698
|
-
|
749
|
+
label: formatMessage(
|
750
|
+
{
|
751
|
+
id: getTranslation("actions.delete.label"),
|
752
|
+
defaultMessage: "Delete entry ({locale})"
|
753
|
+
},
|
754
|
+
{ locale: locale && locale.name }
|
755
|
+
),
|
699
756
|
icon: /* @__PURE__ */ jsx(StyledTrash, {}),
|
700
757
|
variant: "danger",
|
701
758
|
dialog: {
|
@@ -712,7 +769,12 @@ const DeleteLocaleAction = ({
|
|
712
769
|
}) })
|
713
770
|
] }),
|
714
771
|
onConfirm: async () => {
|
715
|
-
|
772
|
+
const unableToDelete = (
|
773
|
+
// We are unable to delete a collection type without a document ID
|
774
|
+
// & unable to delete generally if there is no document locale
|
775
|
+
collectionType !== "single-types" && !documentId || !document?.locale
|
776
|
+
);
|
777
|
+
if (unableToDelete) {
|
716
778
|
console.error(
|
717
779
|
"You're trying to delete a document without an id or locale, this is likely a bug with Strapi. Please open an issue."
|
718
780
|
);
|
@@ -739,13 +801,13 @@ const DeleteLocaleAction = ({
|
|
739
801
|
};
|
740
802
|
};
|
741
803
|
const BulkLocaleAction = ({
|
742
|
-
document
|
804
|
+
document,
|
743
805
|
documentId,
|
744
806
|
model,
|
745
807
|
collectionType,
|
746
808
|
action
|
747
809
|
}) => {
|
748
|
-
const
|
810
|
+
const locale = document?.locale ?? null;
|
749
811
|
const [{ query }] = useQueryParams();
|
750
812
|
const params = React.useMemo(() => buildValidParams(query), [query]);
|
751
813
|
const isOnPublishedTab = query.status === "published";
|
@@ -756,22 +818,18 @@ const BulkLocaleAction = ({
|
|
756
818
|
const [selectedRows, setSelectedRows] = React.useState([]);
|
757
819
|
const [isDraftRelationConfirmationOpen, setIsDraftRelationConfirmationOpen] = React.useState(false);
|
758
820
|
const { publishMany: publishManyAction, unpublishMany: unpublishManyAction } = unstable_useDocumentActions();
|
759
|
-
const {
|
760
|
-
document,
|
761
|
-
meta: documentMeta,
|
762
|
-
schema,
|
763
|
-
validate
|
764
|
-
} = unstable_useDocument(
|
821
|
+
const { schema, validate } = unstable_useDocument(
|
765
822
|
{
|
766
823
|
model,
|
767
824
|
collectionType,
|
768
825
|
documentId,
|
769
826
|
params: {
|
770
|
-
locale
|
827
|
+
locale
|
771
828
|
}
|
772
829
|
},
|
773
830
|
{
|
774
|
-
|
831
|
+
// No need to fetch the document, the data is already available in the `document` prop
|
832
|
+
skip: true
|
775
833
|
}
|
776
834
|
);
|
777
835
|
const { data: localesMetadata = [] } = useGetLocalesQuery(hasI18n ? void 0 : skipToken);
|
@@ -799,18 +857,19 @@ const BulkLocaleAction = ({
|
|
799
857
|
}
|
800
858
|
];
|
801
859
|
const [rows, validationErrors] = React.useMemo(() => {
|
802
|
-
if (!document
|
860
|
+
if (!document) {
|
803
861
|
return [[], {}];
|
804
862
|
}
|
805
|
-
const
|
806
|
-
|
807
|
-
|
863
|
+
const localizations = document.localizations ?? [];
|
864
|
+
const locales = localizations.map((doc) => {
|
865
|
+
const { locale: locale2, status } = doc;
|
866
|
+
return { locale: locale2, status };
|
808
867
|
});
|
809
|
-
|
868
|
+
locales.unshift({
|
810
869
|
locale: document.locale,
|
811
870
|
status: document.status
|
812
871
|
});
|
813
|
-
const allDocuments = [document, ...
|
872
|
+
const allDocuments = [document, ...localizations];
|
814
873
|
const errors = allDocuments.reduce((errs, document2) => {
|
815
874
|
if (!document2) {
|
816
875
|
return errs;
|
@@ -821,8 +880,8 @@ const BulkLocaleAction = ({
|
|
821
880
|
}
|
822
881
|
return errs;
|
823
882
|
}, {});
|
824
|
-
return [
|
825
|
-
}, [document,
|
883
|
+
return [locales, errors];
|
884
|
+
}, [document, validate]);
|
826
885
|
const isBulkPublish = action === "bulk-publish";
|
827
886
|
const localesForAction = selectedRows.reduce((acc, selectedRow) => {
|
828
887
|
const isValidLocale = (
|
@@ -932,7 +991,7 @@ const BulkLocaleAction = ({
|
|
932
991
|
}
|
933
992
|
};
|
934
993
|
}
|
935
|
-
const hasPermission = selectedRows.map(({ locale }) =>
|
994
|
+
const hasPermission = selectedRows.map(({ locale: locale2 }) => locale2).every((locale2) => canPublish.includes(locale2));
|
936
995
|
return {
|
937
996
|
label: formatMessage({
|
938
997
|
id: getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? "publish" : "unpublish"}-title`),
|
@@ -1175,29 +1234,16 @@ const Span = styled(Flex)`
|
|
1175
1234
|
}
|
1176
1235
|
}
|
1177
1236
|
`;
|
1178
|
-
const LocaleListCell = ({
|
1179
|
-
documentId,
|
1180
|
-
locale: currentLocale,
|
1181
|
-
collectionType,
|
1182
|
-
model
|
1183
|
-
}) => {
|
1184
|
-
const { meta, isLoading } = unstable_useDocument({
|
1185
|
-
documentId,
|
1186
|
-
collectionType,
|
1187
|
-
model,
|
1188
|
-
params: {
|
1189
|
-
locale: currentLocale
|
1190
|
-
}
|
1191
|
-
});
|
1237
|
+
const LocaleListCell = ({ locale: currentLocale, localizations }) => {
|
1192
1238
|
const { locale: language } = useIntl();
|
1193
1239
|
const { data: locales = [] } = useGetLocalesQuery();
|
1194
1240
|
const formatter = useCollator(language, {
|
1195
1241
|
sensitivity: "base"
|
1196
1242
|
});
|
1197
|
-
if (!Array.isArray(locales) ||
|
1243
|
+
if (!Array.isArray(locales) || !localizations) {
|
1198
1244
|
return null;
|
1199
1245
|
}
|
1200
|
-
const availableLocales =
|
1246
|
+
const availableLocales = localizations.map((loc) => loc.locale);
|
1201
1247
|
const localesForDocument = locales.reduce((acc, locale) => {
|
1202
1248
|
const createdLocale = [currentLocale, ...availableLocales].find((loc) => {
|
1203
1249
|
return loc === locale.code;
|
@@ -1345,9 +1391,6 @@ const localeMiddleware = (ctx) => (next) => (permissions) => {
|
|
1345
1391
|
return next(revisedPermissions);
|
1346
1392
|
};
|
1347
1393
|
const prefixPluginTranslations = (trad, pluginId2) => {
|
1348
|
-
if (!pluginId2) {
|
1349
|
-
throw new TypeError("pluginId can't be empty");
|
1350
|
-
}
|
1351
1394
|
return Object.keys(trad).reduce((acc, current) => {
|
1352
1395
|
acc[`${pluginId2}.${current}`] = trad[current];
|
1353
1396
|
return acc;
|
@@ -1417,7 +1460,7 @@ const index = {
|
|
1417
1460
|
},
|
1418
1461
|
id: "internationalization",
|
1419
1462
|
to: "internationalization",
|
1420
|
-
Component: () => import("./SettingsPage-
|
1463
|
+
Component: () => import("./SettingsPage-B-KzAqT3.mjs").then((mod) => ({ default: mod.ProtectedSettingsPage })),
|
1421
1464
|
permissions: PERMISSIONS.accessMain
|
1422
1465
|
});
|
1423
1466
|
const contentManager = app.getPlugin("content-manager");
|
@@ -1479,24 +1522,6 @@ const index = {
|
|
1479
1522
|
}
|
1480
1523
|
});
|
1481
1524
|
ctbFormsAPI.extendFields(LOCALIZED_FIELDS, {
|
1482
|
-
validator: (args) => ({
|
1483
|
-
i18n: yup.object().shape({
|
1484
|
-
localized: yup.bool().test({
|
1485
|
-
name: "ensure-unique-localization",
|
1486
|
-
message: getTranslation("plugin.schema.i18n.ensure-unique-localization"),
|
1487
|
-
test(value) {
|
1488
|
-
if (value === void 0 || value) {
|
1489
|
-
return true;
|
1490
|
-
}
|
1491
|
-
const unique = get(args, ["3", "modifiedData", "unique"], null);
|
1492
|
-
if (unique && !value) {
|
1493
|
-
return false;
|
1494
|
-
}
|
1495
|
-
return true;
|
1496
|
-
}
|
1497
|
-
})
|
1498
|
-
})
|
1499
|
-
}),
|
1500
1525
|
form: {
|
1501
1526
|
advanced({ contentTypeSchema, forTarget, type, step }) {
|
1502
1527
|
if (forTarget !== "contentType") {
|
@@ -1535,7 +1560,7 @@ const index = {
|
|
1535
1560
|
async registerTrads({ locales }) {
|
1536
1561
|
const importedTrads = await Promise.all(
|
1537
1562
|
locales.map((locale) => {
|
1538
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => import("./de-
|
1563
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => import("./de-D80IRBP9.mjs"), "./translations/dk.json": () => import("./dk-CJ6Zzz78.mjs"), "./translations/en.json": () => import("./en-BTyF7WVW.mjs"), "./translations/es.json": () => import("./es-V8WnPN7w.mjs"), "./translations/fr.json": () => import("./fr-F94noFiV.mjs"), "./translations/ko.json": () => import("./ko-CF-P3Car.mjs"), "./translations/pl.json": () => import("./pl-Dxr9RUmD.mjs"), "./translations/ru.json": () => import("./ru-B-4sVwXN.mjs"), "./translations/tr.json": () => import("./tr-Ccu6Yj11.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-Bfo6_TCM.mjs"), "./translations/zh.json": () => import("./zh-BIz395Ms.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
|
1539
1564
|
return {
|
1540
1565
|
data: prefixPluginTranslations(data, pluginId),
|
1541
1566
|
locale
|
@@ -1561,4 +1586,4 @@ export {
|
|
1561
1586
|
index as i,
|
1562
1587
|
useCreateLocaleMutation as u
|
1563
1588
|
};
|
1564
|
-
//# sourceMappingURL=index-
|
1589
|
+
//# sourceMappingURL=index-BcYj5jo9.mjs.map
|