Issue Bug Resolved

#87675email2sender finisher: labels not translated correctly when override finisher settings is used

Aurelius Hogan 02/07/19, 15:58 updated 11/14/26, 10:05

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')}

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?

Reviews 2

Files 2

History 2454

Show 1829 earlier messages
  1. Daniela Pohl commented and changed status In Progress New removed the assignee <span data-processor="relativetime" data-value="2019-04-25T17:02:42+00:00" > 04/25/19, 17:02 </span>

    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>
  2. Björn Jacob commented and changed status New Needs Feedback assigned to Aurelius Hogan <span data-processor="relativetime" data-value="2019-04-25T17:25:17+00:00" > 04/25/19, 17:25 </span>

    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?

  3. Jürgen Venne commented <span data-processor="relativetime" data-value="2019-04-29T11:37:54+00:00" > 04/29/19, 11:37 </span>

    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}" />
  4. Björn Jacob commented and changed status Needs Feedback New removed the assignee Sprint Focus Remote Sprint <span data-processor="relativetime" data-value="2020-04-13T11:22:29+00:00" > 04/13/20, 11:22 </span>

    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).

  5. Jarvis H commented <span data-processor="relativetime" data-value="2020-04-20T17:45:57+00:00" > 04/20/20, 17:45 </span>

    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.

  6. Jarvis H commented <span data-processor="relativetime" data-value="2020-05-07T18:43:42+00:00" > 05/07/20, 18:43 </span>

    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.

  7. Axel Hahn commented and changed subject form framework email2sender finisher: labels not translated form framework email2sender finisher: labels not translated correctly when vverride finisher settings is used TYPO3 Version 8 9 <span data-processor="relativetime" data-value="2020-11-18T14:59:02+00:00" > 11/18/20, 14:59 </span>

    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.

  8. Stefan Hekele commented <span data-processor="relativetime" data-value="2020-12-15T13:01:44+00:00" > 12/15/20, 13:01 </span>

    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.

  9. Björn Jacob commented and changed subject form framework email2sender finisher: labels not translated correctly when vverride finisher settings is used email2sender finisher: labels not translated correctly when override finisher settings is used TYPO3 Version 9 11 <span data-processor="relativetime" data-value="2021-08-06T11:48:54+00:00" > 08/06/21, 11:48 </span>

    Have to check the new information and try to reproduce the problem.

  1. Netresearch DTT GmbH commented <span data-processor="relativetime" data-value="2023-11-23T12:54:13+00:00" > 11/23/23, 12:54 </span>

    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).

  2. Anonymous commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-11-14T10:05:12+00:00" > 11/14/26, 10:05 </span>

    Applied in changeset commit:f0847b0f7ce36f302f91fe1d36fd7b2418580ec6.