Search code examples
formstypo3translationtypo3-8.xtypo3-extensions

How do you translate EXT:Form Buttons in TYPO3 CMS 8.7 LTS?


with the topic How do you translate EXT:Form forms in TYPO3 CMS 8.7 LTS? i got my translations almost complete. Can anyone help me to also translate the prevous and next buttons in the forms?

f.e.

renderables:
  -
    renderingOptions:
      previousButtonLabel: ''
      nextButtonLabel: ''
    identifier: page-1
    label: ''
    type: Page

Solution

  • You can use the following translation keys to translate buttons in EXT:form.

    element.Form.renderingOptions.submitButtonLabel
    element.Page.renderingOptions.previousButtonLabel
    element.Page.renderingOptions.nextButtonLabel
    element.SummaryPage.renderingOptions.previousButtonLabel
    element.SummaryPage.renderingOptions.nextButtonLabel
    

    These allow to localize button labels globally for all forms equally.


    You can set translated custom labels for specific forms, too. Please mind the special position of the form-identifier inside the translation key only for the submit button (seems a bug):

    element.<form-identifier>.renderingOptions.submitButtonLabel
    

    To translate previous and next buttons for specific forms, you can use the element-identifiers. You can also combine these with a form-identifier.

    Form definition (excerpt):

    renderables:
      -
        renderingOptions:
          previousButtonLabel: 'Previous step'
          nextButtonLabel: 'Next step'
        identifier: summarypage-1
        label: 'Summary page'
        type: SummaryPage
    

    Translation keys:

    <form-identifier>.element.<element-identifier>.renderingOptions.nextButtonLabel
    element.<element-identifier>.renderingOptions.nextButtonLabel
    <form-identifier>.element.<element-identifier>.renderingOptions.previousButtonLabel
    element.<element-identifier>.renderingOptions.previousButtonLabel
    

    Example keys for the form definition above:

    MyContactForm.element.summarypage-1.renderingOptions.previousButtonLabel
    element.summarypage-1.renderingOptions.previousButtonLabel
    

    Limitation: You can not translate previous and next buttons when combining the form-identifier and the general element-type (like 'SummaryPage').

    The following won't work:

    <form-identifier>.element.SummaryPage.renderingOptions.nextButtonLabel