Urs Bo
Urs Bo

Reputation: 342

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

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>

Upvotes: 0

Views: 494

Answers (2)

sebkln
sebkln

Reputation: 1375

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:

Upvotes: 2

Urs Bo
Urs Bo

Reputation: 342

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.

Upvotes: 3

Related Questions