Bug #87675
openemail2sender finisher: labels not translated correctly when override finisher settings is used
0%
Description
I've got an installation with german and english localization. My forms are translated and presented in the correct language. Everything is fine except one point: The EmailToSender finisher.
It seems like
{formvh:translateElementProperty(element: formValue.element, property: 'label')}
which is used in the template file I specified in the templatePathAndFilename for the EmailToSender finisher is buggy.
The same line for EmailToReceiver finisher returns the correct translated label. But in EmailToSender finisher I get the english label no matter with which language I fill the form.
the typoscript settings
config { // Language Settings linkVars := addToList(L(0-2)) sys_language_uid = 0 sys_language_overlay = 1 sys_language_mode = content_fallback language = de locale_all = de_DE.UTF-8 htmlTag_langKey = de-DE # for real url defaultGetVars { L = 0 } sys_language_softMergeIfNotBlank = tt_content:image, pages:media } [globalVar = GP:L = 1] config { sys_language_uid = 1 language = en locale_all = en_EN.UTF-8 htmlTag_langKey = en-GB } [global] [globalVar = GP:L = 2] config { sys_language_uid = 4 language = fr locale_all = fr_FR.UTF-8 htmlTag_langKey = fr-FR } [global]
The localization files:
Forms.xlf
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2018-12-03T20:38:10Z">
<header>
<description>Formular Labels.</description>
<generator>LFEditor</generator>
</header>
<body>
<trans-unit id="element.f_firstName.properties.label">
<source><![CDATA[First name]]></source>
</trans-unit>
</body>
</file>
</xliff>
de.Forms.xlf
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2018-12-03T20:38:10Z">
<header>
<description>Formular Labels.</description>
<generator>LFEditor</generator>
</header>
<body>
<trans-unit id="element.f_firstName.properties.label" approved="yes">
<source><![CDATA[First name]]></source>
<target><![CDATA[Vorname]]></target>
</trans-unit>
</body>
</file>
</xliff>
The form definition:
renderingOptions:
submitButtonLabel: 'Anfrage absenden ...'
type: Form
identifier: ...Konfigurator
label: '...Konfigurator'
prototypeName: ...KonfiguratorBase
finishers:
-
options:
...
templatePathAndFilename: '.../Customer.html'
identifier: EmailToSender
-
options:
...
templatePathAndFilename: '.../Company.html'
identifier: EmailToReceiver
-
renderables:
-
renderingOptions:
previousButtonLabel: 'Previous step'
nextButtonLabel: 'Neue Seite'
type: Page
identifier: page-1
label: ''
renderables:
-
defaultValue: ''
type: Text
identifier: f_firstName
label: Vornamen!!!123
properties:
fluidAdditionalAttributes:
required: required
elementDescription: given-name
validators:
-
identifier: NotEmpty
the Template file: company.html and customer.html are identical:
{namespace formvh=TYPO3\CMS\Form\ViewHelpers}
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
<html xmlns:f="https://xsd.helhum.io/ns/typo3/cms-fluid/master/ViewHelpers"
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers"
xmlns:formvh="http://typo3.org/ns/TYPO3/CMS/Form/ViewHelpers" data-namespace-typo3-fluid="true">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="format-detection" content="telephone=no">
</head>
<body>
<table width="600" cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="2" width="1200" align="left">
<f:render section="replacePlaceholders" arguments="{form:form, uid:'EmailIntro'}"/> <br/>
</td>
</tr>
<formvh:renderAllFormValues renderable="{form.formDefinition}" as="formValue">
<tr>
<td width="600" valign="top" align="left">{formvh:translateElementProperty(element: formValue.element, property: 'label')}</td>
<td width="600" valign="top" align="left">
<f:if condition="{formValue.value}">
<f:then>
<f:if condition="{formValue.isMultiValue}">
<f:then>
<table cellspacing="0" border="0">
<f:for each="{formValue.processedValue}" as="value">
<tr>
<td>{value}</td>
</tr>
</f:for>
</table>
</f:then>
<f:else>
<table cellspacing="0" border="0">
<tr>
<td><f:format.nl2br>{formValue.processedValue}</f:format.nl2br></td>
</tr>
</table>
</f:else>
</f:if>
</f:then>
<f:else>
-
</f:else>
</f:if>
</td>
</tr>
</formvh:renderAllFormValues>
<tr>
<td colspan="2" width="1200" align="left"> <br/>
<f:render section="replacePlaceholders" arguments="{form:form, uid:'EmailOutro'}"/>
</td>
</tr>
</table>
</body>
<f:section name="replacePlaceholders">
<v:variable.set name="messageUid" value="{v:variable.typoscript(path: 'plugin.tx_form.settings.UIDs.{form.identifier}.{uid}')}"/>
<v:variable.set name="message" value="{v:content.render(contentUids:{0:messageUid})}"/>
<formvh:renderAllFormValues renderable="{form.formDefinition}" as="formValue">
<v:variable.set name="message">
<v:format.replace content="{message}"
substring="[{formValue.element.identifier}]"
replacement="{formValue.processedValue}"/>
</v:variable.set>
</formvh:renderAllFormValues>
<f:format.raw>{message}</f:format.raw>
</f:section>
</html>
Summary:
All contents and translation in EmailToReceiver is correct in both languages. EmailToSender form labels are always english. Everything else is correct.
Is there a configuration error?
Updated by Susanne Moog over 5 years ago
- Status changed from New to In Progress
- Assignee set to Daniela Pohl
Updated by Daniela Pohl over 5 years ago
- Status changed from In Progress to New
- Assignee deleted (
Daniela Pohl)
I can not reproduce the issue.
Set up german and english localization, created a form with emailToSender and emailToReceiver finishers and used the company.html to overwrite the Template Path. Labels are always in correct language.
form.yaml
renderingOptions:
submitButtonLabel: Submit
type: Form
identifier: test
label: Test
prototypeName: standard
finishers:
-
options:
subject: test
...
templatePathAndFilename: 'Customer.html'
identifier: EmailToSender
-
options:
subject: testm
...
templatePathAndFilename: 'Company.html'
identifier: EmailToReceiver
renderables:
-
renderingOptions:
previousButtonLabel: 'Previous step'
nextButtonLabel: 'Next step'
type: Page
identifier: page-1
label: ''
renderables:
-
defaultValue: ''
type: Text
identifier: f_firstName
label: Vorname!
properties:
elementDescription: ''
locallang.xlf
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0" xmlns:t3="http://typo3.org/schemas/xliff">
<file t3:id="1475977066" source-language="en" datatype="plaintext" original="messages" date="2016-10-09T03:38:32Z" product-name="form">
<header/>
<body>
<trans-unit id="element.f_firstName.properties.label">
<source><![CDATA[First name in english]]></source>
</trans-unit>
</body>
</file>
</xliff>
de.locallang.xlf
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2018-12-03T20:38:10Z">
<header>
<description>Formular Labels.</description>
<generator>LFEditor</generator>
</header>
<body>
<trans-unit id="element.f_firstName.properties.label" approved="yes">
<source><![CDATA[First name in englisch]]></source>
<target><![CDATA[Vorname in deutsch]]></target>
</trans-unit>
</body>
</file>
</xliff>
Updated by Björn Jacob over 5 years ago
- Status changed from New to Needs Feedback
- Assignee set to Aurelius Hogan
Aurelius, as you can see we cannot reproduce the issue. Can you further test your installation and provide us with more insight (installed extensions etc.)? Do you use the bootstrap package?
Updated by Jürgen Venne over 5 years ago
I've the same issue here on a multidomain (3 sites), multilanguage (15 languages) site.
It breaks down to the RenderingOptions in TranslateElementPropertyViewHelper.
The RenderingOptions are null so no language can be determined and the default english labels are rendered.
As a workaround I use this Fluid code:
<f:variable name="lll" value="LLL:EXT:fancysitepackage/Resources/Private/Extensions/form/language/locallang.xlf" />
<f:translate key='{lll}:contactform.element.{formValue.element.identifier}.properties.label' default="{formValue.element.identifier}" />
Updated by Björn Jacob over 4 years ago
- Status changed from Needs Feedback to New
- Assignee deleted (
Aurelius Hogan) - Sprint Focus set to Remote Sprint
Let's check this again and see what Jürgen did :) If this only occurs on v8 we will not fix the issue (v8 is in ELTS phase now).
Updated by Jarvis H over 4 years ago
I too can confirm this issue and in Typo3 9.5.14.
After checking through all the source code translation steps, I discovered that the problem has to do with the flexform finisher override settings.
When I activate the "Override finisher settings" option in the plugin, the following is added to the saved flexform data:
<field index="settings.finishers.EmailToReceiver.translation.language"> <value index="vDEF">Default</value> </field>
Internally this causes the value of $languageKey in TYPO3\CMS\Form\Service\TranslationService
to be set to 'Default' which of course is not valid, hence the e-mail translations are shown in the wrong language. (Note: the value is dependent on your current BE-language in Typo3, so if switching to German, the saved value becomes 'Standard' instead of 'Default')
If changing the saved flexform data to this, or simply not overriding the finisher settings at all, the problem goes away:
<field index="settings.finishers.EmailToReceiver.translation.language"> <value index="vDEF"></value> </field>
What I don't understand however is why this flexform setting is rendered as a select field at all, or rather how is it supposed to be used?
Hope this helps any further debugging of the issue.
Updated by Jarvis H over 4 years ago
EDIT adding additional information:¶
(I am not completely sure if my issue is the same as for the other people in this thread.)
To further clarify, I tracked down the translation label in my local var/labels/de/form/Resources/Private/Language/de.Database.xlf. Oddly enough it states as note: "This label is deprecated (not used anymore) since TYPO3v8
" which is not true as it is used as translation for settings.finishers.EmailToReceiver.translation.language
when enabling the "Override finisher settings" option and using the EmailToReceiver finisher. This would indicate that a translation of a select field option value is inadvertently taking place.
<trans-unit id="default" resname="default" xml:space="preserve" approved="yes"> <source>Default</source> <target state="translated">Standard</target> <note>This label is deprecated (not used anymore) since TYPO3v8</note> <alt-trans xml:space="preserve" origin="cicom"> <target>Vorgabe</target> </alt-trans> </trans-unit>
I also tested how translations are working in EmailToSender and noticed, that there is an additional bug at play here. Any language settings for EmailToReceiver (i.e. forcing a language for any labels in the receiver mail, fx. always setting receiver mails to be german regardless of FE-language) will also be used in EmailToSender. As far as I can tell the reason for this is, they both use TYPO3\CMS\Form\Service\TranslationService
which is a singleton. TYPO3\CMS\Form\Domain\Finishers\EmailFinisher
uses the TranslationService->setLanguage
method and any value set here is then also used in EmailToSender.
It feels like this singleton should not have such a getter method, as it causes unforeseen consequences in other locations.
Updated by Axel Hahn about 4 years ago
- Subject changed from form framework email2sender finisher: labels not translated to form framework email2sender finisher: labels not translated correctly when vverride finisher settings is used
- TYPO3 Version changed from 8 to 9
I am facing the same problem with typo3 version 9.5.23.
My translations used in the EmailToSender / EmailToReceiver finishers are working as expected until I set the "Override finisher settings" option to true.
All elements which are translated by using
{formvh:translateElementProperty(element: formValue.element, property: 'placeholder')}
are shown in the default language instead of the selected one.
Whereas elements which are translated by using
<f:translate key="LLL:EXT:my_site_package/Resources/Private/Language/locallang_forms_email.xlf:email.yes"/>
are translated correctly.
Updated by Stefan Hekele almost 4 years ago
TYPO3 10.4.10:
If I edit typo3/sysext/form/Configuration/Yaml/Finishers/EmailToReceiver.yaml and typo3/sysext/form/Configuration/Yaml/Finishers/EmailToSender.yaml to change the following:
items:
10:
- tt_content.finishersDefinition.EmailToReceiver.language.1
- default
to
items:
10:
- tt_content.finishersDefinition.EmailToReceiver.language.1
I have the, for me, expected behaviour. The dropdown value default is an empty string, and the Email Finishers use the current frontend language.
Without the change, there is also another issue just in the backend itself. 'default' ist being translated as it is defined in the forms xlf. So if you edit a form as a user with an English Backend, and then Switch over to, for example, German, the form value will be marked as invalid, as the label changes between the two languages.
Updated by Ge Rie over 3 years ago
- Related to Bug #93806: EXT: form - Confirmation Message and E-Mails not transated added
Updated by Björn Jacob over 3 years ago
- Subject changed from form framework email2sender finisher: labels not translated correctly when vverride finisher settings is used to email2sender finisher: labels not translated correctly when override finisher settings is used
- TYPO3 Version changed from 9 to 11
Have to check the new information and try to reproduce the problem.
Updated by Björn Jacob over 3 years ago
- Related to deleted (Bug #93806: EXT: form - Confirmation Message and E-Mails not transated)
Updated by Gerrit Code Review over 2 years ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74492
Updated by Gerrit Code Review over 2 years ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74492
Updated by Gerrit Code Review over 2 years ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74492
Updated by Gerrit Code Review over 2 years ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74492
Updated by Gerrit Code Review over 2 years ago
Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74492
Updated by Gerrit Code Review over 2 years ago
Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74492
Updated by Gerrit Code Review over 2 years ago
Patch set 7 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74492
Updated by Gerrit Code Review over 2 years ago
Patch set 8 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74492
Updated by Gerrit Code Review over 2 years ago
Patch set 9 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74492
Updated by Gerrit Code Review over 2 years ago
Patch set 10 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74492
Updated by Gerrit Code Review over 2 years ago
Patch set 11 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74492
Updated by Gerrit Code Review over 2 years ago
Patch set 12 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74492
Updated by Björn Jacob over 2 years ago
- Related to Task #97839: Extend PHP-CS-Fixer to avoid yoda style added
Updated by Gerrit Code Review about 2 years ago
Patch set 13 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74492
Updated by Gerrit Code Review over 1 year ago
Patch set 14 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74492
Updated by Netresearch DTT GmbH 12 months ago · Edited
Is there a chance this will be fixed soon? It's a really ugly bug for a multilingual production environment.
I applied patchset 12 to TYPO3 11.5 (13 and 14 only introduced the EventListener) and this does not solve the problem for me that when the option "Override finisher settings [settings.overrideFinishers]" is activated, the output in the mail template is according to the current frontend language, but still is in English (presumably the default).
Updated by Bernhard Eckl 6 months ago
- Related to Bug #103899: translation setting not only valid for current finisher added
Updated by Gerrit Code Review about 1 month ago
Patch set 15 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74492