You are currently viewing Language Handling in TYPO3 – Part 2: Frontend

Language Handling in TYPO3 – Part 2: Frontend

The second part of the language handling series of TYPO3 is about the configuration of the frontend. I show you, how to get the desired language for the website user.

Having several languages in the frontend is no rocket science, if you know how to use the TypoScript configuration properly. All the config happens in the TypoScript setup of your website.

Configuration Steps

The first step is to define values for the default language. The default language has the uid “0” in the backend. Whatever you define as the default language in TypoScript, will be used.

The second step is to overwrite this default config with other languages. In the frontend the parameter “L” is used for that. The value of this parameter is the uid of the corresponding website language.

The default values must overwritten using TypoScript conditions. Here is an example.

[globalVar = GP:L = 1]
	config {
		sys_language_uid = 1
		htmlTag_langKey  = en
		language = en
		locale_all = en_US.UTF-8

Configuration options

There are only a few configuration options in TypoScript in order to define the frontend output. All of the options are part of the config.section of TypoScript.


This option contains the uid of the current language configuration. For the default language this value may not be set, because the default value is “0”. The value of the default language in the TYPO3 backend is also “0”.

This value must be overwritten for any language available in the backend. The sys_language_uid must match the uid of the desired website language.


This value defines the language, which is used to translate the labels in the frontend. A label in this context is for example the “Read more…” text in the extension news. Labels are “imported” into TYPO3 via the module “Language”, as described in the first part.

The sister of this option is config.language_alt.

The value of this option must be one of the 51 available languages in TYPO3.


If a language is not completely translated, this is a fallback to another language. This makes sense, if two translations are quite close to each other. Examples are canadian french (fr_CA) and french (fr).

If this value is not set, the language for the label falls back to englisch.

The value of this option must be one of the 51 available languages in TYPO3.


This option defines how dates and currencies are rendered. This setting also depends on the locales, which are available on the server. The command locale -a shows all available locales on the system.

Many locales are quite similar, but are not available on every system. Since TYPO3 8LTS it is possible to define a series of fallbacks, if the first value is not found, the second locale is checked.

The option takes a comma separated list of possible locales.


The sys_language_mode defines how pages and contents are handled if there is no translation available.

The default behaviour is that menu and contents are checked the corresponding sys_language_uid. If there is none matching, menu and contents are shown in the default language.

The value strict will report an error, that there is no valid translation of the page.

The recommended setting is content_fallback. This will keep the website output always in the selected language, even if the page ist not translated. Furthermore it is possible to specify a fallback sequence of languages. Then the option looks like content_fallback; 2,3,0. If an page is not translated, TYPO3 will check the sys_language_uid2. If this is also without success, TYPO3 will check the language with uid “3”. Failing also in this one, TYPO3 would deliver the default language.


This option defines how the translation of records are done, if the translate mode was chosen.

If the value is set to “0”, only translated content elements are shown.

If the value is set to “1” and config.sys_language_mode is set to content_fallback all content elements are shown. If a translation is available, the translated version is displayed. Otherwise all languages defined in the fallback are checked. The first one found is shown.

The option “hideNonTranslated” will only show those records which have a translation. Those, which are only available in the default language, are hidden.

config.sys_language_isocode_default and config.sys_language_isocode

These two values were introduced with TYPO3 7LTS. ISO 639-1 two-letter codes are now available with each sys_language_uid record. As there is no default sys_language_uid the default iso code must be set accordingly.

For the iso code of the other languages there should be no reason to set it, because it is provided by the sys_language record. But if that must be the case, you can overwrite it here.

It is part of the TSFE part and can be used in TypoScript using the value TSFE:sys_language_isocode. Other than that is has no other implications for now … but … but it is one of the necessary steps to get rid of the default language in TYPO3 (aka sys_language_uid = 0).


config.linkVars is not an option specific to languages, but it helps to keep your caches clean. The specified parameters are always added to the created links.

The language parameter is always passed with the parameter L. So it would / is possible to add any value to this variable in the request, whether it is configured in the BE or not. Each request with another language uid would create another set of cache entries.

The option config.linkVars assures, that the language parameter is always set (if not zero). Additionally it accepts only those uids specified in round braces are accepted.

A full example of this option looks like this:

config.linkVars = L(1-3), print

This will append the language parameter L, only if it is in the range of 1, 2 or 3. For all other values the variable will not be appended to the URL.

Check TYPO3 localization output

Since TYPO3 V7 the language output can be checked in the backend using the module “Web” => “View”. If a page is translated, it is also possible to switch between the available languages on this page.

RealURL configuration

Last but not least there is the configuration of RealURL. This extension is still the de-facto standard in TYPO3. The needed code snippet is for the preVars-section.

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT']['preVars'] => [
                     'GETvar' => 'L',
                     'valueMap' => [
                          '' => '0',
                          'de' => '1',
                          'dk' => '2'
                    'noMatch' => 'bypass',


This was the second part of the language handling in TYPO3 series. I tried to line out howto configure the language handling for frontend output. If you are interested how to handle translations in the backend, check out the first part of this series: “Language Handling in TYPO3 – Part 1: Backend

In case you like to have more detailed insights, you can have a look at the TYPO3 frontend localization guide. The third part of this series will be about how to configure the language handling in your extensions.

I hope, that this post has been interesting for you. If so or if you know somebody, who could profit from it, please share this post via your favorite social network. For your convenience, I added some share buttons at the end of this page.

I found the blog post image on pixabay . It was published by smilingpixell under the CC0 public domain license. It was modified by myself using pablo on buffer.

This Post Has 3 Comments

  1. Anonymous


  2. Rob

    thanks for the tutorial, I came across while searching for a possibility to set the frontendLanguage after the login to a language saved in the frontendUser. Have you ever encountered something that would help me in this case or have you had the same issue at any time?

  3. Anonymous


Leave a Reply