diff --git a/packages/neos-ui/src/Containers/Modals/DeleteNode/index.js b/packages/neos-ui/src/Containers/Modals/DeleteNode/index.js index aa35fa3981..33ec1d2546 100644 --- a/packages/neos-ui/src/Containers/Modals/DeleteNode/index.js +++ b/packages/neos-ui/src/Containers/Modals/DeleteNode/index.js @@ -6,7 +6,6 @@ import {$get, $transform} from 'plow-js'; import Button from '@neos-project/react-ui-components/src/Button/'; import Dialog from '@neos-project/react-ui-components/src/Dialog/'; import Icon from '@neos-project/react-ui-components/src/Icon/'; -import I18n from '@neos-project/neos-ui-i18n'; import {selectors, actions} from '@neos-project/neos-ui-redux-store'; import {neos} from '@neos-project/neos-ui-decorators'; @@ -48,42 +47,47 @@ export default class DeleteNodeModal extends PureComponent { } renderTitle() { - const {nodesToBeDeletedContextPaths, getNodeByContextPath, nodeTypesRegistry} = this.props; + const {nodesToBeDeletedContextPaths, getNodeByContextPath, nodeTypesRegistry, i18nRegistry} = this.props; if (nodesToBeDeletedContextPaths.length === 1) { const singleNodeToBeDeletedContextPath = nodesToBeDeletedContextPaths[0]; const node = getNodeByContextPath(singleNodeToBeDeletedContextPath); const nodeType = $get('nodeType', node); const nodeTypeLabel = $get('ui.label', nodeTypesRegistry.get(nodeType)) || 'Neos.Neos:Main:node'; + const nodeTypeLabelText = i18nRegistry.translate(nodeTypeLabel, 'Node') + const deleteLabel = i18nRegistry.translate('delete', 'Delete') return (
- + {deleteLabel}   - + {nodeTypeLabelText}   "{$get('label', node)}"
); } + + const deleteMultipleNodesLabel = i18nRegistry.translate( + 'deleteXNodes', + 'Delete multiple nodes', + {amount: nodesToBeDeletedContextPaths.length}, + 'Neos.Neos.Ui', + 'Main' + ) return (
- + {deleteMultipleNodesLabel}
); } renderAbort() { + const abortLabel = this.props.i18nRegistry.translate('cancel', 'Cancel') return ( ); } renderConfirm() { + const confirmationLabel = this.props.i18nRegistry.translate('deleteConfirm', 'Confirm') return ( ); } render() { - const {nodesToBeDeletedContextPaths, getNodeByContextPath, i18nRegistry} = this.props; - let node = null; - if (nodesToBeDeletedContextPaths.length === 1) { - const singleNodeToBeDeletedContextPath = nodesToBeDeletedContextPaths[0]; - node = getNodeByContextPath(singleNodeToBeDeletedContextPath); - } + const {nodesToBeDeletedContextPaths, getNodeByContextPath, i18nRegistry, nodeTypesRegistry} = this.props; if (nodesToBeDeletedContextPaths.length === 0) { return null; } + let node = null; + const warnings = []; + + nodesToBeDeletedContextPaths.forEach(nodeToBeDeleted => { + node = getNodeByContextPath(nodeToBeDeleted); + const nodeLabel = $get('label', node); + const deleteMessage = $get('ui.deleteConfirmation.message', nodeTypesRegistry.get(node.nodeType)); + const nodeType = $get('ui.label', nodeTypesRegistry.get(node.nodeType)) + warnings.push({ + 'deleteMessage': i18nRegistry.translate(deleteMessage), + 'nodeType': i18nRegistry.translate(nodeType, 'Node'), + 'nodeLabelTruncated': nodeLabel.substring(0, 30).substring(0, nodeLabel.substring(0, 30).lastIndexOf(' ')), + nodeLabel + }); + }); return (
- -   {nodesToBeDeletedContextPaths.length > 1 ? `${nodesToBeDeletedContextPaths.length} ${i18nRegistry.translate('nodes', 'nodes', {}, 'Neos.Neos.Ui', 'Main')}` : `"${$get('label', node)}"`}? +

+ {i18nRegistry.translate('content.navigate.deleteNodeDialog.header')} +   {nodesToBeDeletedContextPaths.length > 1 ? `${nodesToBeDeletedContextPaths.length} ${i18nRegistry.translate('nodes', 'nodes', {}, 'Neos.Neos.Ui', 'Main')}` : `"${$get('label', node)}"`}? +

+ {warnings.length > 0 ?
: ''} + {warnings.map((warning, index) =>

+ {warning.nodeType} + "{warning.nodeLabelTruncated + (warning.nodeLabelTruncated < warning.nodeLabel ? '...' : '')}" + : + {warning.deleteMessage}

+ )}
);