[TASK] EXT:form - allow validation translation for a field in all forms 88/53988/8
authorDavid Gurk <dgurk@medienwerft.de>
Fri, 8 Sep 2017 07:23:03 +0000 (09:23 +0200)
committerSusanne Moog <susanne.moog@typo3.org>
Wed, 20 Sep 2017 09:55:27 +0000 (11:55 +0200)
This allows to translate a form element validation messages without
a specific form definition identifier.

Resolves: #82366
Releases: master, 8.7
Change-Id: I1db756c7f3c84d599f5c3c2265d8a7ca07fc2205
Reviewed-on: https://review.typo3.org/53988
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Daniel Lorenz <daniel.lorenz@extco.de>
Reviewed-by: Ralf Zimmermann <ralf.zimmermann@tritum.de>
Reviewed-by: Sonja Gro├čewinkelmann <s.grossewinkelmann@neusta.de>
Tested-by: Ralf Zimmermann <ralf.zimmermann@tritum.de>
Reviewed-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Tested-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Reviewed-by: Sascha Rademacher <sascha.rademacher+typo3@gmail.com>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/form/Classes/Service/TranslationService.php
typo3/sysext/form/Documentation/Concepts/FrontendRendering/Index.rst

index 37a53f0..989c297 100644 (file)
@@ -427,6 +427,7 @@ class TranslationService implements SingletonInterface
         foreach ($translationFiles as $translationFile) {
             $translationKeyChain[] = sprintf('%s:%s.validation.error.%s.%s', $translationFile, $formRuntime->getIdentifier(), $element->getIdentifier(), $code);
             $translationKeyChain[] = sprintf('%s:%s.validation.error.%s', $translationFile, $formRuntime->getIdentifier(), $code);
+            $translationKeyChain[] = sprintf('%s:validation.error.%s.%s', $translationFile, $element->getIdentifier(), $code);
             $translationKeyChain[] = sprintf('%s:validation.error.%s', $translationFile, $code);
         }
 
index 8bc0237..0b2e7c8 100644 (file)
@@ -991,9 +991,11 @@ specific pattern. Furthermore, the fallback chain exists here as well. Thus,
 the following translation scenarios are possible:
 
 - translation of validation messages for a specific validator of a concrete
-  form element and form
+  form element and concrete form
 - translation of validation messages for a specific validator of various
   form elements within a concrete form
+- translation of validation messages for a specific validator of a concrete
+  form element in various forms
 - translation of validation messages for a specific validator within various
   forms
 
@@ -1006,6 +1008,7 @@ files based on the following order:
 
 - ``<formDefinitionIdentifier>.validation.error.<elementIdentifier>.<validationErrorCode>``
 - ``<formDefinitionIdentifier>.validation.error.<validationErrorCode>``
+- ``validation.error.<elementIdentifier>.<validationErrorCode>``
 - ``validation.error.<validationErrorCode>``
 
 
@@ -1045,6 +1048,7 @@ with the form element ``LastName``:
 
 - ContactForm.validation.error.LastName.1221560910
 - ContactForm.validation.error.1221560910
+- validation.error.LastName.1221560910
 - validation.error.1221560910
 
 As mentioned above, if there is no corresponding translation key available,