From 623b20391e6b31e295259980ad27ae85eb650a3d Mon Sep 17 00:00:00 2001
From: Oliver Bartsch <bo@cedev.de>
Date: Fri, 18 Sep 2020 18:09:46 +0200
Subject: [PATCH] [FEATURE] Make label of bookmarkGroups translatable

Add possibility to use language labels as value for the
user TSconfig `options.bookmarkGroups` option.

Resolves: #15760
Resolves: #92337
Releases: master
Change-Id: I0e0e2467b8ab87b05ec432f09d65abc676081228
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65764
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Georg Tiefenbrunn <georg.tiefenbrunn@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
---
 .../Backend/Shortcut/ShortcutRepository.php   |  3 +-
 ...lowTranslatableLabelsForBookmarkGroups.rst | 31 +++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Feature-92337-AllowTranslatableLabelsForBookmarkGroups.rst

diff --git a/typo3/sysext/backend/Classes/Backend/Shortcut/ShortcutRepository.php b/typo3/sysext/backend/Classes/Backend/Shortcut/ShortcutRepository.php
index 1e55a1f5141e..6a9989a43032 100644
--- a/typo3/sysext/backend/Classes/Backend/Shortcut/ShortcutRepository.php
+++ b/typo3/sysext/backend/Classes/Backend/Shortcut/ShortcutRepository.php
@@ -395,7 +395,8 @@ class ShortcutRepository
         if (is_array($bookmarkGroups)) {
             foreach ($bookmarkGroups as $groupId => $label) {
                 if (!empty($label)) {
-                    $shortcutGroups[$groupId] = (string)$label;
+                    $label = (string)$label;
+                    $shortcutGroups[$groupId] = strpos($label, 'LLL:') === 0 ? $languageService->sL($label) : $label;
                 } elseif ($backendUser->isAdmin()) {
                     unset($shortcutGroups[$groupId]);
                 }
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-92337-AllowTranslatableLabelsForBookmarkGroups.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-92337-AllowTranslatableLabelsForBookmarkGroups.rst
new file mode 100644
index 000000000000..df6c65dd17cf
--- /dev/null
+++ b/typo3/sysext/core/Documentation/Changelog/master/Feature-92337-AllowTranslatableLabelsForBookmarkGroups.rst
@@ -0,0 +1,31 @@
+.. include:: ../../Includes.txt
+
+===============================================================
+Feature: #92337 - Allow translatable labels for bookmark groups
+===============================================================
+
+See :issue:`92337`
+
+Description
+===========
+
+The user TSconfig `options.bookmarkGroups` option allows to configure the bookmark
+groups that can be accessed by the user. In addition to that, it's also possible
+to define custom labels for each group as simple :php:`string`. Extended TSconfig
+syntax now allows the LLL prefix for the use of language labels.
+
+
+Example
+=======
+
+.. code-block:: ts
+
+   options.bookmarkGroups.2 = LLL:EXT:sitepackage/Resources/Private/Language/locallang_be.xlf:bookmarkGroups.2
+
+
+Impact
+======
+
+It is now possible to use custom language labels for bookmark groups.
+
+.. index:: Backend, TSConfig, ext:backend
-- 
GitLab