From 868e616f4188f2d787e1f74bf78314981ab34bb1 Mon Sep 17 00:00:00 2001
From: Wouter Wolters <typo3@wouterwolters.nl>
Date: Wed, 4 Aug 2021 16:44:46 +0200
Subject: [PATCH] [BUGFIX] Fix label of remove from clipboard icons cut and
 copy

The labels are now Cut or Copy when the icon is shown is about releasing
the content from the clipboard.

Resolves: #94627
Releases: master
Change-Id: If5f4784f117f02ae7808849aec540f8b322196ae
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70200
Tested-by: core-ci <typo3@b13.com>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
---
 .../Resources/Private/Language/locallang_core.xlf    |  3 +++
 typo3/sysext/filelist/Classes/FileList.php           | 10 ++++++----
 .../Classes/RecordList/DatabaseRecordList.php        | 12 ++++++++----
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/typo3/sysext/core/Resources/Private/Language/locallang_core.xlf b/typo3/sysext/core/Resources/Private/Language/locallang_core.xlf
index a137291d7f63..06d59a61dd79 100644
--- a/typo3/sysext/core/Resources/Private/Language/locallang_core.xlf
+++ b/typo3/sysext/core/Resources/Private/Language/locallang_core.xlf
@@ -993,6 +993,9 @@ Do you want to refresh it now?</source>
 			<trans-unit id="cm.copy" resname="cm.copy">
 				<source>Copy</source>
 			</trans-unit>
+			<trans-unit id="cm.copyrelease" resname="cm.copyrelease">
+				<source>Copy release</source>
+			</trans-unit>
 			<trans-unit id="cm.cut" resname="cm.cut">
 				<source>Cut</source>
 			</trans-unit>
diff --git a/typo3/sysext/filelist/Classes/FileList.php b/typo3/sysext/filelist/Classes/FileList.php
index c408c1bceba1..36c07e04697e 100644
--- a/typo3/sysext/filelist/Classes/FileList.php
+++ b/typo3/sysext/filelist/Classes/FileList.php
@@ -915,15 +915,17 @@ class FileList
         // For normal clipboard, add copy/cut buttons:
         if ($this->clipObj->current === 'normal') {
             $isSel = $this->clipObj->isSelected('_FILE', $md5);
-            $copyTitle = htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.copy'));
-            $cutTitle = htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.cut'));
+            $copyTitle = $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.copy');
+            $cutTitle = $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.cut');
             $copyIcon = $this->iconFactory->getIcon('actions-edit-copy', Icon::SIZE_SMALL)->render();
             $cutIcon = $this->iconFactory->getIcon('actions-edit-cut', Icon::SIZE_SMALL)->render();
 
             if ($isSel === 'copy') {
                 $copyIcon = $this->iconFactory->getIcon('actions-edit-copy-release', Icon::SIZE_SMALL)->render();
+                $copyTitle = $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.copyrelease');
             } elseif ($isSel === 'cut') {
                 $cutIcon = $this->iconFactory->getIcon('actions-edit-cut-release', Icon::SIZE_SMALL)->render();
+                $cutTitle = $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.cutrelease');
             }
 
             if ($fileOrFolderObject->checkActionPermission('copy')) {
@@ -931,7 +933,7 @@ class FileList
                     $fullIdentifier,
                     true,
                     $isSel === 'copy'
-                )) . '" title="' . $copyTitle . '">' . $copyIcon . '</a>';
+                )) . '" title="' . htmlspecialchars($copyTitle) . '">' . $copyIcon . '</a>';
             } else {
                 $cells[] = $this->spaceIcon;
             }
@@ -941,7 +943,7 @@ class FileList
                     $fullIdentifier,
                     false,
                     $isSel === 'cut'
-                )) . '" title="' . $cutTitle . '">' . $cutIcon . '</a>';
+                )) . '" title="' . htmlspecialchars($cutTitle) . '">' . $cutIcon . '</a>';
             } else {
                 $cells[] = $this->spaceIcon;
             }
diff --git a/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php b/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
index b5b2e631f409..ae9ecdd72549 100644
--- a/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
+++ b/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
@@ -1838,12 +1838,16 @@ class DatabaseRecordList
                 $cells['cut'] = $this->spaceIcon;
             } else {
                 $copyIcon = $this->iconFactory->getIcon('actions-edit-copy', Icon::SIZE_SMALL);
+                $copyTitle = $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.copy');
                 $cutIcon = $this->iconFactory->getIcon('actions-edit-cut', Icon::SIZE_SMALL);
+                $cutTitle = $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.cut');
 
                 if ($isSel === 'copy') {
                     $copyIcon = $this->iconFactory->getIcon('actions-edit-copy-release', Icon::SIZE_SMALL);
+                    $copyTitle = $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.copyrelease');
                 } elseif ($isSel === 'cut') {
                     $cutIcon = $this->iconFactory->getIcon('actions-edit-cut-release', Icon::SIZE_SMALL);
+                    $cutTitle = $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.cutrelease');
                 }
 
                 $cells['copy'] = '<a class="btn btn-default"'
@@ -1854,8 +1858,8 @@ class DatabaseRecordList
                         $isSel === 'copy',
                         ['returnUrl' => $this->listURL()]
                     )) . '"'
-                    . ' title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.copy')) . '"'
-                    . ' aria-label="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.copy')) . '">'
+                    . ' title="' . htmlspecialchars($copyTitle) . '"'
+                    . ' aria-label="' . htmlspecialchars($copyTitle) . '">'
                     . $copyIcon->render()
                     . '</a>';
 
@@ -1876,8 +1880,8 @@ class DatabaseRecordList
                             $isSel === 'cut',
                             ['returnUrl' => $this->listURL()]
                         )) . '"'
-                        . ' title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.cut')) . '"'
-                        . ' aria-label="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.cut')) . '">'
+                        . ' title="' . htmlspecialchars($cutTitle) . '"'
+                        . ' aria-label="' . htmlspecialchars($cutTitle) . '">'
                         . $cutIcon->render()
                         . '</a>';
                 } else {
-- 
GitLab