[TASK] Make text translatable in ShortcutMenu JavaScript 76/46776/2
authorWouter Wolters <typo3@wouterwolters.nl>
Tue, 16 Feb 2016 19:48:30 +0000 (20:48 +0100)
committerAndreas Fernandez <typo3@scripting-base.de>
Fri, 19 Feb 2016 13:47:33 +0000 (14:47 +0100)
Resolve the todo's for translations and notification.

Resolves: #73505
Releases: master, 7.6
Change-Id: I43cb48fcd7efeb388ed5c54c9df7464ee4e0472d
Reviewed-on: https://review.typo3.org/46776
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php
typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js
typo3/sysext/lang/locallang_core.xlf

index f7020ac..3d9aed0 100644 (file)
@@ -99,6 +99,14 @@ class ShortcutToolbarItem implements ToolbarItemInterface
         $this->shortcuts = $this->initShortcuts();
 
         $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Toolbar/ShortcutMenu');
+        $languageService = $this->getLanguageService();
+        $this->getPageRenderer()->addInlineLanguageLabelArray([
+            'bookmark.delete' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarksDelete'),
+            'bookmark.confirmDelete' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.confirmBookmarksDelete'),
+            'bookmark.create' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.createBookmark'),
+            'bookmark.savedTitle' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarkSavedTitle'),
+            'bookmark.savedMessage' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarkSavedMessage'),
+        ]);
     }
 
     /**
index 6f917db..b2ff220 100644 (file)
  * shortcut menu logic to add new shortcut, remove a shortcut
  * and edit a shortcut
  */
-define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons'], function($, Modal, Icons) {
+define(['jquery',
+               'TYPO3/CMS/Backend/Modal',
+               'TYPO3/CMS/Backend/Icons',
+               'TYPO3/CMS/Backend/Notification'
+       ], function($, Modal, Icons, Notification) {
        'use strict';
 
        /**
@@ -75,7 +79,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons'], functio
                        type: 'post',
                        cache: false
                }).done(function(data) {
-                       // @todo: we can evaluate here, but what to do? a message?
+                       Notification.success(TYPO3.lang['bookmark.savedTitle'], TYPO3.lang['bookmark.savedMessage']);
                        ShortcutMenu.refreshMenu();
                });
        };
@@ -86,8 +90,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons'], functio
         * @param {Object} $shortcutRecord
         */
        ShortcutMenu.deleteShortcut = function($shortcutRecord) {
-               // @todo: translations
-               Modal.confirm('Delete bookmark', 'Do you really want to remove this bookmark?')
+               Modal.confirm(TYPO3.lang['bookmark.delete'], TYPO3.lang['bookmark.confirmDelete'])
                        .on('confirm.button.ok', function() {
                                $.ajax({
                                        url: TYPO3.settings.ajaxUrls['shortcut_remove'],
@@ -122,8 +125,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons'], functio
         */
        ShortcutMenu.createShortcut = function(moduleName, url, confirmationText, motherModule, shortcutButton, displayName) {
                if (typeof confirmationText !== 'undefined') {
-                       // @todo: translations
-                       Modal.confirm('Create bookmark', confirmationText)
+                       Modal.confirm(TYPO3.lang['bookmark.create'], confirmationText)
                                .on('confirm.button.ok', function() {
                                        var $toolbarItemIcon = $(ShortcutMenu.options.toolbarIconSelector, ShortcutMenu.options.containerSelector),
                                                $existingIcon = $toolbarItemIcon.clone();
index 56e07f3..e5c7791 100644 (file)
@@ -1173,6 +1173,18 @@ Do you want to refresh it now?</source>
                        <trans-unit id="toolbarItems.bookmarksDelete">
                                <source>Delete bookmark</source>
                        </trans-unit>
+                       <trans-unit id="toolbarItems.confirmBookmarksDelete">
+                               <source>Do you really want to remove this bookmark?</source>
+                       </trans-unit>
+                       <trans-unit id="toolbarItems.createBookmark">
+                               <source>Create bookmark</source>
+                       </trans-unit>
+                       <trans-unit id="toolbarItems.bookmarkSavedTitle">
+                               <source>Bookmark saved</source>
+                       </trans-unit>
+                       <trans-unit id="toolbarItems.bookmarkSavedMessage">
+                               <source>The bookmark was saved.</source>
+                       </trans-unit>
                        <trans-unit id="toolbarItems.search">
                                <source>Search</source>
                        </trans-unit>