Project

General

Profile

Actions

Bug #79879

closed

Missing translations for modal cancel / close buttons

Added by Alexander Stehlik about 7 years ago. Updated over 5 years ago.

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

100%

Estimated time:
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.


Files

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

Updated by Riccardo De Contardi over 6 years ago

  • Complexity set to easy
Actions #2

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

Actions #3

Updated by Florian Rival over 5 years 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);
Actions #4

Updated by Stefan Froemken over 5 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

Actions #5

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

Actions #6

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

Actions #7

Updated by Guido Schmechel over 5 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.

Actions #8

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

Actions #9

Updated by Stefan Froemken over 5 years ago

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

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions #11

Updated by Florian Rival over 5 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');
        }
    ...
    }
Actions

Also available in: Atom PDF