TypoScript

Output localized strings with Typoscript

The getText property LLL can be used to fetch translations from a translation file and output it in the current language:

EXT:site_package/Configuration/TypoScript/setup.typoscript
lib.blogListTitle = TEXT
lib.blogListTitle.data = LLL : EXT:blog_example/Resources/Private/Language/locallang.xlf:blog.list
Copied!

TypoScript conditions based on the current language

The condition function siteLanguage can be used to provide certain TypoScript configurations only for certain languages. You can query for any property of the language in the site configuration.

EXT:site_package/Configuration/TypoScript/setup.typoscript
lib.something = TEXT
[siteLanguage("locale") == "de_CH"]
    lib.something.value = This site has the locale "de_CH"
[END]
[siteLanguage("title") == "Italy"]
    lib.something.value = This site has the title "Italy"
[END]
Copied!

Changing localized terms using TypoScript

It is possible to override texts in the plugin configuration in TypoScript for Extbase based plugins.

Overriding translations in non-Extbase plugins does not work out of the box.

See TypoScript reference, _LOCAL_LANG.

If, for example, you want to use the text "Remarks" instead of the text "Comments", you can overwrite the identifier comment_header for the affected languages. For this, you can add the following line to your TypoScript template:

EXT:blog_example/Configuration/TypoScript/setup.typoscript
plugin.tx_blogexample._LOCAL_LANG.default.comment_header = Remarks
plugin.tx_blogexample._LOCAL_LANG.de.comment_header = Bemerkungen
plugin.tx_blogexample._LOCAL_LANG.zh.comment_header = 备注
Copied!

With this, you will overwrite the localization of the term comment_header for the default language and the languages "de" and "zh" in the blog example.

The locallang.xlf files of the extension do not need to be changed for this.

stdWrap.lang

stdWrap offers the lang property, which can be used to provide localized strings directly from TypoScript. This can be used as a quick fix but it is not recommended to manage translations within the TypoScript code.