[BUGFIX] Perform the translation key look-up as it was before #81775 56/56356/5
authorRalf Zimmermann <ralf.zimmermann@tritum.de>
Sun, 18 Mar 2018 13:56:38 +0000 (14:56 +0100)
committerFrank Naegler <frank.naegler@typo3.org>
Thu, 19 Apr 2018 09:09:38 +0000 (11:09 +0200)
If a form is rendered through the "form" content element,
the identifier of the form is modified with a suffix since #81775.
The translation key look-up must act like before #81775
and must perform the search for translation keys with the suffixed
form identifiers in addition.

Resolves: #84471
Releases: master
Change-Id: I92b708e1c392ad005c4a1bcd59f1c31788d7756f
Reviewed-on: https://review.typo3.org/56356
Tested-by: TYPO3com <no-reply@typo3.com>
Tested-by: Kay Strobach <typo3@kay-strobach.de>
Reviewed-by: Kay Strobach <typo3@kay-strobach.de>
Reviewed-by: Björn Jacob <bjoern.jacob@tritum.de>
Tested-by: Björn Jacob <bjoern.jacob@tritum.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/form/Classes/Controller/FormFrontendController.php
typo3/sysext/form/Classes/Service/TranslationService.php
typo3/sysext/form/Tests/Unit/Service/Fixtures/locallang_ceuid_suffix_01.xlf [new file with mode: 0644]
typo3/sysext/form/Tests/Unit/Service/Fixtures/locallang_ceuid_suffix_02.xlf [new file with mode: 0644]
typo3/sysext/form/Tests/Unit/Service/TranslationServiceTest.php

index ee40afc..3564ec2 100644 (file)
@@ -59,6 +59,7 @@ class FormFrontendController extends ActionController
             $formDefinition['persistenceIdentifier'] = $this->settings['persistenceIdentifier'];
             $formDefinition = $this->overrideByTypoScriptSettings($formDefinition);
             $formDefinition = $this->overrideByFlexFormSettings($formDefinition);
+            $formDefinition = ArrayUtility::setValueByPath($formDefinition, 'renderingOptions._originalIdentifier', $formDefinition['identifier'], '.');
             $formDefinition['identifier'] .= '-' . $this->configurationManager->getContentObject()->data['uid'];
         }
         $this->view->assign('formConfiguration', $formDefinition);
index 25e004d..0b43dea 100644 (file)
@@ -265,8 +265,16 @@ class TranslationService implements SingletonInterface
             $arguments = [];
         }
 
+        $originalFormIdentifier = null;
+        if (isset($formRuntime->getRenderingOptions()['_originalIdentifier'])) {
+            $originalFormIdentifier = $formRuntime->getRenderingOptions()['_originalIdentifier'];
+        }
+
         $translationKeyChain = [];
         foreach ($translationFiles as $translationFile) {
+            if (!empty($originalFormIdentifier)) {
+                $translationKeyChain[] = sprintf('%s:%s.finisher.%s.%s', $translationFile, $originalFormIdentifier, $finisherIdentifier, $optionKey);
+            }
             $translationKeyChain[] = sprintf('%s:%s.finisher.%s.%s', $translationFile, $formRuntime->getIdentifier(), $finisherIdentifier, $optionKey);
             $translationKeyChain[] = sprintf('%s:finisher.%s.%s', $translationFile, $finisherIdentifier, $optionKey);
         }
@@ -350,10 +358,23 @@ class TranslationService implements SingletonInterface
             $arguments = [];
         }
 
+        $originalFormIdentifier = null;
+        if (isset($formRuntime->getRenderingOptions()['_originalIdentifier'])) {
+            $originalFormIdentifier = $formRuntime->getRenderingOptions()['_originalIdentifier'];
+        }
+
         if ($property === 'options' && is_array($defaultValue)) {
             foreach ($defaultValue as $optionValue => &$optionLabel) {
                 $translationKeyChain = [];
                 foreach ($translationFiles as $translationFile) {
+                    if (!empty($originalFormIdentifier)) {
+                        if ($element instanceof FormRuntime) {
+                            $translationKeyChain[] = sprintf('%s:%s.element.%s.%s.%s.%s', $translationFile, $originalFormIdentifier, $originalFormIdentifier, $propertyType, $property, $optionValue);
+                            $translationKeyChain[] = sprintf('%s:element.%s.%s.%s.%s', $translationFile, $originalFormIdentifier, $propertyType, $property, $optionValue);
+                        } else {
+                            $translationKeyChain[] = sprintf('%s:%s.element.%s.%s.%s.%s', $translationFile, $originalFormIdentifier, $element->getIdentifier(), $propertyType, $property, $optionValue);
+                        }
+                    }
                     $translationKeyChain[] = sprintf('%s:%s.element.%s.%s.%s.%s', $translationFile, $formRuntime->getIdentifier(), $element->getIdentifier(), $propertyType, $property, $optionValue);
                     $translationKeyChain[] = sprintf('%s:element.%s.%s.%s.%s', $translationFile, $element->getIdentifier(), $propertyType, $property, $optionValue);
                     $translationKeyChain[] = sprintf('%s:element.%s.%s.%s.%s', $translationFile, $element->getType(), $propertyType, $property, $optionValue);
@@ -367,6 +388,14 @@ class TranslationService implements SingletonInterface
             foreach ($defaultValue as $propertyName => &$propertyValue) {
                 $translationKeyChain = [];
                 foreach ($translationFiles as $translationFile) {
+                    if (!empty($originalFormIdentifier)) {
+                        if ($element instanceof FormRuntime) {
+                            $translationKeyChain[] = sprintf('%s:%s.element.%s.%s.%s', $translationFile, $originalFormIdentifier, $originalFormIdentifier, $propertyType, $propertyName);
+                            $translationKeyChain[] = sprintf('%s:element.%s.%s.%s', $translationFile, $originalFormIdentifier, $propertyType, $propertyName);
+                        } else {
+                            $translationKeyChain[] = sprintf('%s:%s.element.%s.%s.%s', $translationFile, $originalFormIdentifier, $element->getIdentifier(), $propertyType, $propertyName);
+                        }
+                    }
                     $translationKeyChain[] = sprintf('%s:%s.element.%s.%s.%s', $translationFile, $formRuntime->getIdentifier(), $element->getIdentifier(), $propertyType, $propertyName);
                     $translationKeyChain[] = sprintf('%s:element.%s.%s.%s', $translationFile, $element->getIdentifier(), $propertyType, $propertyName);
                     $translationKeyChain[] = sprintf('%s:element.%s.%s.%s', $translationFile, $element->getType(), $propertyType, $propertyName);
@@ -379,6 +408,14 @@ class TranslationService implements SingletonInterface
         } else {
             $translationKeyChain = [];
             foreach ($translationFiles as $translationFile) {
+                if (!empty($originalFormIdentifier)) {
+                    if ($element instanceof FormRuntime) {
+                        $translationKeyChain[] = sprintf('%s:%s.element.%s.%s.%s', $translationFile, $originalFormIdentifier, $originalFormIdentifier, $propertyType, $property);
+                        $translationKeyChain[] = sprintf('%s:element.%s.%s.%s', $translationFile, $originalFormIdentifier, $propertyType, $property);
+                    } else {
+                        $translationKeyChain[] = sprintf('%s:%s.element.%s.%s.%s', $translationFile, $originalFormIdentifier, $element->getIdentifier(), $propertyType, $property);
+                    }
+                }
                 $translationKeyChain[] = sprintf('%s:%s.element.%s.%s.%s', $translationFile, $formRuntime->getIdentifier(), $element->getIdentifier(), $propertyType, $property);
                 $translationKeyChain[] = sprintf('%s:element.%s.%s.%s', $translationFile, $element->getIdentifier(), $propertyType, $property);
                 $translationKeyChain[] = sprintf('%s:element.%s.%s.%s', $translationFile, $element->getType(), $propertyType, $property);
@@ -412,7 +449,7 @@ class TranslationService implements SingletonInterface
             throw new \InvalidArgumentException('The argument "code" is empty', 1489272978);
         }
 
-        $validationErrors = $element->getProperties()['validationErrorMessages'];
+        $validationErrors = $element->getProperties()['validationErrorMessages'] ?? null;
         if (is_array($validationErrors)) {
             foreach ($validationErrors as $validationError) {
                 if ((int)$validationError['code'] === $code) {
@@ -422,7 +459,7 @@ class TranslationService implements SingletonInterface
         }
 
         $renderingOptions = $element->getRenderingOptions();
-        $translationFile = $renderingOptions['translation']['translationFile'];
+        $translationFile = $renderingOptions['translation']['translationFile'] ?? null;
         if (empty($translationFile)) {
             $translationFile = $formRuntime->getRenderingOptions()['translation']['translationFile'];
         }
@@ -438,8 +475,22 @@ class TranslationService implements SingletonInterface
             $language = $renderingOptions['language'];
         }
 
+        $originalFormIdentifier = null;
+        if (isset($formRuntime->getRenderingOptions()['_originalIdentifier'])) {
+            $originalFormIdentifier = $formRuntime->getRenderingOptions()['_originalIdentifier'];
+        }
+
         $translationKeyChain = [];
         foreach ($translationFiles as $translationFile) {
+            if (!empty($originalFormIdentifier)) {
+                if ($element instanceof FormRuntime) {
+                    $translationKeyChain[] = sprintf('%s:%s.validation.error.%s.%s', $translationFile, $originalFormIdentifier, $originalFormIdentifier, $code);
+                    $translationKeyChain[] = sprintf('%s:validation.error.%s.%s', $translationFile, $originalFormIdentifier, $code);
+                } else {
+                    $translationKeyChain[] = sprintf('%s:%s.validation.error.%s.%s', $translationFile, $originalFormIdentifier, $element->getIdentifier(), $code);
+                }
+                $translationKeyChain[] = sprintf('%s:%s.validation.error.%s', $translationFile, $originalFormIdentifier, $code);
+            }
             $translationKeyChain[] = sprintf('%s:%s.validation.error.%s.%s', $translationFile, $formRuntime->getIdentifier(), $element->getIdentifier(), $code);
             $translationKeyChain[] = sprintf('%s:%s.validation.error.%s', $translationFile, $formRuntime->getIdentifier(), $code);
             $translationKeyChain[] = sprintf('%s:validation.error.%s.%s', $translationFile, $element->getIdentifier(), $code);
diff --git a/typo3/sysext/form/Tests/Unit/Service/Fixtures/locallang_ceuid_suffix_01.xlf b/typo3/sysext/form/Tests/Unit/Service/Fixtures/locallang_ceuid_suffix_01.xlf
new file mode 100644 (file)
index 0000000..bdf7269
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xliff version="1.0" xmlns:t3="http://typo3.org/schemas/xliff">
+    <file t3:id="1521453074" source-language="en" datatype="plaintext" original="messages" date="2017-01-30T03:38:32Z" product-name="tests">
+        <header/>
+        <body>
+            <trans-unit id="form-runtime-identifier-42.element.form-runtime-identifier-42.renderingOptions.submitButtonLabel" xml:space="preserve">
+                <source>form-runtime-identifier-42 submitButtonLabel EN</source>
+            </trans-unit>
+            <trans-unit id="form-runtime-identifier-42.element.form-element-identifier.properties.label" xml:space="preserve">
+                <source>form-runtime-identifier-42 form-element-identifierlabel EN</source>
+            </trans-unit>
+
+            <trans-unit id="form-runtime-identifier-42.validation.error.form-runtime-identifier-42.123" xml:space="preserve">
+                <source>form-runtime-identifier-42 error 123 EN</source>
+            </trans-unit>
+            <trans-unit id="form-runtime-identifier-42.validation.error.form-element-identifier.123" xml:space="preserve">
+                <source>form-runtime-identifier-42 form-element-identifier error 123 EN</source>
+            </trans-unit>
+
+            <trans-unit id="form-runtime-identifier-42.finisher.Foo.test" xml:space="preserve">
+                <source>form-runtime-identifier-42 FooFinisher test EN</source>
+            </trans-unit>
+        </body>
+    </file>
+</xliff>
diff --git a/typo3/sysext/form/Tests/Unit/Service/Fixtures/locallang_ceuid_suffix_02.xlf b/typo3/sysext/form/Tests/Unit/Service/Fixtures/locallang_ceuid_suffix_02.xlf
new file mode 100644 (file)
index 0000000..db2d24f
--- /dev/null
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xliff version="1.0" xmlns:t3="http://typo3.org/schemas/xliff">
+    <file t3:id="1521453075" source-language="en" datatype="plaintext" original="messages" date="2017-01-30T03:38:32Z" product-name="tests">
+        <header/>
+        <body>
+            <trans-unit id="form-runtime-identifier-42.element.form-runtime-identifier-42.renderingOptions.submitButtonLabel" xml:space="preserve">
+                <source>form-runtime-identifier-42 submitButtonLabel EN</source>
+            </trans-unit>
+            <trans-unit id="form-runtime-identifier-42.element.form-element-identifier.properties.label" xml:space="preserve">
+                <source>form-runtime-identifier-42 form-element-identifierlabel EN</source>
+            </trans-unit>
+
+            <trans-unit id="form-runtime-identifier.element.form-runtime-identifier.renderingOptions.submitButtonLabel" xml:space="preserve">
+                <source>form-runtime-identifier submitButtonLabel EN</source>
+            </trans-unit>
+            <trans-unit id="form-runtime-identifier.element.form-element-identifier.properties.label" xml:space="preserve">
+                <source>form-runtime-identifier form-element-identifierlabel EN</source>
+            </trans-unit>
+
+            <trans-unit id="form-runtime-identifier-42.validation.error.form-runtime-identifier-42.123" xml:space="preserve">
+                <source>form-runtime-identifier-42 error 123 EN</source>
+            </trans-unit>
+            <trans-unit id="form-runtime-identifier-42.validation.error.form-element-identifier.123" xml:space="preserve">
+                <source>form-runtime-identifier-42 form-element-identifier error 123 EN</source>
+            </trans-unit>
+
+            <trans-unit id="form-runtime-identifier.validation.error.form-runtime-identifier.123" xml:space="preserve">
+                <source>form-runtime-identifier error 123 EN</source>
+            </trans-unit>
+            <trans-unit id="form-runtime-identifier.validation.error.form-element-identifier.123" xml:space="preserve">
+                <source>form-runtime-identifier form-element-identifier error 123 EN</source>
+            </trans-unit>
+
+            <trans-unit id="form-runtime-identifier-42.finisher.Foo.test" xml:space="preserve">
+                <source>form-runtime-identifier-42 FooFinisher test EN</source>
+            </trans-unit>
+            <trans-unit id="form-runtime-identifier.finisher.Foo.test" xml:space="preserve">
+                <source>form-runtime-identifier FooFinisher test EN</source>
+            </trans-unit>
+        </body>
+    </file>
+</xliff>
index 06eb3fc..3dc2614 100644 (file)
@@ -1040,4 +1040,223 @@ class TranslationServiceTest extends UnitTestCase
 
         $this->assertEquals($expected, $this->mockTranslationService->_call('translateFormElementValue', $mockFormElement, ['label'], $mockFormRuntime));
     }
+
+    /**
+     * @test
+     */
+    public function translateFormElementTranslateFormWithContentElementUidIfFormContainsNoOriginalIdentifier(): void
+    {
+        $formRuntimeXlfPath = 'EXT:form/Tests/Unit/Service/Fixtures/locallang_ceuid_suffix_01.xlf';
+
+        $formRuntimeIdentifier = 'form-runtime-identifier-42';
+        $formElementIdentifier = 'form-element-identifier';
+
+        $formRuntimeRenderingOptions = [
+            'submitButtonLabel' => '',
+            'translation' => [
+                'translationFile' => $formRuntimeXlfPath,
+                'translatePropertyValueIfEmpty' => true
+            ],
+        ];
+
+        $this->store->flushData($formRuntimeXlfPath);
+
+        $mockFormRuntime = $this->getAccessibleMock(FormRuntime::class, ['getIdentifier', 'getRenderingOptions', 'getType'], [], '', false);
+
+        $mockFormRuntime->expects($this->any())->method('getIdentifier')->willReturn($formRuntimeIdentifier);
+        $mockFormRuntime->expects($this->any())->method('getRenderingOptions')->willReturn($formRuntimeRenderingOptions);
+        $mockFormRuntime->expects($this->any())->method('getType')->willReturn('Form');
+
+        $mockFormElement = $this->getAccessibleMock(GenericFormElement::class, ['dummy'], [], '', false);
+
+        $mockFormElement->_set('type', 'Text');
+        $mockFormElement->_set('identifier', $formElementIdentifier);
+        $mockFormElement->_set('label', '');
+
+        $expected = 'form-runtime-identifier-42 submitButtonLabel EN';
+        $this->assertEquals($expected, $this->mockTranslationService->_call('translateFormElementValue', $mockFormRuntime, ['submitButtonLabel'], $mockFormRuntime));
+
+        $expected = 'form-runtime-identifier-42 form-element-identifierlabel EN';
+        $this->assertEquals($expected, $this->mockTranslationService->_call('translateFormElementValue', $mockFormElement, ['label'], $mockFormRuntime));
+    }
+
+    /**
+     * @test
+     */
+    public function translateFormElementTranslateFormWithContentElementUidIfFormContainsOriginalIdentifier(): void
+    {
+        $formRuntimeXlfPath = 'EXT:form/Tests/Unit/Service/Fixtures/locallang_ceuid_suffix_02.xlf';
+
+        $formRuntimeIdentifier = 'form-runtime-identifier-42';
+        $formElementIdentifier = 'form-element-identifier';
+
+        $formRuntimeRenderingOptions = [
+            'submitButtonLabel' => '',
+            '_originalIdentifier' => 'form-runtime-identifier',
+            'translation' => [
+                'translationFile' => $formRuntimeXlfPath,
+                'translatePropertyValueIfEmpty' => true
+            ],
+        ];
+
+        $this->store->flushData($formRuntimeXlfPath);
+
+        $mockFormRuntime = $this->getAccessibleMock(FormRuntime::class, ['getIdentifier', 'getRenderingOptions', 'getType'], [], '', false);
+
+        $mockFormRuntime->expects($this->any())->method('getIdentifier')->willReturn($formRuntimeIdentifier);
+        $mockFormRuntime->expects($this->any())->method('getRenderingOptions')->willReturn($formRuntimeRenderingOptions);
+        $mockFormRuntime->expects($this->any())->method('getType')->willReturn('Form');
+
+        $mockFormElement = $this->getAccessibleMock(GenericFormElement::class, ['dummy'], [], '', false);
+
+        $mockFormElement->_set('type', 'Text');
+        $mockFormElement->_set('identifier', $formElementIdentifier);
+        $mockFormElement->_set('label', '');
+
+        $expected = 'form-runtime-identifier submitButtonLabel EN';
+        $this->assertEquals($expected, $this->mockTranslationService->_call('translateFormElementValue', $mockFormRuntime, ['submitButtonLabel'], $mockFormRuntime));
+
+        $expected = 'form-runtime-identifier form-element-identifierlabel EN';
+        $this->assertEquals($expected, $this->mockTranslationService->_call('translateFormElementValue', $mockFormElement, ['label'], $mockFormRuntime));
+    }
+
+    /**
+     * @test
+     */
+    public function translateFormElementErrorTranslateErrorFromFormWithContentElementUidIfFormContainsNoOriginalIdentifier(): void
+    {
+        $formRuntimeXlfPath = 'EXT:form/Tests/Unit/Service/Fixtures/locallang_ceuid_suffix_01.xlf';
+
+        $formRuntimeIdentifier = 'form-runtime-identifier-42';
+        $formElementIdentifier = 'form-element-identifier';
+
+        $formRuntimeRenderingOptions = [
+            'translation' => [
+                'translationFile' => $formRuntimeXlfPath,
+                'translatePropertyValueIfEmpty' => true
+            ],
+        ];
+
+        $this->store->flushData($formRuntimeXlfPath);
+
+        $mockFormRuntime = $this->getAccessibleMock(FormRuntime::class, ['getIdentifier', 'getRenderingOptions', 'getType', 'getProperties'], [], '', false);
+
+        $mockFormRuntime->expects($this->any())->method('getIdentifier')->willReturn($formRuntimeIdentifier);
+        $mockFormRuntime->expects($this->any())->method('getRenderingOptions')->willReturn($formRuntimeRenderingOptions);
+        $mockFormRuntime->expects($this->any())->method('getType')->willReturn('Form');
+        $mockFormRuntime->expects($this->any())->method('getProperties')->willReturn([]);
+
+        $mockFormElement = $this->getAccessibleMock(GenericFormElement::class, ['dummy'], [], '', false);
+
+        $mockFormElement->_set('type', 'Text');
+        $mockFormElement->_set('identifier', $formElementIdentifier);
+        $mockFormElement->_set('label', '');
+        $mockFormElement->_set('properties', []);
+
+        $expected = 'form-runtime-identifier-42 error 123 EN';
+        $this->assertEquals($expected, $this->mockTranslationService->_call('translateFormElementError', $mockFormRuntime, 123, [], 'default value', $mockFormRuntime));
+
+        $expected = 'form-runtime-identifier-42 form-element-identifier error 123 EN';
+        $this->assertEquals($expected, $this->mockTranslationService->_call('translateFormElementError', $mockFormElement, 123, [], 'default value', $mockFormRuntime));
+    }
+
+    /**
+     * @test
+     */
+    public function translateFormElementErrorTranslateErrorFromFormWithContentElementUidIfFormContainsOriginalIdentifier(): void
+    {
+        $formRuntimeXlfPath = 'EXT:form/Tests/Unit/Service/Fixtures/locallang_ceuid_suffix_02.xlf';
+
+        $formRuntimeIdentifier = 'form-runtime-identifier-42';
+        $formElementIdentifier = 'form-element-identifier';
+
+        $formRuntimeRenderingOptions = [
+            '_originalIdentifier' => 'form-runtime-identifier',
+            'translation' => [
+                'translationFile' => $formRuntimeXlfPath,
+                'translatePropertyValueIfEmpty' => true
+            ],
+        ];
+
+        $this->store->flushData($formRuntimeXlfPath);
+
+        $mockFormRuntime = $this->getAccessibleMock(FormRuntime::class, ['getIdentifier', 'getRenderingOptions', 'getType', 'getProperties'], [], '', false);
+
+        $mockFormRuntime->expects($this->any())->method('getIdentifier')->willReturn($formRuntimeIdentifier);
+        $mockFormRuntime->expects($this->any())->method('getRenderingOptions')->willReturn($formRuntimeRenderingOptions);
+        $mockFormRuntime->expects($this->any())->method('getType')->willReturn('Form');
+        $mockFormRuntime->expects($this->any())->method('getProperties')->willReturn([]);
+
+        $mockFormElement = $this->getAccessibleMock(GenericFormElement::class, ['dummy'], [], '', false);
+
+        $mockFormElement->_set('type', 'Text');
+        $mockFormElement->_set('identifier', $formElementIdentifier);
+        $mockFormElement->_set('label', '');
+        $mockFormElement->_set('properties', []);
+
+        $expected = 'form-runtime-identifier error 123 EN';
+        $this->assertEquals($expected, $this->mockTranslationService->_call('translateFormElementError', $mockFormRuntime, 123, [], 'default value', $mockFormRuntime));
+
+        $expected = 'form-runtime-identifier form-element-identifier error 123 EN';
+        $this->assertEquals($expected, $this->mockTranslationService->_call('translateFormElementError', $mockFormElement, 123, [], 'default value', $mockFormRuntime));
+    }
+
+    /**
+     * @test
+     */
+    public function translateFinisherOptionTranslateOptionFromFormWithContentElementUidIfFormContainsNoOriginalIdentifier(): void
+    {
+        $formRuntimeXlfPath = 'EXT:form/Tests/Unit/Service/Fixtures/locallang_ceuid_suffix_01.xlf';
+
+        $formRuntimeIdentifier = 'form-runtime-identifier-42';
+
+        $formRuntimeRenderingOptions = [
+            'translation' => [
+                'translationFile' => $formRuntimeXlfPath,
+                'translatePropertyValueIfEmpty' => true
+            ],
+        ];
+
+        $this->store->flushData($formRuntimeXlfPath);
+
+        $mockFormRuntime = $this->getAccessibleMock(FormRuntime::class, ['getIdentifier', 'getRenderingOptions', 'getType', 'getProperties'], [], '', false);
+
+        $mockFormRuntime->expects($this->any())->method('getIdentifier')->willReturn($formRuntimeIdentifier);
+        $mockFormRuntime->expects($this->any())->method('getRenderingOptions')->willReturn($formRuntimeRenderingOptions);
+        $mockFormRuntime->expects($this->any())->method('getType')->willReturn('Form');
+        $mockFormRuntime->expects($this->any())->method('getProperties')->willReturn([]);
+
+        $expected = 'form-runtime-identifier-42 FooFinisher test EN';
+        $this->assertEquals($expected, $this->mockTranslationService->_call('translateFinisherOption', $mockFormRuntime, 'Foo', 'test', 'value', []));
+    }
+
+    /**
+     * @test
+     */
+    public function translateFinisherOptionTranslateOptionFromFormWithContentElementUidIfFormContainsOriginalIdentifier(): void
+    {
+        $formRuntimeXlfPath = 'EXT:form/Tests/Unit/Service/Fixtures/locallang_ceuid_suffix_02.xlf';
+
+        $formRuntimeIdentifier = 'form-runtime-identifier-42';
+
+        $formRuntimeRenderingOptions = [
+            '_originalIdentifier' => 'form-runtime-identifier',
+            'translation' => [
+                'translationFile' => $formRuntimeXlfPath,
+                'translatePropertyValueIfEmpty' => true
+            ],
+        ];
+
+        $this->store->flushData($formRuntimeXlfPath);
+
+        $mockFormRuntime = $this->getAccessibleMock(FormRuntime::class, ['getIdentifier', 'getRenderingOptions', 'getType', 'getProperties'], [], '', false);
+
+        $mockFormRuntime->expects($this->any())->method('getIdentifier')->willReturn($formRuntimeIdentifier);
+        $mockFormRuntime->expects($this->any())->method('getRenderingOptions')->willReturn($formRuntimeRenderingOptions);
+        $mockFormRuntime->expects($this->any())->method('getType')->willReturn('Form');
+        $mockFormRuntime->expects($this->any())->method('getProperties')->willReturn([]);
+
+        $expected = 'form-runtime-identifier FooFinisher test EN';
+        $this->assertEquals($expected, $this->mockTranslationService->_call('translateFinisherOption', $mockFormRuntime, 'Foo', 'test', 'value', []));
+    }
 }