How to implement multilingual labels in tx:mask (TYPO3)?

477 Views Asked by At

I would like implement multilingual labels in TYPO3 mask. After implementing with the following FLUID-code the label does not change based on the chosen language:

<f:link.page pageUid="{data.tx_mask_inhalt_text_link}">
<f:if condition="{TSFE.sys_language_uid} == 1">
    <f:then>
         enter code here`Read more
    </f:then>
    <f:else>
         Weiterlesen
    </f:else>
</f:if>

</f:link.page>

2

There are 2 best solutions below

1
Urs Bo On BEST ANSWER

I solved the issue with:

MASK-Template:

<f:translate key="label" />

TYPO3-Setup:

plugin.tx_mask._LOCAL_LANG.de.label = Weiterlesen
plugin.tx_mask._LOCAL_LANG.en.label = Read more

Works like a charm.

1
sebkln On

You can use XLIFF files to localize values in TYPO3. This is neither limited to nor different for mask templates (as these are common Fluid templates).

A locallang.xlf contains entries like:

<trans-unit id="readmore">
    <source>Read more</source>
    <target>weiterlesen</target>
</trans-unit>

In the HTML template you can use the f:translate viewhelper:

<f:translate key="LLL:EXT:your_extension/Resources/Private/Language/locallang.xlf:readmore" />

This will render the value depending on the current frontend language.


This is the usual way of translating in TYPO3. Please refer to these official documentations for all details: