@strapi/i18n 0.0.0-experimental.f6c00790e260ea5a9b6b86abac5fea02b05d569c → 0.0.0-experimental.f6f58027a6338ed795382f2d1c8882158b242361
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
@@ -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";
|
@@ -252,7 +258,8 @@ const cleanData = (data, schema, components) => {
|
|
252
258
|
"publishedAt",
|
253
259
|
"strapi_stage",
|
254
260
|
"strapi_assignee",
|
255
|
-
"locale"
|
261
|
+
"locale",
|
262
|
+
"status"
|
256
263
|
]);
|
257
264
|
const cleanedDataWithoutPasswordAndRelation = recursiveRemoveFieldTypes(
|
258
265
|
cleanedData,
|
@@ -482,7 +489,6 @@ const BulkLocaleActionModal = ({
|
|
482
489
|
paddingRight: "6px",
|
483
490
|
paddingTop: "2px",
|
484
491
|
paddingBottom: "2px",
|
485
|
-
showBullet: false,
|
486
492
|
size: "S",
|
487
493
|
variant: statusVariant,
|
488
494
|
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
@@ -514,6 +520,47 @@ const BulkLocaleActionModal = ({
|
|
514
520
|
] }) })
|
515
521
|
] });
|
516
522
|
};
|
523
|
+
const statusVariants = {
|
524
|
+
draft: "secondary",
|
525
|
+
published: "success",
|
526
|
+
modified: "alternative"
|
527
|
+
};
|
528
|
+
const LocaleOption = ({
|
529
|
+
isDraftAndPublishEnabled,
|
530
|
+
locale,
|
531
|
+
status,
|
532
|
+
entryExists
|
533
|
+
}) => {
|
534
|
+
const { formatMessage } = reactIntl.useIntl();
|
535
|
+
if (!entryExists) {
|
536
|
+
return formatMessage(
|
537
|
+
{
|
538
|
+
id: getTranslation("CMEditViewLocalePicker.locale.create"),
|
539
|
+
defaultMessage: "Create <bold>{locale}</bold> locale"
|
540
|
+
},
|
541
|
+
{
|
542
|
+
bold: (locale2) => /* @__PURE__ */ jsxRuntime.jsx("b", { children: locale2 }),
|
543
|
+
locale: locale.name
|
544
|
+
}
|
545
|
+
);
|
546
|
+
}
|
547
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", gap: 1, justifyContent: "space-between", children: [
|
548
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: locale.name }),
|
549
|
+
isDraftAndPublishEnabled ? /* @__PURE__ */ jsxRuntime.jsx(
|
550
|
+
designSystem.Status,
|
551
|
+
{
|
552
|
+
display: "flex",
|
553
|
+
paddingLeft: "6px",
|
554
|
+
paddingRight: "6px",
|
555
|
+
paddingTop: "2px",
|
556
|
+
paddingBottom: "2px",
|
557
|
+
size: "S",
|
558
|
+
variant: statusVariants[status],
|
559
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
560
|
+
}
|
561
|
+
) : null
|
562
|
+
] });
|
563
|
+
};
|
517
564
|
const LocalePickerAction = ({
|
518
565
|
document,
|
519
566
|
meta,
|
@@ -555,46 +602,44 @@ const LocalePickerAction = ({
|
|
555
602
|
handleSelect(defaultLocale.code);
|
556
603
|
}
|
557
604
|
}, [handleSelect, hasI18n, locales, currentDesiredLocale]);
|
558
|
-
const currentLocale = Array.isArray(locales) ? locales.find((locale) => locale.code === currentDesiredLocale)
|
605
|
+
const currentLocale = Array.isArray(locales) ? locales.find((locale) => locale.code === currentDesiredLocale) : void 0;
|
559
606
|
const allCurrentLocales = [
|
560
|
-
{ status: getDocumentStatus(document, meta), locale: currentLocale },
|
561
|
-
...
|
607
|
+
{ status: getDocumentStatus(document, meta), locale: currentLocale?.code },
|
608
|
+
...document?.localizations ?? []
|
562
609
|
];
|
563
610
|
if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {
|
564
611
|
return null;
|
565
612
|
}
|
613
|
+
const displayedLocales = locales.filter((locale) => {
|
614
|
+
return canRead.includes(locale.code);
|
615
|
+
});
|
566
616
|
return {
|
567
617
|
label: formatMessage({
|
568
618
|
id: getTranslation("Settings.locales.modal.locales.label"),
|
569
619
|
defaultMessage: "Locales"
|
570
620
|
}),
|
571
|
-
options:
|
621
|
+
options: displayedLocales.map((locale) => {
|
622
|
+
const entryWithLocaleExists = allCurrentLocales.some((doc) => doc.locale === locale.code);
|
572
623
|
const currentLocaleDoc = allCurrentLocales.find(
|
573
624
|
(doc) => "locale" in doc ? doc.locale === locale.code : false
|
574
625
|
);
|
575
|
-
const
|
576
|
-
const permissionsToCheck = currentLocaleDoc ? canCreate : canRead;
|
577
|
-
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
626
|
+
const permissionsToCheck = currentLocaleDoc ? canRead : canCreate;
|
578
627
|
return {
|
579
628
|
disabled: !permissionsToCheck.includes(locale.code),
|
580
629
|
value: locale.code,
|
581
|
-
label:
|
582
|
-
|
583
|
-
designSystem.Status,
|
630
|
+
label: /* @__PURE__ */ jsxRuntime.jsx(
|
631
|
+
LocaleOption,
|
584
632
|
{
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
paddingBottom: "2px",
|
590
|
-
showBullet: false,
|
591
|
-
size: "S",
|
592
|
-
variant: statusVariant,
|
593
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
633
|
+
isDraftAndPublishEnabled: !!schema?.options?.draftAndPublish,
|
634
|
+
locale,
|
635
|
+
status: currentLocaleDoc?.status,
|
636
|
+
entryExists: entryWithLocaleExists
|
594
637
|
}
|
595
|
-
)
|
638
|
+
),
|
639
|
+
startIcon: !entryWithLocaleExists ? /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}) : null
|
596
640
|
};
|
597
641
|
}),
|
642
|
+
customizeContent: () => currentLocale?.name,
|
598
643
|
onSelect: handleSelect,
|
599
644
|
value: currentLocale
|
600
645
|
};
|
@@ -618,6 +663,7 @@ const FillFromAnotherLocaleAction = ({
|
|
618
663
|
}) => {
|
619
664
|
const { formatMessage } = reactIntl.useIntl();
|
620
665
|
const [{ query: query2 }] = strapiAdmin.useQueryParams();
|
666
|
+
const { hasI18n } = useI18n();
|
621
667
|
const currentDesiredLocale = query2.plugins?.i18n?.locale;
|
622
668
|
const [localeSelected, setLocaleSelected] = React__namespace.useState(null);
|
623
669
|
const setValues = strapiAdmin.useForm("FillFromAnotherLocale", (state) => state.setValues);
|
@@ -645,6 +691,9 @@ const FillFromAnotherLocaleAction = ({
|
|
645
691
|
setValues(cleanedData);
|
646
692
|
onClose();
|
647
693
|
};
|
694
|
+
if (!hasI18n) {
|
695
|
+
return null;
|
696
|
+
}
|
648
697
|
return {
|
649
698
|
type: "icon",
|
650
699
|
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Download, {}),
|
@@ -710,16 +759,23 @@ const DeleteLocaleAction = ({
|
|
710
759
|
const { toggleNotification } = strapiAdmin.useNotification();
|
711
760
|
const { delete: deleteAction } = strapiAdmin$1.unstable_useDocumentActions();
|
712
761
|
const { hasI18n, canDelete } = useI18n();
|
762
|
+
const [{ query: query2 }] = strapiAdmin.useQueryParams();
|
763
|
+
const { data: locales = [] } = useGetLocalesQuery();
|
764
|
+
const currentDesiredLocale = query2.plugins?.i18n?.locale;
|
765
|
+
const locale = !("error" in locales) && locales.find((loc) => loc.code === currentDesiredLocale);
|
713
766
|
if (!hasI18n) {
|
714
767
|
return null;
|
715
768
|
}
|
716
769
|
return {
|
717
770
|
disabled: document?.locale && !canDelete.includes(document.locale) || !document || !document.id,
|
718
771
|
position: ["header", "table-row"],
|
719
|
-
label: formatMessage(
|
720
|
-
|
721
|
-
|
722
|
-
|
772
|
+
label: formatMessage(
|
773
|
+
{
|
774
|
+
id: getTranslation("actions.delete.label"),
|
775
|
+
defaultMessage: "Delete entry ({locale})"
|
776
|
+
},
|
777
|
+
{ locale: locale && locale.name }
|
778
|
+
),
|
723
779
|
icon: /* @__PURE__ */ jsxRuntime.jsx(StyledTrash, {}),
|
724
780
|
variant: "danger",
|
725
781
|
dialog: {
|
@@ -736,7 +792,12 @@ const DeleteLocaleAction = ({
|
|
736
792
|
}) })
|
737
793
|
] }),
|
738
794
|
onConfirm: async () => {
|
739
|
-
|
795
|
+
const unableToDelete = (
|
796
|
+
// We are unable to delete a collection type without a document ID
|
797
|
+
// & unable to delete generally if there is no document locale
|
798
|
+
collectionType !== "single-types" && !documentId || !document?.locale
|
799
|
+
);
|
800
|
+
if (unableToDelete) {
|
740
801
|
console.error(
|
741
802
|
"You're trying to delete a document without an id or locale, this is likely a bug with Strapi. Please open an issue."
|
742
803
|
);
|
@@ -763,13 +824,13 @@ const DeleteLocaleAction = ({
|
|
763
824
|
};
|
764
825
|
};
|
765
826
|
const BulkLocaleAction = ({
|
766
|
-
document
|
827
|
+
document,
|
767
828
|
documentId,
|
768
829
|
model,
|
769
830
|
collectionType,
|
770
831
|
action
|
771
832
|
}) => {
|
772
|
-
const
|
833
|
+
const locale = document?.locale ?? null;
|
773
834
|
const [{ query: query$1 }] = strapiAdmin.useQueryParams();
|
774
835
|
const params = React__namespace.useMemo(() => strapiAdmin$1.buildValidParams(query$1), [query$1]);
|
775
836
|
const isOnPublishedTab = query$1.status === "published";
|
@@ -780,22 +841,18 @@ const BulkLocaleAction = ({
|
|
780
841
|
const [selectedRows, setSelectedRows] = React__namespace.useState([]);
|
781
842
|
const [isDraftRelationConfirmationOpen, setIsDraftRelationConfirmationOpen] = React__namespace.useState(false);
|
782
843
|
const { publishMany: publishManyAction, unpublishMany: unpublishManyAction } = strapiAdmin$1.unstable_useDocumentActions();
|
783
|
-
const {
|
784
|
-
document,
|
785
|
-
meta: documentMeta,
|
786
|
-
schema,
|
787
|
-
validate
|
788
|
-
} = strapiAdmin$1.unstable_useDocument(
|
844
|
+
const { schema, validate } = strapiAdmin$1.unstable_useDocument(
|
789
845
|
{
|
790
846
|
model,
|
791
847
|
collectionType,
|
792
848
|
documentId,
|
793
849
|
params: {
|
794
|
-
locale
|
850
|
+
locale
|
795
851
|
}
|
796
852
|
},
|
797
853
|
{
|
798
|
-
|
854
|
+
// No need to fetch the document, the data is already available in the `document` prop
|
855
|
+
skip: true
|
799
856
|
}
|
800
857
|
);
|
801
858
|
const { data: localesMetadata = [] } = useGetLocalesQuery(hasI18n ? void 0 : query.skipToken);
|
@@ -823,18 +880,19 @@ const BulkLocaleAction = ({
|
|
823
880
|
}
|
824
881
|
];
|
825
882
|
const [rows, validationErrors] = React__namespace.useMemo(() => {
|
826
|
-
if (!document
|
883
|
+
if (!document) {
|
827
884
|
return [[], {}];
|
828
885
|
}
|
829
|
-
const
|
830
|
-
|
831
|
-
|
886
|
+
const localizations = document.localizations ?? [];
|
887
|
+
const locales = localizations.map((doc) => {
|
888
|
+
const { locale: locale2, status } = doc;
|
889
|
+
return { locale: locale2, status };
|
832
890
|
});
|
833
|
-
|
891
|
+
locales.unshift({
|
834
892
|
locale: document.locale,
|
835
893
|
status: document.status
|
836
894
|
});
|
837
|
-
const allDocuments = [document, ...
|
895
|
+
const allDocuments = [document, ...localizations];
|
838
896
|
const errors = allDocuments.reduce((errs, document2) => {
|
839
897
|
if (!document2) {
|
840
898
|
return errs;
|
@@ -845,8 +903,8 @@ const BulkLocaleAction = ({
|
|
845
903
|
}
|
846
904
|
return errs;
|
847
905
|
}, {});
|
848
|
-
return [
|
849
|
-
}, [document,
|
906
|
+
return [locales, errors];
|
907
|
+
}, [document, validate]);
|
850
908
|
const isBulkPublish = action === "bulk-publish";
|
851
909
|
const localesForAction = selectedRows.reduce((acc, selectedRow) => {
|
852
910
|
const isValidLocale = (
|
@@ -956,7 +1014,7 @@ const BulkLocaleAction = ({
|
|
956
1014
|
}
|
957
1015
|
};
|
958
1016
|
}
|
959
|
-
const hasPermission = selectedRows.map(({ locale }) =>
|
1017
|
+
const hasPermission = selectedRows.map(({ locale: locale2 }) => locale2).every((locale2) => canPublish.includes(locale2));
|
960
1018
|
return {
|
961
1019
|
label: formatMessage({
|
962
1020
|
id: getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? "publish" : "unpublish"}-title`),
|
@@ -1199,29 +1257,16 @@ const Span = styledComponents.styled(designSystem.Flex)`
|
|
1199
1257
|
}
|
1200
1258
|
}
|
1201
1259
|
`;
|
1202
|
-
const LocaleListCell = ({
|
1203
|
-
documentId,
|
1204
|
-
locale: currentLocale,
|
1205
|
-
collectionType,
|
1206
|
-
model
|
1207
|
-
}) => {
|
1208
|
-
const { meta, isLoading } = strapiAdmin$1.unstable_useDocument({
|
1209
|
-
documentId,
|
1210
|
-
collectionType,
|
1211
|
-
model,
|
1212
|
-
params: {
|
1213
|
-
locale: currentLocale
|
1214
|
-
}
|
1215
|
-
});
|
1260
|
+
const LocaleListCell = ({ locale: currentLocale, localizations }) => {
|
1216
1261
|
const { locale: language } = reactIntl.useIntl();
|
1217
1262
|
const { data: locales = [] } = useGetLocalesQuery();
|
1218
1263
|
const formatter = designSystem.useCollator(language, {
|
1219
1264
|
sensitivity: "base"
|
1220
1265
|
});
|
1221
|
-
if (!Array.isArray(locales) ||
|
1266
|
+
if (!Array.isArray(locales) || !localizations) {
|
1222
1267
|
return null;
|
1223
1268
|
}
|
1224
|
-
const availableLocales =
|
1269
|
+
const availableLocales = localizations.map((loc) => loc.locale);
|
1225
1270
|
const localesForDocument = locales.reduce((acc, locale) => {
|
1226
1271
|
const createdLocale = [currentLocale, ...availableLocales].find((loc) => {
|
1227
1272
|
return loc === locale.code;
|
@@ -1369,9 +1414,6 @@ const localeMiddleware = (ctx) => (next) => (permissions) => {
|
|
1369
1414
|
return next(revisedPermissions);
|
1370
1415
|
};
|
1371
1416
|
const prefixPluginTranslations = (trad, pluginId2) => {
|
1372
|
-
if (!pluginId2) {
|
1373
|
-
throw new TypeError("pluginId can't be empty");
|
1374
|
-
}
|
1375
1417
|
return Object.keys(trad).reduce((acc, current) => {
|
1376
1418
|
acc[`${pluginId2}.${current}`] = trad[current];
|
1377
1419
|
return acc;
|
@@ -1441,7 +1483,7 @@ const index = {
|
|
1441
1483
|
},
|
1442
1484
|
id: "internationalization",
|
1443
1485
|
to: "internationalization",
|
1444
|
-
Component: () => Promise.resolve().then(() => require("./SettingsPage-
|
1486
|
+
Component: () => Promise.resolve().then(() => require("./SettingsPage-hyOi94O9.js")).then((mod) => ({ default: mod.ProtectedSettingsPage })),
|
1445
1487
|
permissions: PERMISSIONS.accessMain
|
1446
1488
|
});
|
1447
1489
|
const contentManager = app.getPlugin("content-manager");
|
@@ -1503,24 +1545,6 @@ const index = {
|
|
1503
1545
|
}
|
1504
1546
|
});
|
1505
1547
|
ctbFormsAPI.extendFields(LOCALIZED_FIELDS, {
|
1506
|
-
validator: (args) => ({
|
1507
|
-
i18n: yup__namespace.object().shape({
|
1508
|
-
localized: yup__namespace.bool().test({
|
1509
|
-
name: "ensure-unique-localization",
|
1510
|
-
message: getTranslation("plugin.schema.i18n.ensure-unique-localization"),
|
1511
|
-
test(value) {
|
1512
|
-
if (value === void 0 || value) {
|
1513
|
-
return true;
|
1514
|
-
}
|
1515
|
-
const unique = get__default.default(args, ["3", "modifiedData", "unique"], null);
|
1516
|
-
if (unique && !value) {
|
1517
|
-
return false;
|
1518
|
-
}
|
1519
|
-
return true;
|
1520
|
-
}
|
1521
|
-
})
|
1522
|
-
})
|
1523
|
-
}),
|
1524
1548
|
form: {
|
1525
1549
|
advanced({ contentTypeSchema, forTarget, type, step }) {
|
1526
1550
|
if (forTarget !== "contentType") {
|
@@ -1559,7 +1583,7 @@ const index = {
|
|
1559
1583
|
async registerTrads({ locales }) {
|
1560
1584
|
const importedTrads = await Promise.all(
|
1561
1585
|
locales.map((locale) => {
|
1562
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-
|
1586
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-BOhNX_-5.js")), "./translations/dk.json": () => Promise.resolve().then(() => require("./dk-cjXm0p3m.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-UlC0jh2t.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-hr9b_HLp.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-BFmBbE0H.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-C40pNQ9b.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-JtWBy-JQ.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-COSWt3Nu.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-BVj1O5ch.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-DIEm_EMC.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-wkBPBkhc.js")) }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
|
1563
1587
|
return {
|
1564
1588
|
data: prefixPluginTranslations(data, pluginId),
|
1565
1589
|
locale
|
@@ -1583,4 +1607,4 @@ exports.useDeleteLocaleMutation = useDeleteLocaleMutation;
|
|
1583
1607
|
exports.useGetDefaultLocalesQuery = useGetDefaultLocalesQuery;
|
1584
1608
|
exports.useGetLocalesQuery = useGetLocalesQuery;
|
1585
1609
|
exports.useUpdateLocaleMutation = useUpdateLocaleMutation;
|
1586
|
-
//# sourceMappingURL=index-
|
1610
|
+
//# sourceMappingURL=index-C8NzsAKp.js.map
|