#LANG

#LANG displays the language code taken from the element that is closest to the tag. If the tag is located within a loop, #LANG will return the SQL "lang" field from the loop if it exists, otherwise it will return that of the (#ENV{lang}) environment, and failing that the language code for the site’s main language (#CONFIG{langue_site}).

#LANG* is used to return only the language of the loop or the environment. If none is defined, then the tag doesn’t return anything (that is, it doesn’t even return the site’s main language).

Example

Define the language in the HTML tag for the page:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="#LANG" lang="#LANG" dir="#LANG_DIR">

Define the language in an RSS feed (an example from squelettes-dist/backend.html) :

<rss version="2.0"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
>
<channel[ xml:lang="(#LANG)"]>
	<title>[(#NOM_SITE_SPIP|texte_backend)]</title>
	...
	<language>#LANG</language>
	<generator>SPIP - www.spip.net</generator>
	...
</channel>
</rss>

Author Mark Baber Published : Updated : 12/03/23

Translations : English, français, Nederlands