0

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>

Urs Bo
  • 308
  • 1
  • 11

2 Answers2

3

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.

Urs Bo
  • 308
  • 1
  • 11
2

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:

sebkln
  • 1,325
  • 1
  • 9
  • 17
  • 1
    For people going that route I'd like to add that it's `LLL:EXT:your_extension` not `LLL:your_extension`. Also `locallang.xlf` is assumed to be the configured default language's file, other languages would resolve to `de.locallang.xlf` (assuming the current frontend language is `de`) etc... – oehmaddin May 10 '22 at 21:49