Commit 32d70c6e authored by Georg Ringer's avatar Georg Ringer
Browse files

[BUGFIX] Use editors language in admin panel instead of site language

The translations need to use the language of the current backend user
and not the one of the current language of the site in the frontend.

Resolves: #96004
Releases: master, 11.5, 10.4
Change-Id: Id409e759de4f0324835cc932f87719147b6e1b0f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72196

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Jochen's avatarJochen <rothjochen@gmail.com>
Tested-by: Sybille Peters's avatarSybille Peters <sypets@gmx.de>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Simon Schaufelberger's avatarSimon Schaufelberger <simonschaufi+typo3@gmail.com>
Reviewed-by: Jochen's avatarJochen <rothjochen@gmail.com>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
parent d0970e45
......@@ -31,6 +31,7 @@ use TYPO3\CMS\Adminpanel\Service\ModuleLoader;
use TYPO3\CMS\Adminpanel\Utility\ResourceUtility;
use TYPO3\CMS\Adminpanel\Utility\StateUtility;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -126,6 +127,7 @@ class MainController implements SingletonInterface
'toggleActiveUrl' => $this->generateBackendUrl('ajax_adminPanel_toggle'),
'resources' => $resources,
'adminPanelActive' => StateUtility::isOpen(),
'languageKey' => $this->getBackendUser()->user['lang'],
]
);
if (StateUtility::isOpen()) {
......@@ -238,4 +240,9 @@ class MainController implements SingletonInterface
}
return $data;
}
protected function getBackendUser(): BackendUserAuthentication
{
return $GLOBALS['BE_USER'];
}
}
......@@ -17,6 +17,7 @@ declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\ModuleApi;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Localization\LanguageService;
/**
......@@ -35,4 +36,9 @@ abstract class AbstractSubModule implements ModuleInterface, ContentProviderInte
{
return $GLOBALS['LANG'];
}
protected function getBackendUser(): BackendUserAuthentication
{
return $GLOBALS['BE_USER'];
}
}
......@@ -68,6 +68,7 @@ class CacheModule extends AbstractModule implements PageSettingsProviderInterfac
'cacheCmd' => $pageId,
]
),
'languageKey' => $this->getBackendUser()->user['lang'],
]
);
......
......@@ -72,6 +72,7 @@ class Events extends AbstractSubModule implements DataProviderInterface
$dumper->setTheme('light');
$view->assign('events', $dumper->dump($events, true));
$view->assign('languageKey', $this->getBackendUser()->user['lang']);
return $view->render();
}
......
......@@ -114,6 +114,7 @@ class Log extends AbstractSubModule implements DataProviderInterface, ModuleSett
$templateNameAndPath = 'EXT:adminpanel/Resources/Private/Templates/Modules/Debug/LogSettings.html';
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($templateNameAndPath));
$view->setPartialRootPaths(['EXT:adminpanel/Resources/Private/Partials']);
$view->assign('languageKey', $this->getBackendUser()->user['lang']);
$maxLevel = LogLevel::normalizeLevel(LogLevel::DEBUG);
$levels = [];
......@@ -171,6 +172,7 @@ class Log extends AbstractSubModule implements DataProviderInterface, ModuleSett
$data['groupByComponent'] = $groupByComponent;
$data['groupByLevel'] = $groupByLevel;
$view->assignMultiple($data->getArrayCopy());
$view->assign('languageKey', $this->getBackendUser()->user['lang']);
return $view->render();
}
......
......@@ -105,6 +105,7 @@ class PageTitle extends AbstractSubModule implements DataProviderInterface
);
$this->getLanguageService()->includeLLFile('EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf');
$view->assignMultiple($data->getArrayCopy());
$view->assign('languageKey', $this->getBackendUser()->user['lang']);
return $view->render();
}
......
......@@ -87,6 +87,7 @@ class QueryInformation extends AbstractSubModule implements DataProviderInterfac
);
$this->getLanguageService()->includeLLFile('EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf');
$view->assignMultiple($data->getArrayCopy());
$view->assign('languageKey', $this->getBackendUser()->user['lang']);
return $view->render();
}
......
......@@ -84,6 +84,7 @@ class GeneralInformation extends AbstractSubModule implements DataProviderInterf
$view->setPartialRootPaths(['EXT:adminpanel/Resources/Private/Partials']);
$view->assignMultiple($data->getArrayCopy());
$view->assign('languageKey', $this->getBackendUser()->user['lang']);
return $view->render();
}
......
......@@ -79,6 +79,7 @@ class PhpInformation extends AbstractSubModule implements DataProviderInterface
$view->setPartialRootPaths(['EXT:adminpanel/Resources/Private/Partials']);
$view->assignMultiple($data->getArrayCopy());
$view->assign('languageKey', $this->getBackendUser()->user['lang']);
return $view->render();
}
......
......@@ -76,6 +76,7 @@ class RequestInformation extends AbstractSubModule implements DataProviderInterf
$view->setPartialRootPaths(['EXT:adminpanel/Resources/Private/Partials']);
$view->assignMultiple($data->getArrayCopy());
$view->assign('languageKey', $this->getBackendUser()->user['lang']);
return $view->render();
}
......
......@@ -73,6 +73,7 @@ class UserIntInformation extends AbstractSubModule implements DataProviderInterf
$view->setPartialRootPaths(['EXT:adminpanel/Resources/Private/Partials']);
$view->assignMultiple($data->getArrayCopy());
$view->assign('languageKey', $this->getBackendUser()->user['lang']);
return $view->render();
}
......
......@@ -129,6 +129,7 @@ class PreviewModule extends AbstractModule implements RequestEnricherInterface,
'availableGroups' => $frontendGroupsRepository->getAvailableFrontendUserGroups(),
'selected' => (int)$this->config['simulateUserGroup'],
],
'languageKey' => $this->getBackendUser()->user['lang'],
]
);
return $view->render();
......
......@@ -103,6 +103,7 @@ class TypoScriptWaterfall extends AbstractSubModule implements RequestEnricherIn
'trackContentRendering' => (int)$this->getConfigurationOption('LR'),
'forceTemplateParsing' => (int)$this->getConfigurationOption('forceTemplateParsing'),
'typoScriptLog' => $this->renderTypoScriptLog(),
'languageKey' => $this->getBackendUser()->user['lang'],
]
);
......@@ -129,6 +130,7 @@ class TypoScriptWaterfall extends AbstractSubModule implements RequestEnricherIn
],
'trackContentRendering' => (int)$this->getConfigurationOption('LR'),
'forceTemplateParsing' => (int)$this->getConfigurationOption('forceTemplateParsing'),
'languageKey' => $this->getBackendUser()->user['lang'],
]
);
......
......@@ -7,15 +7,15 @@
<table class="typo3-adminPanel-table typo3-adminPanel-table-debug">
<thead>
<tr>
<th scope="col" class="typo3-adminPanel-table-cell-key"><f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_info.xlf:key"/></th>
<th scope="col"><f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_info.xlf:value"/></th>
<th scope="col" class="typo3-adminPanel-table-cell-key"><f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_info.xlf:key" languageKey="{languageKey}"/></th>
<th scope="col"><f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_info.xlf:value" languageKey="{languageKey}"/></th>
</tr>
</thead>
<tbody>
<f:for each="{data}" as="val" key="key">
<tr>
<th scope="row" class="typo3-adminPanel-table-cell-key">
<f:translate key="{key}" default="{key}" extensionName="adminpanel"/>
<f:translate key="{key}" default="{key}" extensionName="adminpanel" languageKey="{languageKey}"/>
</th>
<td>
<f:variable name="typeClass" value="string" />
......@@ -24,10 +24,10 @@
<f:if condition="{adm:isArray(value: val)}"><f:variable name="typeClass" value="array" /></f:if>
<f:switch expression="{typeClass}">
<f:case value="string">
<pre class="typo3-adminPanel-dump typo3-adminPanel-dump-{typeClass}"><f:if condition="{val}"><f:translate key="{val}" default="{val}" extensionName="adminpanel"/></f:if></pre>
<pre class="typo3-adminPanel-dump typo3-adminPanel-dump-{typeClass}"><f:if condition="{val}"><f:translate key="{val}" default="{val}" extensionName="adminpanel" languageKey="{languageKey}"/></f:if></pre>
</f:case>
<f:case value="array">
<f:render partial="Data/TableKeyValue" arguments="{data: val}" />
<f:render partial="Data/TableKeyValue" arguments="{data: val, languageKey: languageKey}" />
</f:case>
<f:defaultCase>
<pre class="typo3-adminPanel-dump typo3-adminPanel-dump-{typeClass}">{val}</pre>
......
......@@ -5,7 +5,7 @@
<input type="hidden" name="TSFE_ADMIN_PANEL[{name}]" value="0"/>
<input type="checkbox" id="{name}" name="TSFE_ADMIN_PANEL[{name}]" value="1" class="typo3-adminPanel-form-checkbox-input"{f:if(condition: value, then:' checked="checked"')} />
<label for="{name}" class="typo3-adminPanel-form-checkbox-label">
<f:translate key="{label}" default="{label}" extensionName="adminpanel"/>
<f:translate key="{label}" default="{label}" extensionName="adminpanel" languageKey="{languageKey}"/>
</label>
</div>
</div>
......
......@@ -3,7 +3,7 @@
<div class="typo3-adminPanel-form-group">
<div class="typo3-adminPanel-form-datetime">
<label for="{name}" class="typo3-adminPanel-form-datetime-label">
<f:translate key="{label}" default="{label}" extensionName="adminpanel"/>
<f:translate key="{label}" default="{label}" extensionName="adminpanel" languageKey="{languageKey}"/>
</label>
<div class="typo3-adminPanel-form-datetime-input-group">
<input type="date" id="{name}-date-hr" class="typo3-adminPanel-form-datetime-input" data-bs-target="{name}"/>
......
......@@ -3,7 +3,7 @@
<div class="typo3-adminPanel-form-group">
<div class="typo3-adminPanel-form-select">
<label for="{name}" class="typo3-adminPanel-form-select-label">
<f:translate key="{label}" default="{label}" extensionName="adminpanel"/>
<f:translate key="{label}" default="{label}" extensionName="adminpanel" languageKey="{languageKey}"/>
</label>
<select name="TSFE_ADMIN_PANEL[{name}]" id="{name}" class="typo3-adminPanel-form-select-input">
<option value="0"></option>
......
......@@ -34,7 +34,7 @@
<f:for each="{module.subModules}" as="sub">
<f:if condition="{sub.settings}">
<div class="typo3-adminPanel-content-settings-group">
<h4 class="typo3-adminPanel-headline">{sub.label} <f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang.xlf:settings.label"/></h4>
<h4 class="typo3-adminPanel-headline">{sub.label} <f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang.xlf:settings.label" languageKey="{languageKey}"/></h4>
<f:format.raw>
{sub.settings}
</f:format.raw>
......@@ -42,7 +42,7 @@
</f:if>
</f:for>
<div class="typo3-adminPanel-form-group">
<f:form.button class="typo3-adminPanel-btn typo3-adminPanel-btn-primary" data="{typo3-role: 'typo3-adminPanel-saveButton'}"><f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang.xlf:settings.updateButtonLabel"/></f:form.button>
<f:form.button class="typo3-adminPanel-btn typo3-adminPanel-btn-primary" data="{typo3-role: 'typo3-adminPanel-saveButton'}"><f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang.xlf:settings.updateButtonLabel" languageKey="{languageKey}"/></f:form.button>
</div>
</div>
</f:if>
......
......@@ -6,15 +6,15 @@
<f:variable name="icon"><core:icon identifier="{module.iconIdentifier}" alternativeMarkupIdentifier="inline"/></f:variable>
<f:variable name="label">{module.label}</f:variable>
<f:variable name="information">{module.shortInfo}</f:variable>
<f:render partial="Modules/Item" arguments="{module: module, uid: uid, icon: icon, label: label, information: information, data: data}" debug="false"/>
<f:render partial="Modules/Item" arguments="{module: module, uid: uid, icon: icon, label: label, information: information, data: data, languageKey: languageKey}" debug="false"/>
</f:for>
<f:if condition="{hookObjectModuleContent}">
<f:variable name="uid">hook</f:variable>
<f:variable name="icon"><core:icon identifier="actions-window-open" alternativeMarkupIdentifier="inline"/></f:variable>
<f:variable name="label"><f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang.xlf:deprecatedModuleLabel"/></f:variable>
<f:variable name="label"><f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang.xlf:deprecatedModuleLabel" languageKey="{languageKey}"/></f:variable>
<f:variable name="mainContent">{hookObjectModuleContent}</f:variable>
<f:render partial="Modules/Item" arguments="{uid: uid, icon: icon, label: label, mainContent: mainContent, data: data}}" debug="false"/>
<f:render partial="Modules/Item" arguments="{uid: uid, icon: icon, label: label, mainContent: mainContent, data: data, languageKey: languageKey}}" debug="false"/>
</f:if>
</f:section>
......@@ -22,10 +22,10 @@
<f:variable name="uid">settings</f:variable>
<f:variable name="icon"><core:icon identifier="actions-system-extension-configure" alternativeMarkupIdentifier="inline"/></f:variable>
<f:variable name="label"><f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang.xlf:settings.label"/></f:variable>
<f:variable name="label"><f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang.xlf:settings.label" languageKey="{languageKey}"/></f:variable>
<f:variable name="information">{module.shortInfo}</f:variable>
<f:variable name="mainContent">
<h1 class="typo3-adminPanel-headline"><f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang.xlf:settings.label"/></h1>
<h1 class="typo3-adminPanel-headline"><f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang.xlf:settings.label" languageKey="{languageKey}"/></h1>
<div class="typo3-adminPanel-card-group">
<f:for each="{settingsModules}" as="module">
<f:if condition="{module.pageSettings}">
......@@ -43,10 +43,10 @@
</div>
<div class="typo3-adminPanel-form-group">
<button data-typo3-role="typo3-adminPanel-saveButton" class="typo3-adminPanel-btn typo3-adminPanel-btn-primary">
<f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang.xlf:settings.updateButtonLabel"/>
<f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang.xlf:settings.updateButtonLabel" languageKey="{languageKey}"/>
</button>
</div>
</f:variable>
<f:render partial="Modules/Item" arguments="{uid: uid, icon: icon, label: label, information: information, mainContent: mainContent, data: data}" debug="false"/>
<f:render partial="Modules/Item" arguments="{uid: uid, icon: icon, label: label, information: information, mainContent: mainContent, data: data, languageKey: languageKey}" debug="false"/>
</f:section>
</html>
......@@ -12,7 +12,7 @@
<thead>
<tr>
<th scope="col" class="typo3-adminPanel-table-cell-key">
<f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:submodule.log.message"/>
<f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:submodule.log.message" languageKey="{languageKey}"/>
</th>
</tr>
</thead>
......@@ -42,17 +42,17 @@
<f:if condition="{groupByComponent}">
<f:then>
<th scope="col" class="typo3-adminPanel-table-cell-key">
<f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:submodule.log.level"/>
<f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:submodule.log.level" languageKey="{languageKey}"/>
</th>
</f:then>
<f:else>
<th scope="col" class="typo3-adminPanel-table-cell-key">
<f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:submodule.log.component"/>
<f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:submodule.log.component" languageKey="{languageKey}"/>
</th>
</f:else>
</f:if>
<th scope="col" class="typo3-adminPanel-table-cell-key">
<f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:submodule.log.message"/>
<f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:submodule.log.message" languageKey="{languageKey}"/>
</th>
</tr>
</thead>
......@@ -87,13 +87,13 @@
<thead>
<tr>
<th scope="col" class="typo3-adminPanel-table-cell-key">
<f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:submodule.log.level"/>
<f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:submodule.log.level" languageKey="{languageKey}"/>
</th>
<th scope="col" class="typo3-adminPanel-table-cell-key">
<f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:submodule.log.component"/>
<f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:submodule.log.component" languageKey="{languageKey}"/>
</th>
<th scope="col" class="typo3-adminPanel-table-cell-key">
<f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:submodule.log.message"/>
<f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:submodule.log.message" languageKey="{languageKey}"/>
</th>
</tr>
</thead>
......@@ -122,7 +122,7 @@
<f:else>
<div class="typo3-adminPanel-message typo3-adminPanel-message-info">
<div class="typo3-adminPanel-message-text">
<f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:submodule.log.noEntries"/>
<f:translate key="LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:submodule.log.noEntries" languageKey="{languageKey}"/>
</div>
</div>
</f:else>
......
Markdown is supported
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