Bug #79879
closed
Missing translations for modal cancel / close buttons
Added by Alexander Stehlik almost 8 years ago.
Updated about 6 years ago.
Description
The cancel / close buttons of modals are not translated. Noticed in these use cases:
- Moving a file in the file list
- Reload required dialog of the form engine (e.g. when changing the page type)
Those problems seem to come from the typo3/sysext/backend/Resources/Public/JavaScript/Modal.js
code.
Modal.confirm
tries to use translations as defaults which do not exist:
text: $(this).data('button-close-text') || TYPO3.lang['button.cancel'] || 'Cancel',
The initialization for the .t3js-modal-trigger
markup does not even try to use translations. It uses a hardcoded "close" string.
My suggestion so solve this issue would be:
- Add
'button.ok'
and 'button.cancel
to the TYPO3.lang
array by default
- Use those translations in both modals as default fallback
I can provide a patch if you can point me to the place where I can add translations to TYPO3.lang
by default. I do not want to put it in the PageRenderer.
Files
Thank you for your report.
About your question: It might be a good idea to ask it on Slack in the #typo3-cms-coredev channel.
Also, if your issue is no longer reproducable, please let us know in the slack channel, so that this issue can be closed.
Thank you in advance!
Sybille
Same problem for me with Typo3 V8.
I've found missing translation for modal box in that case :
Delete a file via Typo3 BE file manager¶
See attached file.
Add a delete button throught an extension¶
$warningText = $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_mod_web_list.xlf:deleteWarning')
. ' "' . $recordTitle . '" ' . '[' . $tablename . ':' . $row['uid'] . ']';
$params = 'cmd[' . $tablename . '][' . $uid . '][delete]=1';
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$icon = $iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render();
$linkTitle = htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_mod_web_list.xlf:delete'));
$deleteAction = '<a class="btn btn-default t3js-record-delete" href="#" '
. ' data-l10parent="' . htmlspecialchars($l10nparent) . '"'
. ' data-params="' . htmlspecialchars($params) . '" data-title="' . htmlspecialchars($recordTitle) . '"'
. ' data-message="' . htmlspecialchars($warningText) . '" title="' . $linkTitle . '"'
. '>' . $icon . '</a>';
return ($deleteAction);
I have used the pre-render hook of PageRenderer to fix that:
public function addLanguageFile(array $parameters, PageRenderer $pageRenderer)
{
$pageRenderer->addInlineLanguageLabelFile('EXT:lang/Resources/Private/Language/locallang_mod_web_list.xlf');
}
Stefan
- Status changed from New to Under Review
Problem also exists if you click on the delete button. (9.5-dev)
But the patch fixes the problem with the modal for the page tree action.
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
I tried to apply the patch with a TYPO3 version 8.7 but the problem remains the same.
Even if I clear all caches.
But I can confirm Stefan Froemken's workaround : pre-render hook of PageRenderer.
So I think a simple solution could be to add this code in \TYPO3\CMS\Backend\Controller\BackendController :
protected function renderJavaScriptAndCss()
{
if (TYPO3_MODE === 'BE') {
$this->addInlineLanguageLabelFile('EXT:lang/Resources/Private/Language/locallang_mod_web_list.xlf');
}
...
}
Also available in: Atom
PDF