Attention

TYPO3 v9 has reached its end-of-life September 30th, 2021 and is not maintained by the community anymore. Looking for a stable version? Use the version switch on the top left.

You can order Extended Long Term Support (ELTS) here: TYPO3 ELTS.

TypoScript configuration

Tip

This section is outdated. For TYPO3 9 LTS and newer with Site Configurations, please see Adding Languages

A working multilingual site implies some TypoScript configuration in order to function properly. This is what is defined in the Introduction Package:

# Localization:
config {
        linkVars = L(int)
        sys_language_uid = 0
        sys_language_overlay = 1
        # fall back to language 'da', then to 'de' and as last resort use 'en'
        sys_language_mode = content_fallback;2,1,0
        language = en
        locale_all = en_US.UTF-8
        htmlTag_setParams = lang="en" dir="ltr" class="no-js"
}
[globalVar = GP:L = 1]
        config {
                sys_language_uid = 1
                language = de
                locale_all = de_DE.UTF-8
                htmlTag_setParams = lang="de" dir="ltr" class="no-js"
        }
[global]
[globalVar = GP:L = 2]
        config {
                sys_language_uid = 2
                language = da
                locale_all = da_DK.UTF-8
                htmlTag_setParams = lang="da" dir="ltr" class="no-js"
        }
[global]

The properties used in the above snippet are discussed below, one by one. A link to the TypoScript reference is given for each of them.

The config.sys_language_mode and config.sys_language_overlay properties are described more in detail in the Localization modes chapter and the Localized content chapter respectively.

The "&L" variable

The L is used to pass the value of the language in the URLs. Although it is not a requirement to use L, it is highly recommended because it is a common practice in the community and may even be hard-coded in some places.

config.linkVars = L(int) means that &L=x will be added as GET request variable to every link generated by TYPO3 CMS and only integers are allowed as values as a security measure.

If there are only a restricted number of values for L - which is the case most of the time (like above 0, 1 and 2) you can and should restrict this even further to config.linkVars = L(0-2). More examples can be found in the TypoScript Reference:

TypoScript Reference

config.sys_language_uid

The config.sys_language_uid property indicates to which system language each possible value of the L GET variable corresponds (with 0 for the default language). The value is the uid of the corresponding „Website language“ record. TypoScript conditions are used to make the definition vary with the value of the GET variable. These conditions also imply separate caches, which explains how caching supports and recognizes a change in the L variable.

TypoScript Reference

config.language

This setting configures the system "language key" to be used for the language. This is used to select labels from XLIFF files. Setting this should make frontend plugins respond by showing labels from the correct language (requires installation of the corresponding language packs).

TypoScript Reference

config.locale_all

Configures the locale which influences how some values from PHP are formatted in the output, e.g. dates formatted using strftime() will output month/day names in the chosen language.

TypoScript Reference

config.htmlTag_setParams

Setting the "lang" and "dir" attributes using this property will help with both browser rendering and content indexing.

TypoScript Reference