Bug #79879
closedMissing translations for modal cancel / close buttons
100%
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 theTYPO3.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
Updated by Sybille Peters over 6 years ago
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
Updated by Florian Rival about 6 years ago
- File Delete file.png Delete file.png added
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);
Updated by Stefan Froemken about 6 years ago
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
Updated by Gerrit Code Review about 6 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58186
Updated by Gerrit Code Review about 6 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58186
Updated by Guido Schmechel about 6 years ago
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.
Updated by Gerrit Code Review about 6 years ago
Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58318
Updated by Stefan Froemken about 6 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset c44dae9d7a889ce154ff176da2b16d9183a2464d.
Updated by Florian Rival about 6 years ago
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');
}
...
}