@strapi/i18n 0.0.0-experimental.3c73a4c6f6073abdf1608121a200c3d4d87b1aa8 → 0.0.0-experimental.44c735643fa8b4286750c2dca43f185bb30b7760
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/LICENSE +18 -3
- package/dist/_chunks/{SettingsPage-0FFSTUW2.mjs → SettingsPage-BjxjwEOb.mjs} +93 -106
- package/dist/_chunks/SettingsPage-BjxjwEOb.mjs.map +1 -0
- package/dist/_chunks/{SettingsPage-DnLLGeBa.js → SettingsPage-CfTmCkup.js} +91 -104
- package/dist/_chunks/SettingsPage-CfTmCkup.js.map +1 -0
- package/dist/_chunks/{en-18tWw4P6.mjs → en-2xztdZE1.mjs} +9 -1
- package/dist/_chunks/en-2xztdZE1.mjs.map +1 -0
- package/dist/_chunks/{en-Kv6y9zPQ.js → en-DWpfm8h5.js} +9 -1
- package/dist/_chunks/en-DWpfm8h5.js.map +1 -0
- package/dist/_chunks/{index-DtEKsPcR.js → index-5XLZwzwx.js} +380 -204
- package/dist/_chunks/index-5XLZwzwx.js.map +1 -0
- package/dist/_chunks/{index-BddUXwss.mjs → index-D-qx3tz4.mjs} +374 -198
- package/dist/_chunks/index-D-qx3tz4.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/BulkLocaleActionModal.d.ts +2 -1
- package/dist/admin/src/components/CMHeaderActions.d.ts +27 -3
- package/dist/admin/src/components/EditLocale.d.ts +5 -4
- package/dist/admin/src/contentReleasesHooks/releaseDetailsView.d.ts +9 -5
- package/dist/admin/src/utils/clean.d.ts +4 -0
- package/dist/admin/src/utils/schemas.d.ts +1 -0
- package/dist/server/index.js +38 -9
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +39 -10
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +14 -2
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +14 -2
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/permissions/actions.d.ts +14 -2
- package/dist/server/src/services/permissions/actions.d.ts.map +1 -1
- package/dist/server/src/services/permissions.d.ts +14 -2
- package/dist/server/src/services/permissions.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/_chunks/SettingsPage-0FFSTUW2.mjs.map +0 -1
- package/dist/_chunks/SettingsPage-DnLLGeBa.js.map +0 -1
- package/dist/_chunks/en-18tWw4P6.mjs.map +0 -1
- package/dist/_chunks/en-Kv6y9zPQ.js.map +0 -1
- package/dist/_chunks/index-BddUXwss.mjs.map +0 -1
- package/dist/_chunks/index-DtEKsPcR.js.map +0 -1
- package/dist/admin/src/components/Initializer.d.ts +0 -5
@@ -1,12 +1,13 @@
|
|
1
1
|
import get from "lodash/get";
|
2
2
|
import * as yup from "yup";
|
3
|
-
import { jsxs,
|
3
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
4
4
|
import * as React from "react";
|
5
|
-
import { Typography, Field, Checkbox,
|
6
|
-
import { WarningCircle, Pencil, CrossCircle, CheckCircle, ArrowsCounterClockwise, Trash, ListPlus, Earth, EarthStriked, CaretDown } from "@strapi/icons";
|
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";
|
7
7
|
import { useIntl } from "react-intl";
|
8
8
|
import { styled } from "styled-components";
|
9
|
-
import {
|
9
|
+
import { skipToken } from "@reduxjs/toolkit/query";
|
10
|
+
import { useAuth, adminApi, useTable, Table, useQueryParams, useForm, useNotification, useAPIErrorHandler } from "@strapi/admin/strapi-admin";
|
10
11
|
import { unstable_useDocument, unstable_useDocumentActions, buildValidParams } from "@strapi/content-manager/strapi-admin";
|
11
12
|
import { useParams, Link, useNavigate, matchPath } from "react-router-dom";
|
12
13
|
import * as qs from "qs";
|
@@ -47,9 +48,7 @@ const CheckboxConfirmation = ({
|
|
47
48
|
};
|
48
49
|
const handleConfirm = () => {
|
49
50
|
onChange({ target: { name, value: false, type: "checkbox" } });
|
50
|
-
setIsOpen(false);
|
51
51
|
};
|
52
|
-
const handleToggle = () => setIsOpen((prev) => !prev);
|
53
52
|
const label = intlLabel.id ? formatMessage(
|
54
53
|
{ id: intlLabel.id, defaultMessage: intlLabel.defaultMessage },
|
55
54
|
{ ...intlLabel.values }
|
@@ -58,35 +57,36 @@ const CheckboxConfirmation = ({
|
|
58
57
|
{ id: description.id, defaultMessage: description.defaultMessage },
|
59
58
|
{ ...description.values }
|
60
59
|
) : "";
|
61
|
-
return /* @__PURE__ */ jsxs(
|
60
|
+
return /* @__PURE__ */ jsxs(Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, children: [
|
62
61
|
/* @__PURE__ */ jsxs(Field.Root, { hint, name, children: [
|
63
|
-
/* @__PURE__ */ jsx(Checkbox, {
|
62
|
+
/* @__PURE__ */ jsx(Checkbox, { onCheckedChange: handleChange, checked: value, children: label }),
|
64
63
|
/* @__PURE__ */ jsx(Field.Hint, {})
|
65
64
|
] }),
|
66
|
-
|
67
|
-
/* @__PURE__ */ jsx(
|
68
|
-
|
65
|
+
/* @__PURE__ */ jsxs(Dialog.Content, { children: [
|
66
|
+
/* @__PURE__ */ jsx(Dialog.Header, { children: formatMessage({
|
67
|
+
id: getTranslation("CheckboxConfirmation.Modal.title"),
|
68
|
+
defaultMessage: "Disable localization"
|
69
|
+
}) }),
|
70
|
+
/* @__PURE__ */ jsx(Dialog.Body, { icon: /* @__PURE__ */ jsx(WarningCircle, {}), children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
71
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(TextAlignTypography, { children: formatMessage({
|
69
72
|
id: getTranslation("CheckboxConfirmation.Modal.content"),
|
70
73
|
defaultMessage: "Disabling localization will engender the deletion of all your content but the one associated to your default locale (if existing)."
|
71
74
|
}) }) }),
|
72
|
-
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Typography, { fontWeight: "semiBold",
|
75
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Typography, { fontWeight: "semiBold", children: formatMessage({
|
73
76
|
id: getTranslation("CheckboxConfirmation.Modal.body"),
|
74
77
|
defaultMessage: "Do you want to disable it?"
|
75
78
|
}) }) })
|
76
79
|
] }) }),
|
77
|
-
/* @__PURE__ */
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
}) })
|
88
|
-
}
|
89
|
-
)
|
80
|
+
/* @__PURE__ */ jsxs(Dialog.Footer, { children: [
|
81
|
+
/* @__PURE__ */ jsx(Dialog.Cancel, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", children: formatMessage({
|
82
|
+
id: "components.popUpWarning.button.cancel",
|
83
|
+
defaultMessage: "No, cancel"
|
84
|
+
}) }) }),
|
85
|
+
/* @__PURE__ */ jsx(Dialog.Action, { children: /* @__PURE__ */ jsx(Button, { variant: "danger-light", onClick: handleConfirm, children: formatMessage({
|
86
|
+
id: getTranslation("CheckboxConfirmation.Modal.button-confirm"),
|
87
|
+
defaultMessage: "Yes, disable"
|
88
|
+
}) }) })
|
89
|
+
] })
|
90
90
|
] })
|
91
91
|
] });
|
92
92
|
};
|
@@ -137,7 +137,7 @@ const useI18n = () => {
|
|
137
137
|
model: params.slug
|
138
138
|
},
|
139
139
|
{
|
140
|
-
skip:
|
140
|
+
skip: true
|
141
141
|
}
|
142
142
|
);
|
143
143
|
if (doesPluginOptionsHaveI18nLocalized(schema?.pluginOptions)) {
|
@@ -217,10 +217,93 @@ const relationsApi = i18nApi.injectEndpoints({
|
|
217
217
|
})
|
218
218
|
});
|
219
219
|
const { useGetManyDraftRelationCountQuery } = relationsApi;
|
220
|
+
const cleanData = (data, schema, components) => {
|
221
|
+
const cleanedData = removeFields(data, [
|
222
|
+
"createdAt",
|
223
|
+
"createdBy",
|
224
|
+
"updatedAt",
|
225
|
+
"updatedBy",
|
226
|
+
"id",
|
227
|
+
"documentId",
|
228
|
+
"publishedAt",
|
229
|
+
"strapi_stage",
|
230
|
+
"strapi_assignee",
|
231
|
+
"locale"
|
232
|
+
]);
|
233
|
+
const cleanedDataWithoutPasswordAndRelation = recursiveRemoveFieldTypes(
|
234
|
+
cleanedData,
|
235
|
+
schema,
|
236
|
+
components,
|
237
|
+
["relation", "password"]
|
238
|
+
);
|
239
|
+
return cleanedDataWithoutPasswordAndRelation;
|
240
|
+
};
|
241
|
+
const removeFields = (data, fields) => {
|
242
|
+
return Object.keys(data).reduce((acc, current) => {
|
243
|
+
if (fields.includes(current)) {
|
244
|
+
return acc;
|
245
|
+
}
|
246
|
+
acc[current] = data[current];
|
247
|
+
return acc;
|
248
|
+
}, {});
|
249
|
+
};
|
250
|
+
const recursiveRemoveFieldTypes = (data, schema, components, fields) => {
|
251
|
+
return Object.keys(data).reduce((acc, current) => {
|
252
|
+
const attribute = schema.attributes[current] ?? { type: void 0 };
|
253
|
+
if (fields.includes(attribute.type)) {
|
254
|
+
return acc;
|
255
|
+
}
|
256
|
+
if (attribute.type === "dynamiczone") {
|
257
|
+
acc[current] = data[current].map((componentValue, index2) => {
|
258
|
+
const { id: _, ...rest } = recursiveRemoveFieldTypes(
|
259
|
+
componentValue,
|
260
|
+
components[componentValue.__component],
|
261
|
+
components,
|
262
|
+
fields
|
263
|
+
);
|
264
|
+
return {
|
265
|
+
...rest,
|
266
|
+
__temp_key__: index2 + 1
|
267
|
+
};
|
268
|
+
});
|
269
|
+
} else if (attribute.type === "component") {
|
270
|
+
const { repeatable, component } = attribute;
|
271
|
+
if (repeatable) {
|
272
|
+
acc[current] = (data[current] ?? []).map((compoData, index2) => {
|
273
|
+
const { id: _, ...rest } = recursiveRemoveFieldTypes(
|
274
|
+
compoData,
|
275
|
+
components[component],
|
276
|
+
components,
|
277
|
+
fields
|
278
|
+
);
|
279
|
+
return {
|
280
|
+
...rest,
|
281
|
+
__temp_key__: index2 + 1
|
282
|
+
};
|
283
|
+
});
|
284
|
+
} else {
|
285
|
+
const { id: _, ...rest } = recursiveRemoveFieldTypes(
|
286
|
+
data[current] ?? {},
|
287
|
+
components[component],
|
288
|
+
components,
|
289
|
+
fields
|
290
|
+
);
|
291
|
+
acc[current] = rest;
|
292
|
+
}
|
293
|
+
} else {
|
294
|
+
acc[current] = data[current];
|
295
|
+
}
|
296
|
+
return acc;
|
297
|
+
}, {});
|
298
|
+
};
|
220
299
|
const isErrorMessageDescriptor = (object) => {
|
221
300
|
return typeof object === "object" && object !== null && "id" in object && "defaultMessage" in object;
|
222
301
|
};
|
223
|
-
const EntryValidationText = ({
|
302
|
+
const EntryValidationText = ({
|
303
|
+
status = "draft",
|
304
|
+
validationErrors,
|
305
|
+
action
|
306
|
+
}) => {
|
224
307
|
const { formatMessage } = useIntl();
|
225
308
|
const getErrorStr = (key, value) => {
|
226
309
|
if (typeof value === "string") {
|
@@ -254,30 +337,63 @@ const EntryValidationText = ({ status = "draft", validationErrors }) => {
|
|
254
337
|
) })
|
255
338
|
] });
|
256
339
|
}
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
340
|
+
const getStatusMessage = () => {
|
341
|
+
if (action === "bulk-publish") {
|
342
|
+
if (status === "published") {
|
343
|
+
return {
|
344
|
+
icon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
345
|
+
text: formatMessage({
|
346
|
+
id: "content-manager.bulk-publish.already-published",
|
347
|
+
defaultMessage: "Already Published"
|
348
|
+
}),
|
349
|
+
textColor: "success600",
|
350
|
+
fontWeight: "bold"
|
351
|
+
};
|
352
|
+
} else if (status === "modified") {
|
353
|
+
return {
|
354
|
+
icon: /* @__PURE__ */ jsx(ArrowsCounterClockwise, { fill: "alternative600" }),
|
355
|
+
text: formatMessage({
|
356
|
+
id: "app.utils.ready-to-publish-changes",
|
357
|
+
defaultMessage: "Ready to publish changes"
|
358
|
+
})
|
359
|
+
};
|
360
|
+
} else {
|
361
|
+
return {
|
362
|
+
icon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
363
|
+
text: formatMessage({
|
364
|
+
id: "app.utils.ready-to-publish",
|
365
|
+
defaultMessage: "Ready to publish"
|
366
|
+
})
|
367
|
+
};
|
368
|
+
}
|
369
|
+
} else {
|
370
|
+
if (status === "draft") {
|
371
|
+
return {
|
372
|
+
icon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
373
|
+
text: formatMessage({
|
374
|
+
id: "content-manager.bulk-unpublish.already-unpublished",
|
375
|
+
defaultMessage: "Already Unpublished"
|
376
|
+
}),
|
377
|
+
textColor: "success600",
|
378
|
+
fontWeight: "bold"
|
379
|
+
};
|
380
|
+
} else {
|
381
|
+
return {
|
382
|
+
icon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
383
|
+
text: formatMessage({
|
384
|
+
id: "app.utils.ready-to-unpublish-changes",
|
385
|
+
defaultMessage: "Ready to unpublish"
|
386
|
+
}),
|
387
|
+
textColor: "success600",
|
388
|
+
fontWeight: "bold"
|
389
|
+
};
|
390
|
+
}
|
391
|
+
}
|
392
|
+
};
|
393
|
+
const { icon, text, textColor = "success600", fontWeight = "normal" } = getStatusMessage();
|
275
394
|
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
276
|
-
|
277
|
-
/* @__PURE__ */ jsx(Typography, { children:
|
278
|
-
id: "app.utils.ready-to-publish",
|
279
|
-
defaultMessage: "Ready to publish"
|
280
|
-
}) })
|
395
|
+
icon,
|
396
|
+
/* @__PURE__ */ jsx(Typography, { textColor, fontWeight, children: text })
|
281
397
|
] });
|
282
398
|
};
|
283
399
|
const BoldChunk = (chunks) => /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: chunks });
|
@@ -285,7 +401,8 @@ const BulkLocaleActionModal = ({
|
|
285
401
|
headers,
|
286
402
|
rows,
|
287
403
|
localesMetadata,
|
288
|
-
validationErrors = {}
|
404
|
+
validationErrors = {},
|
405
|
+
action
|
289
406
|
}) => {
|
290
407
|
const { formatMessage } = useIntl();
|
291
408
|
const selectedRows = useTable(
|
@@ -298,27 +415,29 @@ const BulkLocaleActionModal = ({
|
|
298
415
|
return acc;
|
299
416
|
}, {});
|
300
417
|
const localesWithErrors = Object.keys(validationErrors);
|
301
|
-
const
|
418
|
+
const publishedCount = selectedRows.filter(
|
302
419
|
({ locale }) => currentStatusByLocale[locale] === "published"
|
303
420
|
).length;
|
304
|
-
const
|
421
|
+
const draftCount = selectedRows.filter(
|
305
422
|
({ locale }) => (currentStatusByLocale[locale] === "draft" || currentStatusByLocale[locale] === "modified") && !localesWithErrors.includes(locale)
|
306
423
|
).length;
|
307
424
|
const withErrorsCount = localesWithErrors.length;
|
425
|
+
const messageId = action === "bulk-publish" ? "content-manager.containers.list.selectedEntriesModal.selectedCount.publish" : "content-manager.containers.list.selectedEntriesModal.selectedCount.unpublish";
|
426
|
+
const defaultMessage = action === "bulk-publish" ? "<b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} already published. <b>{draftCount}</b> {draftCount, plural, =0 {entries} one {entry} other {entries}} ready to publish. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action." : "<b>{draftCount}</b> {draftCount, plural, =0 {entries} one {entry} other {entries}} already unpublished. <b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} ready to unpublish.";
|
308
427
|
return formatMessage(
|
309
428
|
{
|
310
|
-
id:
|
311
|
-
defaultMessage
|
429
|
+
id: messageId,
|
430
|
+
defaultMessage
|
312
431
|
},
|
313
432
|
{
|
314
433
|
withErrorsCount,
|
315
|
-
|
316
|
-
|
434
|
+
draftCount,
|
435
|
+
publishedCount,
|
317
436
|
b: BoldChunk
|
318
437
|
}
|
319
438
|
);
|
320
439
|
};
|
321
|
-
return /* @__PURE__ */ jsxs(
|
440
|
+
return /* @__PURE__ */ jsxs(Modal.Body, { children: [
|
322
441
|
/* @__PURE__ */ jsx(Typography, { children: getFormattedCountMessage() }),
|
323
442
|
/* @__PURE__ */ jsx(Box, { marginTop: 5, children: /* @__PURE__ */ jsxs(Table.Content, { children: [
|
324
443
|
/* @__PURE__ */ jsxs(Table.Head, { children: [
|
@@ -345,7 +464,7 @@ const BulkLocaleActionModal = ({
|
|
345
464
|
children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
346
465
|
}
|
347
466
|
) }) }),
|
348
|
-
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(EntryValidationText, { validationErrors: error, status }) }),
|
467
|
+
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(EntryValidationText, { validationErrors: error, status, action }) }),
|
349
468
|
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(
|
350
469
|
IconButton,
|
351
470
|
{
|
@@ -362,7 +481,7 @@ const BulkLocaleActionModal = ({
|
|
362
481
|
name: locale
|
363
482
|
}
|
364
483
|
),
|
365
|
-
|
484
|
+
variant: "ghost",
|
366
485
|
children: /* @__PURE__ */ jsx(Pencil, {})
|
367
486
|
}
|
368
487
|
) })
|
@@ -382,7 +501,13 @@ const LocalePickerAction = ({
|
|
382
501
|
const [{ query }, setQuery] = useQueryParams();
|
383
502
|
const { hasI18n, canCreate, canRead } = useI18n();
|
384
503
|
const { data: locales = [] } = useGetLocalesQuery();
|
385
|
-
const
|
504
|
+
const currentDesiredLocale = query.plugins?.i18n?.locale;
|
505
|
+
const { schema } = unstable_useDocument({
|
506
|
+
model,
|
507
|
+
collectionType,
|
508
|
+
documentId,
|
509
|
+
params: { locale: currentDesiredLocale }
|
510
|
+
});
|
386
511
|
const handleSelect = React.useCallback(
|
387
512
|
(value) => {
|
388
513
|
setQuery({
|
@@ -400,21 +525,20 @@ const LocalePickerAction = ({
|
|
400
525
|
if (!Array.isArray(locales) || !hasI18n) {
|
401
526
|
return;
|
402
527
|
}
|
403
|
-
const currentDesiredLocale = query.plugins?.i18n?.locale;
|
404
528
|
const doesLocaleExist = locales.find((loc) => loc.code === currentDesiredLocale);
|
405
529
|
const defaultLocale = locales.find((locale) => locale.isDefault);
|
406
530
|
if (!doesLocaleExist && defaultLocale?.code) {
|
407
531
|
handleSelect(defaultLocale.code);
|
408
532
|
}
|
409
|
-
}, [handleSelect, hasI18n, locales,
|
410
|
-
|
411
|
-
return null;
|
412
|
-
}
|
413
|
-
const currentLocale = query.plugins?.i18n?.locale || locales.find((loc) => loc.isDefault)?.code;
|
533
|
+
}, [handleSelect, hasI18n, locales, currentDesiredLocale]);
|
534
|
+
const currentLocale = Array.isArray(locales) ? locales.find((locale) => locale.code === currentDesiredLocale)?.code : void 0;
|
414
535
|
const allCurrentLocales = [
|
415
536
|
{ status: getDocumentStatus(document, meta), locale: currentLocale },
|
416
537
|
...meta?.availableLocales ?? []
|
417
538
|
];
|
539
|
+
if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {
|
540
|
+
return null;
|
541
|
+
}
|
418
542
|
return {
|
419
543
|
label: formatMessage({
|
420
544
|
id: getTranslation("Settings.locales.modal.locales.label"),
|
@@ -426,7 +550,7 @@ const LocalePickerAction = ({
|
|
426
550
|
);
|
427
551
|
const status = currentLocaleDoc?.status ?? "draft";
|
428
552
|
const permissionsToCheck = currentLocaleDoc ? canCreate : canRead;
|
429
|
-
const statusVariant = status === "draft" ? "
|
553
|
+
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
430
554
|
return {
|
431
555
|
disabled: !permissionsToCheck.includes(locale.code),
|
432
556
|
value: locale.code,
|
@@ -462,6 +586,95 @@ const getDocumentStatus = (document, meta) => {
|
|
462
586
|
}
|
463
587
|
return docStatus;
|
464
588
|
};
|
589
|
+
const FillFromAnotherLocaleAction = ({
|
590
|
+
documentId,
|
591
|
+
meta,
|
592
|
+
model,
|
593
|
+
collectionType
|
594
|
+
}) => {
|
595
|
+
const { formatMessage } = useIntl();
|
596
|
+
const [{ query }] = useQueryParams();
|
597
|
+
const currentDesiredLocale = query.plugins?.i18n?.locale;
|
598
|
+
const [localeSelected, setLocaleSelected] = React.useState(null);
|
599
|
+
const setValues = useForm("FillFromAnotherLocale", (state) => state.setValues);
|
600
|
+
const { getDocument } = unstable_useDocumentActions();
|
601
|
+
const { schema, components } = unstable_useDocument({
|
602
|
+
model,
|
603
|
+
documentId,
|
604
|
+
collectionType,
|
605
|
+
params: { locale: currentDesiredLocale }
|
606
|
+
});
|
607
|
+
const { data: locales = [] } = useGetLocalesQuery();
|
608
|
+
const availableLocales = Array.isArray(locales) ? locales.filter((locale) => meta?.availableLocales.some((l) => l.locale === locale.code)) : [];
|
609
|
+
const fillFromLocale = (onClose) => async () => {
|
610
|
+
const response = await getDocument({
|
611
|
+
collectionType,
|
612
|
+
model,
|
613
|
+
documentId,
|
614
|
+
params: { locale: localeSelected }
|
615
|
+
});
|
616
|
+
if (!response || !schema) {
|
617
|
+
return;
|
618
|
+
}
|
619
|
+
const { data } = response;
|
620
|
+
const cleanedData = cleanData(data, schema, components);
|
621
|
+
setValues(cleanedData);
|
622
|
+
onClose();
|
623
|
+
};
|
624
|
+
return {
|
625
|
+
type: "icon",
|
626
|
+
icon: /* @__PURE__ */ jsx(Download, {}),
|
627
|
+
disabled: availableLocales.length === 0,
|
628
|
+
label: formatMessage({
|
629
|
+
id: getTranslation("CMEditViewCopyLocale.copy-text"),
|
630
|
+
defaultMessage: "Fill in from another locale"
|
631
|
+
}),
|
632
|
+
dialog: {
|
633
|
+
type: "dialog",
|
634
|
+
title: formatMessage({
|
635
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.title"),
|
636
|
+
defaultMessage: "Confirmation"
|
637
|
+
}),
|
638
|
+
content: ({ onClose }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
639
|
+
/* @__PURE__ */ jsx(Dialog.Body, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 3, children: [
|
640
|
+
/* @__PURE__ */ jsx(WarningCircle, { width: "24px", height: "24px", fill: "danger600" }),
|
641
|
+
/* @__PURE__ */ jsx(Typography, { textAlign: "center", children: formatMessage({
|
642
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.body"),
|
643
|
+
defaultMessage: "Your current content will be erased and filled by the content of the selected locale:"
|
644
|
+
}) }),
|
645
|
+
/* @__PURE__ */ jsxs(Field.Root, { width: "100%", children: [
|
646
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
647
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.field.label"),
|
648
|
+
defaultMessage: "Locale"
|
649
|
+
}) }),
|
650
|
+
/* @__PURE__ */ jsx(
|
651
|
+
SingleSelect,
|
652
|
+
{
|
653
|
+
value: localeSelected,
|
654
|
+
placeholder: formatMessage({
|
655
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.field.placeholder"),
|
656
|
+
defaultMessage: "Select one locale..."
|
657
|
+
}),
|
658
|
+
onChange: (value) => setLocaleSelected(value),
|
659
|
+
children: availableLocales.map((locale) => /* @__PURE__ */ jsx(SingleSelectOption, { value: locale.code, children: locale.name }, locale.code))
|
660
|
+
}
|
661
|
+
)
|
662
|
+
] })
|
663
|
+
] }) }),
|
664
|
+
/* @__PURE__ */ jsx(Dialog.Footer, { children: /* @__PURE__ */ jsxs(Flex, { gap: 2, width: "100%", children: [
|
665
|
+
/* @__PURE__ */ jsx(Button, { flex: "auto", variant: "tertiary", onClick: onClose, children: formatMessage({
|
666
|
+
id: getTranslation("CMEditViewCopyLocale.cancel-text"),
|
667
|
+
defaultMessage: "No, cancel"
|
668
|
+
}) }),
|
669
|
+
/* @__PURE__ */ jsx(Button, { flex: "auto", variant: "success", onClick: fillFromLocale(onClose), children: formatMessage({
|
670
|
+
id: getTranslation("CMEditViewCopyLocale.submit-text"),
|
671
|
+
defaultMessage: "Yes, fill in"
|
672
|
+
}) })
|
673
|
+
] }) })
|
674
|
+
] })
|
675
|
+
}
|
676
|
+
};
|
677
|
+
};
|
465
678
|
const DeleteLocaleAction = ({
|
466
679
|
document,
|
467
680
|
documentId,
|
@@ -525,37 +738,43 @@ const DeleteLocaleAction = ({
|
|
525
738
|
}
|
526
739
|
};
|
527
740
|
};
|
528
|
-
const
|
741
|
+
const BulkLocaleAction = ({
|
529
742
|
document: baseDocument,
|
530
743
|
documentId,
|
531
744
|
model,
|
532
|
-
collectionType
|
745
|
+
collectionType,
|
746
|
+
action
|
533
747
|
}) => {
|
534
748
|
const baseLocale = baseDocument?.locale ?? null;
|
535
749
|
const [{ query }] = useQueryParams();
|
536
750
|
const params = React.useMemo(() => buildValidParams(query), [query]);
|
537
|
-
const
|
751
|
+
const isOnPublishedTab = query.status === "published";
|
538
752
|
const { formatMessage } = useIntl();
|
539
753
|
const { hasI18n, canPublish } = useI18n();
|
540
754
|
const { toggleNotification } = useNotification();
|
541
755
|
const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
|
542
756
|
const [selectedRows, setSelectedRows] = React.useState([]);
|
543
|
-
const [
|
544
|
-
const { publishMany: publishManyAction } = unstable_useDocumentActions();
|
757
|
+
const [isDraftRelationConfirmationOpen, setIsDraftRelationConfirmationOpen] = React.useState(false);
|
758
|
+
const { publishMany: publishManyAction, unpublishMany: unpublishManyAction } = unstable_useDocumentActions();
|
545
759
|
const {
|
546
760
|
document,
|
547
761
|
meta: documentMeta,
|
548
762
|
schema,
|
549
763
|
validate
|
550
|
-
} = unstable_useDocument(
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
764
|
+
} = unstable_useDocument(
|
765
|
+
{
|
766
|
+
model,
|
767
|
+
collectionType,
|
768
|
+
documentId,
|
769
|
+
params: {
|
770
|
+
locale: baseLocale
|
771
|
+
}
|
772
|
+
},
|
773
|
+
{
|
774
|
+
skip: !hasI18n || !baseLocale
|
556
775
|
}
|
557
|
-
|
558
|
-
const { data: localesMetadata = [] } = useGetLocalesQuery();
|
776
|
+
);
|
777
|
+
const { data: localesMetadata = [] } = useGetLocalesQuery(hasI18n ? void 0 : skipToken);
|
559
778
|
const headers = [
|
560
779
|
{
|
561
780
|
label: formatMessage({
|
@@ -604,12 +823,19 @@ const BulkLocalePublishAction = ({
|
|
604
823
|
}, {});
|
605
824
|
return [rowsFromMeta, errors];
|
606
825
|
}, [document, documentMeta?.availableLocales, validate]);
|
607
|
-
const
|
608
|
-
|
826
|
+
const isBulkPublish = action === "bulk-publish";
|
827
|
+
const localesForAction = selectedRows.reduce((acc, selectedRow) => {
|
828
|
+
const isValidLocale = (
|
829
|
+
// Validation errors are irrelevant if we are trying to unpublish
|
830
|
+
!isBulkPublish || !Object.keys(validationErrors).includes(selectedRow.locale)
|
831
|
+
);
|
832
|
+
const shouldAddLocale = isBulkPublish ? selectedRow.status !== "published" && isValidLocale : selectedRow.status !== "draft" && isValidLocale;
|
833
|
+
if (shouldAddLocale) {
|
609
834
|
acc.push(selectedRow.locale);
|
610
835
|
}
|
611
836
|
return acc;
|
612
837
|
}, []);
|
838
|
+
const enableDraftRelationsCount = false;
|
613
839
|
const {
|
614
840
|
data: draftRelationsCount = 0,
|
615
841
|
isLoading: isDraftRelationsLoading,
|
@@ -618,10 +844,10 @@ const BulkLocalePublishAction = ({
|
|
618
844
|
{
|
619
845
|
model,
|
620
846
|
documentIds: [documentId],
|
621
|
-
locale:
|
847
|
+
locale: localesForAction
|
622
848
|
},
|
623
849
|
{
|
624
|
-
skip: !
|
850
|
+
skip: !enableDraftRelationsCount
|
625
851
|
}
|
626
852
|
);
|
627
853
|
React.useEffect(() => {
|
@@ -647,23 +873,32 @@ const BulkLocalePublishAction = ({
|
|
647
873
|
documentIds: [documentId],
|
648
874
|
params: {
|
649
875
|
...params,
|
650
|
-
locale:
|
876
|
+
locale: localesForAction
|
877
|
+
}
|
878
|
+
});
|
879
|
+
setSelectedRows([]);
|
880
|
+
};
|
881
|
+
const unpublish = async () => {
|
882
|
+
await unpublishManyAction({
|
883
|
+
model,
|
884
|
+
documentIds: [documentId],
|
885
|
+
params: {
|
886
|
+
...params,
|
887
|
+
locale: localesForAction
|
651
888
|
}
|
652
889
|
});
|
653
890
|
setSelectedRows([]);
|
654
891
|
};
|
655
892
|
const handleAction = async () => {
|
656
893
|
if (draftRelationsCount > 0) {
|
657
|
-
|
658
|
-
} else {
|
894
|
+
setIsDraftRelationConfirmationOpen(true);
|
895
|
+
} else if (isBulkPublish) {
|
659
896
|
await publish();
|
897
|
+
} else {
|
898
|
+
await unpublish();
|
660
899
|
}
|
661
900
|
};
|
662
|
-
|
663
|
-
if (isUnpublish) {
|
664
|
-
console.warn(["I18N"], "Bulk locale unpublish modal not implemented");
|
665
|
-
}
|
666
|
-
if (isConfirmationOpen) {
|
901
|
+
if (isDraftRelationConfirmationOpen) {
|
667
902
|
return {
|
668
903
|
label: formatMessage({
|
669
904
|
id: "app.components.ConfirmDialog.title",
|
@@ -672,11 +907,11 @@ const BulkLocalePublishAction = ({
|
|
672
907
|
variant: "danger",
|
673
908
|
dialog: {
|
674
909
|
onCancel: () => {
|
675
|
-
|
910
|
+
setIsDraftRelationConfirmationOpen(false);
|
676
911
|
},
|
677
912
|
onConfirm: async () => {
|
678
913
|
await publish();
|
679
|
-
|
914
|
+
setIsDraftRelationConfirmationOpen(false);
|
680
915
|
},
|
681
916
|
type: "dialog",
|
682
917
|
title: formatMessage({
|
@@ -686,27 +921,32 @@ const BulkLocalePublishAction = ({
|
|
686
921
|
content: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "center", gap: 2, children: [
|
687
922
|
/* @__PURE__ */ jsx(WarningCircle, { width: "2.4rem", height: "2.4rem", fill: "danger600" }),
|
688
923
|
/* @__PURE__ */ jsx(Typography, { textAlign: "center", children: formatMessage({
|
689
|
-
id: "
|
690
|
-
defaultMessage: "
|
924
|
+
id: getTranslation("CMEditViewBulkLocale.draft-relation-warning"),
|
925
|
+
defaultMessage: "Some locales are related to draft entries. Publishing them could leave broken links in your app."
|
926
|
+
}) }),
|
927
|
+
/* @__PURE__ */ jsx(Typography, { textAlign: "center", children: formatMessage({
|
928
|
+
id: getTranslation("CMEditViewBulkLocale.continue-confirmation"),
|
929
|
+
defaultMessage: "Are you sure you want to continue?"
|
691
930
|
}) })
|
692
931
|
] })
|
693
932
|
}
|
694
933
|
};
|
695
934
|
}
|
935
|
+
const hasPermission = selectedRows.map(({ locale }) => locale).every((locale) => canPublish.includes(locale));
|
696
936
|
return {
|
697
937
|
label: formatMessage({
|
698
|
-
id: getTranslation("
|
699
|
-
defaultMessage: "Publish Multiple Locales
|
938
|
+
id: getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? "publish" : "unpublish"}-title`),
|
939
|
+
defaultMessage: `${isBulkPublish ? "Publish" : "Unpublish"} Multiple Locales`
|
700
940
|
}),
|
701
|
-
|
702
|
-
|
941
|
+
variant: isBulkPublish ? "secondary" : "danger",
|
942
|
+
icon: isBulkPublish ? /* @__PURE__ */ jsx(ListPlus, {}) : /* @__PURE__ */ jsx(Cross, {}),
|
943
|
+
disabled: isOnPublishedTab || canPublish.length === 0,
|
703
944
|
position: ["panel"],
|
704
|
-
variant: "secondary",
|
705
945
|
dialog: {
|
706
946
|
type: "modal",
|
707
947
|
title: formatMessage({
|
708
|
-
id: getTranslation("
|
709
|
-
defaultMessage: "Publish Multiple Locales
|
948
|
+
id: getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? "publish" : "unpublish"}-title`),
|
949
|
+
defaultMessage: `${isBulkPublish ? "Publish" : "Unpublish"} Multiple Locales`
|
710
950
|
}),
|
711
951
|
content: () => {
|
712
952
|
return /* @__PURE__ */ jsx(
|
@@ -725,28 +965,35 @@ const BulkLocalePublishAction = ({
|
|
725
965
|
validationErrors,
|
726
966
|
headers,
|
727
967
|
rows,
|
728
|
-
localesMetadata
|
968
|
+
localesMetadata,
|
969
|
+
action: action ?? "bulk-publish"
|
729
970
|
}
|
730
971
|
)
|
731
972
|
}
|
732
973
|
);
|
733
974
|
},
|
734
|
-
footer: () => /* @__PURE__ */ jsx(
|
735
|
-
Button
|
975
|
+
footer: () => /* @__PURE__ */ jsx(Modal.Footer, { justifyContent: "flex-end", children: /* @__PURE__ */ jsx(
|
976
|
+
Button,
|
736
977
|
{
|
737
978
|
loading: isDraftRelationsLoading,
|
738
|
-
disabled:
|
979
|
+
disabled: !hasPermission || localesForAction.length === 0,
|
739
980
|
variant: "default",
|
740
981
|
onClick: handleAction,
|
741
982
|
children: formatMessage({
|
742
|
-
id: "app.utils.publish",
|
743
|
-
defaultMessage: "Publish"
|
983
|
+
id: isBulkPublish ? "app.utils.publish" : "app.utils.unpublish",
|
984
|
+
defaultMessage: isBulkPublish ? "Publish" : "Unpublish"
|
744
985
|
})
|
745
986
|
}
|
746
987
|
) })
|
747
988
|
}
|
748
989
|
};
|
749
990
|
};
|
991
|
+
const BulkLocalePublishAction = (props) => {
|
992
|
+
return BulkLocaleAction({ action: "bulk-publish", ...props });
|
993
|
+
};
|
994
|
+
const BulkLocaleUnpublishAction = (props) => {
|
995
|
+
return BulkLocaleAction({ action: "bulk-unpublish", ...props });
|
996
|
+
};
|
750
997
|
const StyledTrash = styled(Trash)`
|
751
998
|
path {
|
752
999
|
fill: currentColor;
|
@@ -803,13 +1050,6 @@ const UnpublishModalAdditionalInfo = () => {
|
|
803
1050
|
}
|
804
1051
|
) });
|
805
1052
|
};
|
806
|
-
const Initializer = ({ setPlugin }) => {
|
807
|
-
const setPluginRef = React.useRef(setPlugin);
|
808
|
-
React.useEffect(() => {
|
809
|
-
setPluginRef.current(pluginId);
|
810
|
-
}, []);
|
811
|
-
return null;
|
812
|
-
};
|
813
1053
|
const LocalePicker = () => {
|
814
1054
|
const { formatMessage } = useIntl();
|
815
1055
|
const [{ query }, setQuery] = useQueryParams();
|
@@ -869,7 +1109,7 @@ const PERMISSIONS = {
|
|
869
1109
|
read: [{ action: "plugin::i18n.locale.read", subject: null }]
|
870
1110
|
};
|
871
1111
|
const mutateEditViewHook = ({ layout }) => {
|
872
|
-
if ("i18n" in layout.options
|
1112
|
+
if (!("i18n" in layout.options) || typeof layout.options.i18n === "object" && layout.options.i18n !== null && "localized" in layout.options.i18n && !layout.options.i18n.localized) {
|
873
1113
|
return { layout };
|
874
1114
|
}
|
875
1115
|
const components = Object.entries(layout.components).reduce(
|
@@ -915,7 +1155,7 @@ const doesFieldHaveI18nPluginOpt = (pluginOpts) => {
|
|
915
1155
|
const LabelAction = ({ title, icon }) => {
|
916
1156
|
const { formatMessage } = useIntl();
|
917
1157
|
return /* @__PURE__ */ jsxs(Span, { tag: "span", children: [
|
918
|
-
/* @__PURE__ */ jsx(VisuallyHidden, { tag: "span", children:
|
1158
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { tag: "span", children: formatMessage(title) }),
|
919
1159
|
React.cloneElement(icon, {
|
920
1160
|
"aria-hidden": true,
|
921
1161
|
focusable: false
|
@@ -950,13 +1190,7 @@ const LocaleListCell = ({
|
|
950
1190
|
}
|
951
1191
|
});
|
952
1192
|
const { locale: language } = useIntl();
|
953
|
-
const [visible, setVisible] = React.useState(false);
|
954
|
-
const buttonRef = React.useRef(null);
|
955
1193
|
const { data: locales = [] } = useGetLocalesQuery();
|
956
|
-
const handleTogglePopover = (e) => {
|
957
|
-
e.stopPropagation();
|
958
|
-
setVisible((prev) => !prev);
|
959
|
-
};
|
960
1194
|
const formatter = useCollator(language, {
|
961
1195
|
sensitivity: "base"
|
962
1196
|
});
|
@@ -978,64 +1212,14 @@ const LocaleListCell = ({
|
|
978
1212
|
}
|
979
1213
|
return locale.name;
|
980
1214
|
}).toSorted((a, b) => formatter.compare(a, b));
|
981
|
-
return /* @__PURE__ */ jsxs(
|
982
|
-
/* @__PURE__ */ jsxs(
|
983
|
-
|
984
|
-
{
|
985
|
-
|
986
|
-
|
987
|
-
justifyContent: "center",
|
988
|
-
height: "3.2rem",
|
989
|
-
width: "3.2rem",
|
990
|
-
children: [
|
991
|
-
/* @__PURE__ */ jsx(Typography, { textColor: "neutral800", ellipsis: true, children: localesForDocument.join(", ") }),
|
992
|
-
/* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(CaretDown, {}) })
|
993
|
-
]
|
994
|
-
}
|
995
|
-
),
|
996
|
-
visible && /* @__PURE__ */ jsx(
|
997
|
-
Popover,
|
998
|
-
{
|
999
|
-
onDismiss: () => setVisible(false),
|
1000
|
-
source: buttonRef,
|
1001
|
-
spacing: 16,
|
1002
|
-
centered: true,
|
1003
|
-
children: /* @__PURE__ */ jsx("ul", { children: localesForDocument.map((name) => /* @__PURE__ */ jsx(Box, { padding: 3, tag: "li", children: /* @__PURE__ */ jsx(Typography, { children: name }) }, name)) })
|
1004
|
-
}
|
1005
|
-
)
|
1215
|
+
return /* @__PURE__ */ jsxs(Popover.Root, { children: [
|
1216
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(Button, { variant: "ghost", type: "button", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxs(Flex, { minWidth: "100%", alignItems: "center", justifyContent: "center", fontWeight: "regular", children: [
|
1217
|
+
/* @__PURE__ */ jsx(Typography, { textColor: "neutral800", ellipsis: true, marginRight: 2, children: localesForDocument.join(", ") }),
|
1218
|
+
/* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(CaretDown, { width: "1.2rem", height: "1.2rem" }) })
|
1219
|
+
] }) }) }),
|
1220
|
+
/* @__PURE__ */ jsx(Popover.Content, { sideOffset: 16, children: /* @__PURE__ */ jsx("ul", { children: localesForDocument.map((name) => /* @__PURE__ */ jsx(Box, { padding: 3, tag: "li", children: /* @__PURE__ */ jsx(Typography, { children: name }) }, name)) }) })
|
1006
1221
|
] });
|
1007
1222
|
};
|
1008
|
-
const Button = styled.button`
|
1009
|
-
width: 100%;
|
1010
|
-
|
1011
|
-
svg {
|
1012
|
-
> g,
|
1013
|
-
path {
|
1014
|
-
fill: ${({ theme }) => theme.colors.neutral500};
|
1015
|
-
}
|
1016
|
-
}
|
1017
|
-
&:hover {
|
1018
|
-
svg {
|
1019
|
-
> g,
|
1020
|
-
path {
|
1021
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
1022
|
-
}
|
1023
|
-
}
|
1024
|
-
}
|
1025
|
-
&:active {
|
1026
|
-
svg {
|
1027
|
-
> g,
|
1028
|
-
path {
|
1029
|
-
fill: ${({ theme }) => theme.colors.neutral400};
|
1030
|
-
}
|
1031
|
-
}
|
1032
|
-
}
|
1033
|
-
`;
|
1034
|
-
const ActionWrapper = styled(Flex)`
|
1035
|
-
svg {
|
1036
|
-
height: 0.4rem;
|
1037
|
-
}
|
1038
|
-
`;
|
1039
1223
|
const addColumnToTableHook = ({ displayedHeaders, layout }) => {
|
1040
1224
|
const { options } = layout;
|
1041
1225
|
const isFieldLocalized = doesPluginOptionsHaveI18nLocalized(options) ? options.i18n.localized : false;
|
@@ -1064,18 +1248,11 @@ const addColumnToTableHook = ({ displayedHeaders, layout }) => {
|
|
1064
1248
|
const addLocaleToReleasesHook = ({ displayedHeaders = [] }) => {
|
1065
1249
|
return {
|
1066
1250
|
displayedHeaders: [
|
1067
|
-
|
1068
|
-
// ...displayedHeaders,
|
1251
|
+
...displayedHeaders,
|
1069
1252
|
{
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
label: {
|
1074
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
1075
|
-
defaultMessage: "locale"
|
1076
|
-
},
|
1077
|
-
searchable: false,
|
1078
|
-
sortable: false
|
1253
|
+
label: {
|
1254
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
1255
|
+
defaultMessage: "locale"
|
1079
1256
|
},
|
1080
1257
|
name: "locale"
|
1081
1258
|
}
|
@@ -1223,8 +1400,6 @@ const index = {
|
|
1223
1400
|
app.addRBACMiddleware([localeMiddleware]);
|
1224
1401
|
app.registerPlugin({
|
1225
1402
|
id: pluginId,
|
1226
|
-
initializer: Initializer,
|
1227
|
-
isReady: false,
|
1228
1403
|
name: pluginId
|
1229
1404
|
});
|
1230
1405
|
},
|
@@ -1242,11 +1417,11 @@ const index = {
|
|
1242
1417
|
},
|
1243
1418
|
id: "internationalization",
|
1244
1419
|
to: "internationalization",
|
1245
|
-
Component: () => import("./SettingsPage-
|
1420
|
+
Component: () => import("./SettingsPage-BjxjwEOb.mjs").then((mod) => ({ default: mod.ProtectedSettingsPage })),
|
1246
1421
|
permissions: PERMISSIONS.accessMain
|
1247
1422
|
});
|
1248
1423
|
const contentManager = app.getPlugin("content-manager");
|
1249
|
-
contentManager.apis.addDocumentHeaderAction([LocalePickerAction]);
|
1424
|
+
contentManager.apis.addDocumentHeaderAction([LocalePickerAction, FillFromAnotherLocaleAction]);
|
1250
1425
|
contentManager.apis.addDocumentAction((actions) => {
|
1251
1426
|
const indexOfDeleteAction = actions.findIndex((action) => action.type === "delete");
|
1252
1427
|
actions.splice(indexOfDeleteAction, 0, DeleteLocaleAction);
|
@@ -1254,6 +1429,7 @@ const index = {
|
|
1254
1429
|
});
|
1255
1430
|
contentManager.apis.addDocumentAction((actions) => {
|
1256
1431
|
actions.splice(2, 0, BulkLocalePublishAction);
|
1432
|
+
actions.splice(5, 0, BulkLocaleUnpublishAction);
|
1257
1433
|
return actions;
|
1258
1434
|
});
|
1259
1435
|
contentManager.injectComponent("listView", "actions", {
|
@@ -1359,7 +1535,7 @@ const index = {
|
|
1359
1535
|
async registerTrads({ locales }) {
|
1360
1536
|
const importedTrads = await Promise.all(
|
1361
1537
|
locales.map((locale) => {
|
1362
|
-
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-
|
1538
|
+
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-2xztdZE1.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`).then(({ default: data }) => {
|
1363
1539
|
return {
|
1364
1540
|
data: prefixPluginTranslations(data, pluginId),
|
1365
1541
|
locale
|
@@ -1385,4 +1561,4 @@ export {
|
|
1385
1561
|
index as i,
|
1386
1562
|
useCreateLocaleMutation as u
|
1387
1563
|
};
|
1388
|
-
//# sourceMappingURL=index-
|
1564
|
+
//# sourceMappingURL=index-D-qx3tz4.mjs.map
|