Modern language detection middleware for TYPO3. Based on PSR-14 & PSR-15.

Fund package maintenance!

Installs: 1 972

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 1

Forks: 3

Open Issues: 0


1.6.1 2021-03-04 18:56 UTC

This package is auto-updated.

Last update: 2021-04-04 19:13:23 UTC



composer require lochmueller/language-detection


Use the site configuration module to configure the language detection. Just enable it, and it will works :)



There are a few central PSR-14 events that control the language detection. The attached list explain the different events and the default listener. The events are ordered in the execution order.

Event: CheckLanguageDetection

Check if the language detection should executed by the extension. You can register listeners for this event and call "disableLanguageDetection" on the event object to disable the language detection.


Name Description
BackendUserListener Check if a backend user call the language detection and disable the redirect (respect "disableRedirectWithBackendSession" config)
BotListener Check if a bot call the language detection and disable the redirect
EnableListener Check if the Language Detection is enabled in the current Site
FromCurrentPageListener Check the referrer and disable the redirect if the user comes from the current site
PathListener Check if the user call "/" and disable the redirect for other paths (respect "allowAllPaths" configuration)
WorkspacePreviewListener Check if the page is a workspace preview and disable the redirect

Event: DetectUserLanguages

This event collect user information to get the user languages. You can register your own detections and manipulate the data via "getUserLanguages" and "setUserLanguages".


Name Description
BrowserLanguage Get the users "accept-language" langauges
IpLanguage Send the IP to geoplugin.net and add the language of the location to the checked languages (respect "addIpLocationToBrowserLanguage" configuration)

Please keep data privacy in mind in case of the "IpLanguage" Listener!

Event: NegotiateSiteLanguage

This event calculate the best matching page language for the user. If you build your own listener. Please use "setSelectedLanguage" on the event. If a language is already selected the default listener will be skipped.


Name Description
DefaultNegotiation Check the Locale and TwoLetterIso of the TYPO3 languages against the user languages of the previous event

Event: BuildResponse

The last event build the middleware response. You can overwrite this step. You have to use "setResponse" to set the response.


Name Description
DefaultResponse Build the repsonse object and respect the "redirectHttpStatusCode" config