Deprecation: #99908 - Site language "hreflang" setting

See forge#99908


A language configuration defined for a site has had various settings, one of them being hreflang. The setting is used to generate hreflang meta tags to link to alternative language versions of a translated page, and to add the lang attribute to the <html> tag of a frontend page in HTML format.

Since TYPO3 v12 it is not necessary to set this property in the site configuration anymore. The information is now automatically derived from the locale setting of the site configuration if not set in the site configuration.

This also affects the TypoScript getData property siteLanguage:hrefLang, and the TypoScript condition [siteLanguage("hrefLang")].


Using the TypoScript settings or the PHP method will trigger a PHP deprecation notice.

An administrator cannot select a value for the hreflang setting anymore via the TYPO3 backend. However, when saving a site configuration via the TYPO3 backend it will still keep the hreflang setting so no information is lost.

Affected installations

TYPO3 installations actively accessing this property via PHP or TypoScript.


No migration is needed as the explicit option is still evaluated. It is however recommended to check if the setting is really necessary, and if the locale of the site language in the config.yaml matches the same value - even in a different format (locale: "de_AT.UTF-8", hreflang: "de-AT") - the setting hreflang can be removed.

Any calls to SiteLanguage->getHrefLang() can be replaced by SiteLanguage->getLocale()->getName().

As for TypoScript, it is recommended to use siteLanguage:locale:full instead of siteLanguage:hrefLang.