I'm working on translating a TYPO3 form.
All works like a charm, only the defaultValue attibute don't.
This is the relevant part of the form definition: `
renderingOptions:
templateVariant: version2
submitButtonLabel: Abschicken
type: Form
identifier: productformular
label: 'Formular Produktseite'
prototypeName: standard
renderables:
-
renderingOptions:
previousButtonLabel: 'Previous step'
nextButtonLabel: 'Neue Seite'
type: Page
identifier: page-1
label: Produktanfrage
renderables:
-
defaultValue: 'Guten Tag, ich interessiere mich für dieses Gerät. Bitte melden Sie sich schnellstmöglich bei mir.'
type: Textarea
identifier: textarea-1
label: Nachricht
properties:
fluidAdditionalAttributes:
placeholder: 'Ihre Nachricht an uns'
`
Unfortunately, I can't find a hint in any instructions on how to translate the defaultValue.
Has anybody a soilution for me?
I tryed something like `
<trans-unit id="productformular.element.textarea-1.properties.label">
<source>Message</source>
</trans-unit>
<trans-unit id="productformular.element.textarea-1.properties.placeholder">
<source>Your message to us</source>
</trans-unit>
<trans-unit id="productformular.element.textarea-1.properties.defaultValue">
<source>Hello, I am interested in this device. Please contact me as soon as possible.</source>
</trans-unit>
` Label and placeholder are translated, but defaultValue doesn't.
CodePudding user response:
I am not aware of a solution with XLIFF. But you can use Form variants to override the defaultValue:
-
defaultValue: 'Max Powers'
identifier: name
label: Name
type: Text
variants:
- identifier: defaultValue-for-de
condition: 'siteLanguage("twoLetterIsoCode") == "de"'
defaultValue: 'Max Mustermann'
CodePudding user response:
As described in Rustyjim's post, TYPO3 does not (yet) provide this possibility.
I didn't want different forms per language, also a javascript solution didn't seem to fit for this.
I solved it now using the form view helper and the standard fluid translate function:
<formvh:render
persistenceIdentifier="EXT:liftfinder/Resources/Private/Forms/productContactForm.form.yaml"
overrideConfiguration="{
renderables: {
0: {
renderables: {
4: {
defaultValue: '{f:translate(key: \'textarea-1_defaultValue\')}'
}
}
}
}
}"
/>
It's not really a good solution either, because the elements are addressed by a sequence number instead of a unique identifier.
Better solutions are welcome.