Here's our usecase: we wanted to re-use the label and option labels of a select field, so we added a custom prototype which extends SingleSelect
:
TYPO3:
CMS:
Form:
prototypes:
standard:
formEngine:
translationFile:
- EXT:form/Resources/Private/Language/Database.xlf
- EXT:foo/Resources/Private/Language/Extensions/Form/locallang_db.xlf
formElementsDefinition:
CustomSelect:
__inheritances:
10: 'TYPO3.CMS.Form.prototypes.standard.formElementsDefinition.SingleSelect'
renderingOptions:
templateName: SingleSelect
Now we use this prototype multiple times in our form definition:
# ...
renderables:
page:
identifier: default
type: Page
renderables:
- &custom
identifier: custom1
type: CustomSelect
label: Custom select label
properties:
options:
1: First
2: Second
- <<: *custom
identifier: custom2
Now we use the following e.g. in the EXT:foo/Resources/Private/Language/Extensions/Form/de.locallang_db.xlf
file:
<!-- ... -->
<trans-unit id="element.CustomSelect.properties.label">
<source>Custom select label</source>
<target>Eigenes Auswahl-Label</target>
</trans-unit>
<trans-unit id="element.CustomSelect.properties.options.1">
<source>First</source>
<target>Erstes</target>
</trans-unit>
<trans-unit id="element.CustomSelect.properties.options.2">
<source>Second</source>
<target>Zweites</target>
</trans-unit>
<!-- ... -->
Without this change, we'd need to provide translation for every single field identifier.