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 needed to set this property in the site configuration anymore, and is removed from the Backend UI. The information is now automatically derived from the Locale setting of the Site Configuration.

As a result, the amount of options in the User Interface for integrators is reduced.

The PHP method SiteLanguage->getHrefLang() serves no purpose anymore and is deprecated.

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 can not select a value for the "hreflang" setting anymore via the TYPO3 Backend. However, when saving a site configuration via the TYPO3 Backend will still keep the "hreflang" setting so no information is lost.

Affected installations

TYPO3 installation actively accessing this property via PHP or TypoScript.


No migration is needed as the explicit option is still evaluated. It is however recommended to evaluate if the setting is really needed, 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.