Project

General

Profile

Actions

Bug #82853

closed

Cannot translate field options by type

Added by Mathias Brodala over 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Category:
Form Framework
Target version:
Start date:
2017-10-25
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

The translation chain for field options (e.g. for SingleSelect) can only be translated a) by form identifier + field identifier or b) by field identifier. Other properties also include c) by field type.

This should be added.


Files

foo.tar.xz (1.43 KB) foo.tar.xz Pawel Cieslik, 2017-11-28 15:40
Actions #1

Updated by Gerrit Code Review over 6 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54472

Actions #2

Updated by Pawel Cieslik over 6 years ago

Please add proper reproduction instructions. How to define the translation file, etc. thanks (eg. links to docs or so)

Actions #3

Updated by Mathias Brodala over 6 years ago

Here's our usecase: we wanted to re-use the label and option labels of a select field, so we added a custom prototype which extends SingleSelect:

TYPO3:
  CMS:
    Form:
      prototypes:
        standard:
          formEngine:
            translationFile:
              - EXT:form/Resources/Private/Language/Database.xlf
              - EXT:foo/Resources/Private/Language/Extensions/Form/locallang_db.xlf

          formElementsDefinition:
            CustomSelect:
              __inheritances:
                10: 'TYPO3.CMS.Form.prototypes.standard.formElementsDefinition.SingleSelect'
              renderingOptions:
                templateName: SingleSelect

Now we use this prototype multiple times in our form definition:

# ...
renderables:
  page:
    identifier: default
    type: Page
    renderables:
      - &custom
        identifier: custom1
        type: CustomSelect
        label: Custom select label
        properties:
          options:
            1: First
            2: Second
      - <<: *custom
        identifier: custom2

Now we use the following e.g. in the EXT:foo/Resources/Private/Language/Extensions/Form/de.locallang_db.xlf file:

<!-- ... -->
<trans-unit id="element.CustomSelect.properties.label">
  <source>Custom select label</source>
  <target>Eigenes Auswahl-Label</target>
</trans-unit>

<trans-unit id="element.CustomSelect.properties.options.1">
  <source>First</source>
  <target>Erstes</target>
</trans-unit>

<trans-unit id="element.CustomSelect.properties.options.2">
  <source>Second</source>
  <target>Zweites</target>
</trans-unit>
<!-- ... -->

Without this change, we'd need to provide translation for every single field identifier.

Actions #4

Updated by Pawel Cieslik over 6 years ago

in the attachment working example for introduction package

Actions #5

Updated by Gerrit Code Review over 6 years ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54950

Actions #6

Updated by Mathias Brodala over 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #7

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF