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:my_sitepackage/Configuration/Sets/Main/setup.typoscript
lib.blogListTitle = TEXT
lib.blogListTitle {
  data = LLL : EXT:my_extension/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:my_sitepackage/Configuration/Sets/Main/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.

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:my_extension/Configuration/Sets/Main/setup.typoscript
plugin.tx_myextension {
  _LOCAL_LANG {
    en.comment_header = Remarks
    de.comment_header = Bemerkungen
    zh.comment_header = 备注
  }
}
Copied!

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

Which language key an override needs 

Changed in version 15.0 Important: #110175 - TypoScript _LOCAL_LANG.default is a last-resort fallback

_LOCAL_LANG.default overrode the labels of the English XLIFF file, because TYPO3 read default as English. It is a last resort now, so an override of an English label has to move to en or en-US.

Write the language key of the locale the override belongs to. TYPO3 resolves a label in this order, and takes the first one it finds:

  1. The _LOCAL_LANG override of the locale, for example fr-LU.
  2. The _LOCAL_LANG override of the language of that locale, or of one of its fallback locales, for example fr.
  3. The label of the XLIFF file of the locale or of a fallback locale.
  4. _LOCAL_LANG.default , and only where the label exists in none of the above.

So default reaches the output only for a label that no XLIFF file carries. Use it for a label of your own, and a language key for everything that overrides a shipped label.

Write a key of a locale as the language in lowercase, a dash, and the country in uppercase, so fr-LU and en-US. TYPO3 normalizes the key, so fr_LU resolves to the same locale. Keep to one spelling in a project, which stays easier to read.

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

Outside of an Extbase request TYPO3 tries to infer the the extension key from the extensionName ViewHelper attribute or the language key itself.

Fictional root template
page = PAGE
page.10 = FLUIDTEMPLATE
page.10.template = TEXT
page.10.template.value (
  # infer from extensionName
  <f:translate key="onlineDocumentation" extensionName="backend" />

  # infer from language key
  <f:translate key="backend.messages:onlineDocumentation" />

  # should not work because the locallang.xlf does not exist, but works right now
  <f:translate key="LLL:EXT:backend/Resources/locallang.xlf:onlineDocumentation" />
)
# Note the tx_ prefix
plugin.tx_backend._LOCAL_LANG.en {
  onlineDocumentation = TYPO3 Online Documentation from Typoscript
}
Copied!

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.