Bug #79879

Missing translations for modal cancel / close buttons

Added by Alexander Stehlik over 3 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Localization
Target version:
-
Start date:
2017-02-17
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

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:

  1. Add 'button.ok' and 'button.cancel to the TYPO3.lang array by default
  2. 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.

Delete file.png View (74.9 KB) Florian Rival, 2018-09-03 16:03

Associated revisions

Revision c44dae9d (diff)
Added by Stefan Froemken over 1 year ago

[BUGFIX] Add missing language file for ContextMenu

Confirmation Modal shows buttons with translated button labels now, if
you try to delete a page from page-tree.

Resolves: #79879
Releases: master, 8.7
Change-Id: Iff2ed8205bdcc54b48ba301035cd0aac9c2de826
Reviewed-on: https://review.typo3.org/58186
Tested-by: TYPO3com <>
Reviewed-by: Wouter Wolters <>
Reviewed-by: Guido Schmechel <>
Tested-by: Guido Schmechel <>
Reviewed-by: Jörg Bösche <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

Revision 36554887 (diff)
Added by Stefan Froemken over 1 year ago

[BUGFIX] Add missing language file for ContextMenu

Confirmation Modal shows buttons with translated button labels now, if
you try to delete a page from page-tree.

Resolves: #79879
Releases: master, 8.7
Change-Id: Iff2ed8205bdcc54b48ba301035cd0aac9c2de826
Reviewed-on: https://review.typo3.org/58318
Tested-by: TYPO3com <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

History

#1 Updated by Riccardo De Contardi over 2 years ago

  • Complexity set to easy

#2 Updated by Sybille Peters about 2 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

#3 Updated by Florian Rival over 1 year ago

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);

#4 Updated by Stefan Froemken over 1 year 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

#5 Updated by Gerrit Code Review over 1 year 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

#6 Updated by Gerrit Code Review over 1 year 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

#7 Updated by Guido Schmechel over 1 year 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.

#8 Updated by Gerrit Code Review over 1 year 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

#9 Updated by Stefan Froemken over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#10 Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed

#11 Updated by Florian Rival over 1 year 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');
        }
    ...
    }

Also available in: Atom PDF