@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
@@ -1,25 +1,32 @@
|
|
1
1
|
import get from "lodash/get";
|
2
2
|
import * as yup from "yup";
|
3
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
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, 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";
|
10
|
-
import { useAuth, adminApi, useTable, Table, useQueryParams, useNotification, useAPIErrorHandler } from "@strapi/admin/strapi-admin";
|
10
|
+
import { useAuth, adminApi, useTable, Table, useQueryParams, useForm, useNotification, useAPIErrorHandler } from "@strapi/admin/strapi-admin";
|
11
11
|
import { unstable_useDocument, unstable_useDocumentActions, buildValidParams } from "@strapi/content-manager/strapi-admin";
|
12
12
|
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";
|
@@ -217,6 +224,86 @@ const relationsApi = i18nApi.injectEndpoints({
|
|
217
224
|
})
|
218
225
|
});
|
219
226
|
const { useGetManyDraftRelationCountQuery } = relationsApi;
|
227
|
+
const cleanData = (data, schema, components) => {
|
228
|
+
const cleanedData = removeFields(data, [
|
229
|
+
"createdAt",
|
230
|
+
"createdBy",
|
231
|
+
"updatedAt",
|
232
|
+
"updatedBy",
|
233
|
+
"id",
|
234
|
+
"documentId",
|
235
|
+
"publishedAt",
|
236
|
+
"strapi_stage",
|
237
|
+
"strapi_assignee",
|
238
|
+
"locale",
|
239
|
+
"status"
|
240
|
+
]);
|
241
|
+
const cleanedDataWithoutPasswordAndRelation = recursiveRemoveFieldTypes(
|
242
|
+
cleanedData,
|
243
|
+
schema,
|
244
|
+
components,
|
245
|
+
["relation", "password"]
|
246
|
+
);
|
247
|
+
return cleanedDataWithoutPasswordAndRelation;
|
248
|
+
};
|
249
|
+
const removeFields = (data, fields) => {
|
250
|
+
return Object.keys(data).reduce((acc, current) => {
|
251
|
+
if (fields.includes(current)) {
|
252
|
+
return acc;
|
253
|
+
}
|
254
|
+
acc[current] = data[current];
|
255
|
+
return acc;
|
256
|
+
}, {});
|
257
|
+
};
|
258
|
+
const recursiveRemoveFieldTypes = (data, schema, components, fields) => {
|
259
|
+
return Object.keys(data).reduce((acc, current) => {
|
260
|
+
const attribute = schema.attributes[current] ?? { type: void 0 };
|
261
|
+
if (fields.includes(attribute.type)) {
|
262
|
+
return acc;
|
263
|
+
}
|
264
|
+
if (attribute.type === "dynamiczone") {
|
265
|
+
acc[current] = data[current].map((componentValue, index2) => {
|
266
|
+
const { id: _, ...rest } = recursiveRemoveFieldTypes(
|
267
|
+
componentValue,
|
268
|
+
components[componentValue.__component],
|
269
|
+
components,
|
270
|
+
fields
|
271
|
+
);
|
272
|
+
return {
|
273
|
+
...rest,
|
274
|
+
__temp_key__: index2 + 1
|
275
|
+
};
|
276
|
+
});
|
277
|
+
} else if (attribute.type === "component") {
|
278
|
+
const { repeatable, component } = attribute;
|
279
|
+
if (repeatable) {
|
280
|
+
acc[current] = (data[current] ?? []).map((compoData, index2) => {
|
281
|
+
const { id: _, ...rest } = recursiveRemoveFieldTypes(
|
282
|
+
compoData,
|
283
|
+
components[component],
|
284
|
+
components,
|
285
|
+
fields
|
286
|
+
);
|
287
|
+
return {
|
288
|
+
...rest,
|
289
|
+
__temp_key__: index2 + 1
|
290
|
+
};
|
291
|
+
});
|
292
|
+
} else {
|
293
|
+
const { id: _, ...rest } = recursiveRemoveFieldTypes(
|
294
|
+
data[current] ?? {},
|
295
|
+
components[component],
|
296
|
+
components,
|
297
|
+
fields
|
298
|
+
);
|
299
|
+
acc[current] = rest;
|
300
|
+
}
|
301
|
+
} else {
|
302
|
+
acc[current] = data[current];
|
303
|
+
}
|
304
|
+
return acc;
|
305
|
+
}, {});
|
306
|
+
};
|
220
307
|
const isErrorMessageDescriptor = (object) => {
|
221
308
|
return typeof object === "object" && object !== null && "id" in object && "defaultMessage" in object;
|
222
309
|
};
|
@@ -411,6 +498,48 @@ const BulkLocaleActionModal = ({
|
|
411
498
|
] }) })
|
412
499
|
] });
|
413
500
|
};
|
501
|
+
const statusVariants = {
|
502
|
+
draft: "secondary",
|
503
|
+
published: "success",
|
504
|
+
modified: "alternative"
|
505
|
+
};
|
506
|
+
const LocaleOption = ({
|
507
|
+
isDraftAndPublishEnabled,
|
508
|
+
locale,
|
509
|
+
status,
|
510
|
+
entryExists
|
511
|
+
}) => {
|
512
|
+
const { formatMessage } = useIntl();
|
513
|
+
if (!entryExists) {
|
514
|
+
return formatMessage(
|
515
|
+
{
|
516
|
+
id: getTranslation("CMEditViewLocalePicker.locale.create"),
|
517
|
+
defaultMessage: "Create <bold>{locale}</bold> locale"
|
518
|
+
},
|
519
|
+
{
|
520
|
+
bold: (locale2) => /* @__PURE__ */ jsx("b", { children: locale2 }),
|
521
|
+
locale: locale.name
|
522
|
+
}
|
523
|
+
);
|
524
|
+
}
|
525
|
+
return /* @__PURE__ */ jsxs(Flex, { width: "100%", gap: 1, justifyContent: "space-between", children: [
|
526
|
+
/* @__PURE__ */ jsx(Typography, { children: locale.name }),
|
527
|
+
isDraftAndPublishEnabled ? /* @__PURE__ */ jsx(
|
528
|
+
Status,
|
529
|
+
{
|
530
|
+
display: "flex",
|
531
|
+
paddingLeft: "6px",
|
532
|
+
paddingRight: "6px",
|
533
|
+
paddingTop: "2px",
|
534
|
+
paddingBottom: "2px",
|
535
|
+
showBullet: false,
|
536
|
+
size: "S",
|
537
|
+
variant: statusVariants[status],
|
538
|
+
children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
539
|
+
}
|
540
|
+
) : null
|
541
|
+
] });
|
542
|
+
};
|
414
543
|
const LocalePickerAction = ({
|
415
544
|
document,
|
416
545
|
meta,
|
@@ -422,7 +551,13 @@ const LocalePickerAction = ({
|
|
422
551
|
const [{ query }, setQuery] = useQueryParams();
|
423
552
|
const { hasI18n, canCreate, canRead } = useI18n();
|
424
553
|
const { data: locales = [] } = useGetLocalesQuery();
|
425
|
-
const
|
554
|
+
const currentDesiredLocale = query.plugins?.i18n?.locale;
|
555
|
+
const { schema } = unstable_useDocument({
|
556
|
+
model,
|
557
|
+
collectionType,
|
558
|
+
documentId,
|
559
|
+
params: { locale: currentDesiredLocale }
|
560
|
+
});
|
426
561
|
const handleSelect = React.useCallback(
|
427
562
|
(value) => {
|
428
563
|
setQuery({
|
@@ -440,53 +575,47 @@ const LocalePickerAction = ({
|
|
440
575
|
if (!Array.isArray(locales) || !hasI18n) {
|
441
576
|
return;
|
442
577
|
}
|
443
|
-
const currentDesiredLocale = query.plugins?.i18n?.locale;
|
444
578
|
const doesLocaleExist = locales.find((loc) => loc.code === currentDesiredLocale);
|
445
579
|
const defaultLocale = locales.find((locale) => locale.isDefault);
|
446
580
|
if (!doesLocaleExist && defaultLocale?.code) {
|
447
581
|
handleSelect(defaultLocale.code);
|
448
582
|
}
|
449
|
-
}, [handleSelect, hasI18n, locales,
|
450
|
-
|
451
|
-
return null;
|
452
|
-
}
|
453
|
-
const currentLocale = query.plugins?.i18n?.locale || locales.find((loc) => loc.isDefault)?.code;
|
583
|
+
}, [handleSelect, hasI18n, locales, currentDesiredLocale]);
|
584
|
+
const currentLocale = Array.isArray(locales) ? locales.find((locale) => locale.code === currentDesiredLocale) : void 0;
|
454
585
|
const allCurrentLocales = [
|
455
|
-
{ status: getDocumentStatus(document, meta), locale: currentLocale },
|
586
|
+
{ status: getDocumentStatus(document, meta), locale: currentLocale?.code },
|
456
587
|
...meta?.availableLocales ?? []
|
457
588
|
];
|
589
|
+
if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {
|
590
|
+
return null;
|
591
|
+
}
|
458
592
|
return {
|
459
593
|
label: formatMessage({
|
460
594
|
id: getTranslation("Settings.locales.modal.locales.label"),
|
461
595
|
defaultMessage: "Locales"
|
462
596
|
}),
|
463
597
|
options: locales.map((locale) => {
|
598
|
+
const entryWithLocaleExists = allCurrentLocales.some((doc) => doc.locale === locale.code);
|
464
599
|
const currentLocaleDoc = allCurrentLocales.find(
|
465
600
|
(doc) => "locale" in doc ? doc.locale === locale.code : false
|
466
601
|
);
|
467
|
-
const
|
468
|
-
const permissionsToCheck = currentLocaleDoc ? canCreate : canRead;
|
469
|
-
const statusVariant = status === "draft" ? "primary" : status === "published" ? "success" : "alternative";
|
602
|
+
const permissionsToCheck = currentLocaleDoc ? canRead : canCreate;
|
470
603
|
return {
|
471
604
|
disabled: !permissionsToCheck.includes(locale.code),
|
472
605
|
value: locale.code,
|
473
|
-
label:
|
474
|
-
|
475
|
-
Status,
|
606
|
+
label: /* @__PURE__ */ jsx(
|
607
|
+
LocaleOption,
|
476
608
|
{
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
paddingBottom: "2px",
|
482
|
-
showBullet: false,
|
483
|
-
size: "S",
|
484
|
-
variant: statusVariant,
|
485
|
-
children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
609
|
+
isDraftAndPublishEnabled: !!schema?.options?.draftAndPublish,
|
610
|
+
locale,
|
611
|
+
status: currentLocaleDoc?.status,
|
612
|
+
entryExists: entryWithLocaleExists
|
486
613
|
}
|
487
|
-
)
|
614
|
+
),
|
615
|
+
startIcon: !entryWithLocaleExists ? /* @__PURE__ */ jsx(Plus, {}) : null
|
488
616
|
};
|
489
617
|
}),
|
618
|
+
customizeContent: () => currentLocale?.name,
|
490
619
|
onSelect: handleSelect,
|
491
620
|
value: currentLocale
|
492
621
|
};
|
@@ -502,6 +631,95 @@ const getDocumentStatus = (document, meta) => {
|
|
502
631
|
}
|
503
632
|
return docStatus;
|
504
633
|
};
|
634
|
+
const FillFromAnotherLocaleAction = ({
|
635
|
+
documentId,
|
636
|
+
meta,
|
637
|
+
model,
|
638
|
+
collectionType
|
639
|
+
}) => {
|
640
|
+
const { formatMessage } = useIntl();
|
641
|
+
const [{ query }] = useQueryParams();
|
642
|
+
const currentDesiredLocale = query.plugins?.i18n?.locale;
|
643
|
+
const [localeSelected, setLocaleSelected] = React.useState(null);
|
644
|
+
const setValues = useForm("FillFromAnotherLocale", (state) => state.setValues);
|
645
|
+
const { getDocument } = unstable_useDocumentActions();
|
646
|
+
const { schema, components } = unstable_useDocument({
|
647
|
+
model,
|
648
|
+
documentId,
|
649
|
+
collectionType,
|
650
|
+
params: { locale: currentDesiredLocale }
|
651
|
+
});
|
652
|
+
const { data: locales = [] } = useGetLocalesQuery();
|
653
|
+
const availableLocales = Array.isArray(locales) ? locales.filter((locale) => meta?.availableLocales.some((l) => l.locale === locale.code)) : [];
|
654
|
+
const fillFromLocale = (onClose) => async () => {
|
655
|
+
const response = await getDocument({
|
656
|
+
collectionType,
|
657
|
+
model,
|
658
|
+
documentId,
|
659
|
+
params: { locale: localeSelected }
|
660
|
+
});
|
661
|
+
if (!response || !schema) {
|
662
|
+
return;
|
663
|
+
}
|
664
|
+
const { data } = response;
|
665
|
+
const cleanedData = cleanData(data, schema, components);
|
666
|
+
setValues(cleanedData);
|
667
|
+
onClose();
|
668
|
+
};
|
669
|
+
return {
|
670
|
+
type: "icon",
|
671
|
+
icon: /* @__PURE__ */ jsx(Download, {}),
|
672
|
+
disabled: availableLocales.length === 0,
|
673
|
+
label: formatMessage({
|
674
|
+
id: getTranslation("CMEditViewCopyLocale.copy-text"),
|
675
|
+
defaultMessage: "Fill in from another locale"
|
676
|
+
}),
|
677
|
+
dialog: {
|
678
|
+
type: "dialog",
|
679
|
+
title: formatMessage({
|
680
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.title"),
|
681
|
+
defaultMessage: "Confirmation"
|
682
|
+
}),
|
683
|
+
content: ({ onClose }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
684
|
+
/* @__PURE__ */ jsx(Dialog.Body, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 3, children: [
|
685
|
+
/* @__PURE__ */ jsx(WarningCircle, { width: "24px", height: "24px", fill: "danger600" }),
|
686
|
+
/* @__PURE__ */ jsx(Typography, { textAlign: "center", children: formatMessage({
|
687
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.body"),
|
688
|
+
defaultMessage: "Your current content will be erased and filled by the content of the selected locale:"
|
689
|
+
}) }),
|
690
|
+
/* @__PURE__ */ jsxs(Field.Root, { width: "100%", children: [
|
691
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
692
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.field.label"),
|
693
|
+
defaultMessage: "Locale"
|
694
|
+
}) }),
|
695
|
+
/* @__PURE__ */ jsx(
|
696
|
+
SingleSelect,
|
697
|
+
{
|
698
|
+
value: localeSelected,
|
699
|
+
placeholder: formatMessage({
|
700
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.field.placeholder"),
|
701
|
+
defaultMessage: "Select one locale..."
|
702
|
+
}),
|
703
|
+
onChange: (value) => setLocaleSelected(value),
|
704
|
+
children: availableLocales.map((locale) => /* @__PURE__ */ jsx(SingleSelectOption, { value: locale.code, children: locale.name }, locale.code))
|
705
|
+
}
|
706
|
+
)
|
707
|
+
] })
|
708
|
+
] }) }),
|
709
|
+
/* @__PURE__ */ jsx(Dialog.Footer, { children: /* @__PURE__ */ jsxs(Flex, { gap: 2, width: "100%", children: [
|
710
|
+
/* @__PURE__ */ jsx(Button, { flex: "auto", variant: "tertiary", onClick: onClose, children: formatMessage({
|
711
|
+
id: getTranslation("CMEditViewCopyLocale.cancel-text"),
|
712
|
+
defaultMessage: "No, cancel"
|
713
|
+
}) }),
|
714
|
+
/* @__PURE__ */ jsx(Button, { flex: "auto", variant: "success", onClick: fillFromLocale(onClose), children: formatMessage({
|
715
|
+
id: getTranslation("CMEditViewCopyLocale.submit-text"),
|
716
|
+
defaultMessage: "Yes, fill in"
|
717
|
+
}) })
|
718
|
+
] }) })
|
719
|
+
] })
|
720
|
+
}
|
721
|
+
};
|
722
|
+
};
|
505
723
|
const DeleteLocaleAction = ({
|
506
724
|
document,
|
507
725
|
documentId,
|
@@ -513,16 +731,23 @@ const DeleteLocaleAction = ({
|
|
513
731
|
const { toggleNotification } = useNotification();
|
514
732
|
const { delete: deleteAction } = unstable_useDocumentActions();
|
515
733
|
const { hasI18n, canDelete } = useI18n();
|
734
|
+
const [{ query }] = useQueryParams();
|
735
|
+
const { data: locales = [] } = useGetLocalesQuery();
|
736
|
+
const currentDesiredLocale = query.plugins?.i18n?.locale;
|
737
|
+
const locale = !("error" in locales) && locales.find((loc) => loc.code === currentDesiredLocale);
|
516
738
|
if (!hasI18n) {
|
517
739
|
return null;
|
518
740
|
}
|
519
741
|
return {
|
520
742
|
disabled: document?.locale && !canDelete.includes(document.locale) || !document || !document.id,
|
521
743
|
position: ["header", "table-row"],
|
522
|
-
label: formatMessage(
|
523
|
-
|
524
|
-
|
525
|
-
|
744
|
+
label: formatMessage(
|
745
|
+
{
|
746
|
+
id: getTranslation("actions.delete.label"),
|
747
|
+
defaultMessage: "Delete entry ({locale})"
|
748
|
+
},
|
749
|
+
{ locale: locale && locale.name }
|
750
|
+
),
|
526
751
|
icon: /* @__PURE__ */ jsx(StyledTrash, {}),
|
527
752
|
variant: "danger",
|
528
753
|
dialog: {
|
@@ -539,7 +764,12 @@ const DeleteLocaleAction = ({
|
|
539
764
|
}) })
|
540
765
|
] }),
|
541
766
|
onConfirm: async () => {
|
542
|
-
|
767
|
+
const unableToDelete = (
|
768
|
+
// We are unable to delete a collection type without a document ID
|
769
|
+
// & unable to delete generally if there is no document locale
|
770
|
+
collectionType !== "single-types" && !documentId || !document?.locale
|
771
|
+
);
|
772
|
+
if (unableToDelete) {
|
543
773
|
console.error(
|
544
774
|
"You're trying to delete a document without an id or locale, this is likely a bug with Strapi. Please open an issue."
|
545
775
|
);
|
@@ -598,7 +828,7 @@ const BulkLocaleAction = ({
|
|
598
828
|
}
|
599
829
|
},
|
600
830
|
{
|
601
|
-
skip: !hasI18n
|
831
|
+
skip: !hasI18n || !baseLocale
|
602
832
|
}
|
603
833
|
);
|
604
834
|
const { data: localesMetadata = [] } = useGetLocalesQuery(hasI18n ? void 0 : skipToken);
|
@@ -1172,9 +1402,6 @@ const localeMiddleware = (ctx) => (next) => (permissions) => {
|
|
1172
1402
|
return next(revisedPermissions);
|
1173
1403
|
};
|
1174
1404
|
const prefixPluginTranslations = (trad, pluginId2) => {
|
1175
|
-
if (!pluginId2) {
|
1176
|
-
throw new TypeError("pluginId can't be empty");
|
1177
|
-
}
|
1178
1405
|
return Object.keys(trad).reduce((acc, current) => {
|
1179
1406
|
acc[`${pluginId2}.${current}`] = trad[current];
|
1180
1407
|
return acc;
|
@@ -1244,11 +1471,11 @@ const index = {
|
|
1244
1471
|
},
|
1245
1472
|
id: "internationalization",
|
1246
1473
|
to: "internationalization",
|
1247
|
-
Component: () => import("./SettingsPage-
|
1474
|
+
Component: () => import("./SettingsPage-BWEhlJzY.mjs").then((mod) => ({ default: mod.ProtectedSettingsPage })),
|
1248
1475
|
permissions: PERMISSIONS.accessMain
|
1249
1476
|
});
|
1250
1477
|
const contentManager = app.getPlugin("content-manager");
|
1251
|
-
contentManager.apis.addDocumentHeaderAction([LocalePickerAction]);
|
1478
|
+
contentManager.apis.addDocumentHeaderAction([LocalePickerAction, FillFromAnotherLocaleAction]);
|
1252
1479
|
contentManager.apis.addDocumentAction((actions) => {
|
1253
1480
|
const indexOfDeleteAction = actions.findIndex((action) => action.type === "delete");
|
1254
1481
|
actions.splice(indexOfDeleteAction, 0, DeleteLocaleAction);
|
@@ -1362,7 +1589,7 @@ const index = {
|
|
1362
1589
|
async registerTrads({ locales }) {
|
1363
1590
|
const importedTrads = await Promise.all(
|
1364
1591
|
locales.map((locale) => {
|
1365
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => import("./de-9eCAqqrB.mjs"), "./translations/dk.json": () => import("./dk-2qBjxt-P.mjs"), "./translations/en.json": () => import("./en-
|
1592
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => import("./de-9eCAqqrB.mjs"), "./translations/dk.json": () => import("./dk-2qBjxt-P.mjs"), "./translations/en.json": () => import("./en-DlXfy6Gy.mjs"), "./translations/es.json": () => import("./es-DlmMVaBG.mjs"), "./translations/fr.json": () => import("./fr-3S6ke71d.mjs"), "./translations/ko.json": () => import("./ko-qTjQ8IMw.mjs"), "./translations/pl.json": () => import("./pl-B67TSHqT.mjs"), "./translations/ru.json": () => import("./ru-hagMa57T.mjs"), "./translations/tr.json": () => import("./tr-Dw_jmkG-.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-Dyc-aR-h.mjs"), "./translations/zh.json": () => import("./zh-57YM4amO.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
|
1366
1593
|
return {
|
1367
1594
|
data: prefixPluginTranslations(data, pluginId),
|
1368
1595
|
locale
|
@@ -1388,4 +1615,4 @@ export {
|
|
1388
1615
|
index as i,
|
1389
1616
|
useCreateLocaleMutation as u
|
1390
1617
|
};
|
1391
|
-
//# sourceMappingURL=index-
|
1618
|
+
//# sourceMappingURL=index-C6Fyjx-i.mjs.map
|