简体   繁体   English

TYPO3: Form element.textarea-1.properties.defaultValue 翻译

[英]TYPO3: Form element.textarea-1.properties.defaultValue translation

I'm working on translating a TYPO3 form.我正在翻译 TYPO3 表格。

All works like a charm, only the defaultValue attibute don't.一切都像一个魅力,只有 defaultValue 属性没有。

This is the relevant part of the form definition: `这是表单定义的相关部分:`

renderingOptions:
  templateVariant: version2
  submitButtonLabel: Abschicken
type: Form
identifier: productformular
label: 'Formular Produktseite'
prototypeName: standard
renderables:
  -
    renderingOptions:
      previousButtonLabel: 'Previous step'
      nextButtonLabel: 'Neue Seite'
    type: Page
    identifier: page-1
    label: Produktanfrage
    renderables:
      -
        defaultValue: 'Guten Tag, ich interessiere mich für dieses Gerät. Bitte melden Sie sich schnellstmöglich bei mir.'
        type: Textarea
        identifier: textarea-1
        label: Nachricht
        properties:
          fluidAdditionalAttributes:
            placeholder: 'Ihre Nachricht an uns'

` `

Unfortunately, I can't find a hint in any instructions on how to translate the defaultValue.不幸的是,我无法在任何说明中找到有关如何翻译 defaultValue 的提示。

Has anybody a soilution for me?有人给我解决方案吗?

I tryed something like `我试过像`

<trans-unit id="productformular.element.textarea-1.properties.label">
   <source>Message</source>
</trans-unit>
<trans-unit id="productformular.element.textarea-1.properties.placeholder">
   <source>Your message to us</source>
</trans-unit>
<trans-unit id="productformular.element.textarea-1.properties.defaultValue">
   <source>Hello, I am interested in this device. Please contact me as soon as possible.</source>
</trans-unit>

` Label and placeholder are translated, but defaultValue doesn't. ` Label 和占位符被翻译,但 defaultValue 没有。

As described in Rustyjim's post, TYPO3 does not (yet) provide this possibility.正如 Rustyjim 的帖子中所述,TYPO3(还)没有提供这种可能性。

I didn't want different forms per language, also a javascript solution didn't seem to fit for this.我不希望每种语言有不同的 forms,而且 javascript 解决方案似乎也不适合这个。

I solved it now using the form view helper and the standard fluid translate function:我现在使用表单视图助手和标准流体翻译解决了它 function:

        <formvh:render
        persistenceIdentifier="EXT:liftfinder/Resources/Private/Forms/productContactForm.form.yaml"
        overrideConfiguration="{
          renderables: {
            0: {
              renderables: {
                4: {
                  defaultValue: '{f:translate(key: \'textarea-1_defaultValue\')}'
                }
              }
            }
          }
        }"
    />

It's not really a good solution either, because the elements are addressed by a sequence number instead of a unique identifier.这也不是一个很好的解决方案,因为元素是通过序列号而不是唯一标识符来寻址的。

Better solutions are welcome.欢迎更好的解决方案。

I am not aware of a solution with XLIFF.我不知道 XLIFF 的解决方案。 But you can use Form variants to override the defaultValue:但是您可以使用Form 变体来覆盖 defaultValue:

-
  defaultValue: 'Max Powers'
  identifier: name
  label: Name
  type: Text
  variants:
    - identifier: defaultValue-for-de
      condition: 'siteLanguage("twoLetterIsoCode") == "de"'
      defaultValue: 'Max Mustermann'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM