Bug #87675

form framework email2sender finisher: labels not translated

Added by Aurelius Hogan 7 months ago. Updated 4 months ago.

Status:
Needs Feedback
Priority:
Should have
Category:
Form Framework
Target version:
-
Start date:
2019-02-07
Due date:
% Done:

0%

TYPO3 Version:
8
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

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?

History

#1 Updated by Bjoern Jacob 5 months ago

  • Sprint Focus set to Remote Sprint

#2 Updated by Susanne Moog 4 months ago

  • Status changed from New to In Progress
  • Assignee set to Daniela Pohl

#3 Updated by Daniela Pohl 4 months 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>

#4 Updated by Bjoern Jacob 4 months 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?

#5 Updated by Bjoern Jacob 4 months ago

  • Sprint Focus deleted (Remote Sprint)

#6 Updated by J├╝rgen Venne 4 months 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}" />

Also available in: Atom PDF