Bug #87722
closedForms: Error message of Advanced password is not translatable
100%
Description
Hello everyone,
if you type two different passwords in the advanced password field of EXT:form the error message is english because its hardcoded in Class FormElementHook.
See: https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/form/Classes/Hooks/FormElementHooks.php
There is no inherited function like translateErrorMessage in AbstractValidator class. Please provide this translation possibility also in Hooks:
class FormElementHooks
{
/**
* This hook is invoked by the FormRuntime for each form element
* **after** a form page was submitted but **before** values are
* property-mapped, validated and pushed within the FormRuntime's `FormState`.
*
* @param FormRuntime $formRuntime
* @param RenderableInterface $renderable
* @param mixed $elementValue submitted value of the element *before post processing*
* @param array $requestArguments submitted raw request values
* @return mixed
* @see FormRuntime::mapAndValidate()
* @internal
*/
public function afterSubmit(FormRuntime $formRuntime, RenderableInterface $renderable, $elementValue, array $requestArguments = [])
{
if ($renderable->getType() === 'AdvancedPassword') {
if ($elementValue['password'] !== $elementValue['confirmation']) {
$processingRule = $renderable->getRootForm()->getProcessingRule($renderable->getIdentifier());
$processingRule->getProcessingMessages()->addError(
GeneralUtility::makeInstance(ObjectManager::class)
->get(Error::class,
$this->translateErrorMessage(
'translation.key',
'form'
), 1334768052)
);
}
$elementValue = $elementValue['password'];
}
return $elementValue;
}
/**
* Wrap static call to LocalizationUtility to simplify unit testing
*
* @param string $translateKey
* @param string $extensionName
* @param array $arguments
*
* @return string|null
*/
protected function translateErrorMessage($translateKey, $extensionName, $arguments = [])
{
return \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate(
$translateKey,
$extensionName,
$arguments
);
}
Thanks in advance!
Best regards,
Daniel
Updated by Petra Neumann over 5 years ago
- Status changed from New to In Progress
- Assignee set to Petra Neumann
- Target version set to Candidate for Major Version
Updated by Petra Neumann over 5 years ago
- Status changed from In Progress to New
- Assignee deleted (
Petra Neumann) - Target version deleted (
Candidate for Major Version)
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/c/Packages/TYPO3.CMS/+/60573
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/c/Packages/TYPO3.CMS/+/60573
Updated by Gerrit Code Review over 5 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60573
Updated by Gerrit Code Review over 5 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60581
Updated by Michael Waack over 5 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 9b975a13813e38d18b2d4a089d60f82fe1b91649.