Skip to content
Snippets Groups Projects
Commit d9c672f7 authored by Wouter Wolters's avatar Wouter Wolters Committed by Andreas Fernandez
Browse files

[TASK] Make text translatable in ShortcutMenu JavaScript

Resolve the todo's for translations and notification.

Resolves: #73505
Releases: master, 7.6
Change-Id: I43cb48fcd7efeb388ed5c54c9df7464ee4e0472d
Reviewed-on: https://review.typo3.org/46728


Reviewed-by: default avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: default avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: default avatarAndreas Fernandez <typo3@scripting-base.de>
Tested-by: default avatarAndreas Fernandez <typo3@scripting-base.de>
parent 7ad3cd5f
Branches
Tags
No related merge requests found
...@@ -102,6 +102,14 @@ class ShortcutToolbarItem implements ToolbarItemInterface ...@@ -102,6 +102,14 @@ class ShortcutToolbarItem implements ToolbarItemInterface
$this->shortcuts = $this->initShortcuts(); $this->shortcuts = $this->initShortcuts();
$this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Toolbar/ShortcutMenu'); $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'),
]);
} }
/** /**
......
...@@ -16,7 +16,11 @@ ...@@ -16,7 +16,11 @@
* shortcut menu logic to add new shortcut, remove a shortcut * shortcut menu logic to add new shortcut, remove a shortcut
* and edit 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'; 'use strict';
/** /**
...@@ -75,7 +79,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons'], functio ...@@ -75,7 +79,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons'], functio
type: 'post', type: 'post',
cache: false cache: false
}).done(function(data) { }).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(); ShortcutMenu.refreshMenu();
}); });
}; };
...@@ -86,8 +90,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons'], functio ...@@ -86,8 +90,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons'], functio
* @param {Object} $shortcutRecord * @param {Object} $shortcutRecord
*/ */
ShortcutMenu.deleteShortcut = function($shortcutRecord) { ShortcutMenu.deleteShortcut = function($shortcutRecord) {
// @todo: translations Modal.confirm(TYPO3.lang['bookmark.delete'], TYPO3.lang['bookmark.confirmDelete'])
Modal.confirm('Delete bookmark', 'Do you really want to remove this bookmark?')
.on('confirm.button.ok', function() { .on('confirm.button.ok', function() {
$.ajax({ $.ajax({
url: TYPO3.settings.ajaxUrls['shortcut_remove'], url: TYPO3.settings.ajaxUrls['shortcut_remove'],
...@@ -122,8 +125,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons'], functio ...@@ -122,8 +125,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons'], functio
*/ */
ShortcutMenu.createShortcut = function(moduleName, url, confirmationText, motherModule, shortcutButton, displayName) { ShortcutMenu.createShortcut = function(moduleName, url, confirmationText, motherModule, shortcutButton, displayName) {
if (typeof confirmationText !== 'undefined') { if (typeof confirmationText !== 'undefined') {
// @todo: translations Modal.confirm(TYPO3.lang['bookmark.create'], confirmationText)
Modal.confirm('Create bookmark', confirmationText)
.on('confirm.button.ok', function() { .on('confirm.button.ok', function() {
var $toolbarItemIcon = $(ShortcutMenu.options.toolbarIconSelector, ShortcutMenu.options.containerSelector), var $toolbarItemIcon = $(ShortcutMenu.options.toolbarIconSelector, ShortcutMenu.options.containerSelector),
$existingIcon = $toolbarItemIcon.clone(); $existingIcon = $toolbarItemIcon.clone();
......
...@@ -1173,6 +1173,18 @@ Do you want to refresh it now?</source> ...@@ -1173,6 +1173,18 @@ Do you want to refresh it now?</source>
<trans-unit id="toolbarItems.bookmarksDelete"> <trans-unit id="toolbarItems.bookmarksDelete">
<source>Delete bookmark</source> <source>Delete bookmark</source>
</trans-unit> </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"> <trans-unit id="toolbarItems.search">
<source>Search</source> <source>Search</source>
</trans-unit> </trans-unit>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment