Manual:Language

In MediaWiki, there are various kinds of languages:
 * The site content language ($wgContLang, based on $wgLanguageCode), which should generally stay the same as long as the wiki exists.
 * The site content language variant (Manual:$wgDefaultLanguageVariant) is the default variant when LanguageConverter is implemented for that language.
 * The user interface language ($wgLang), which can be changed in your preferences or with  in the URL, but also generally remains the same while using the wiki.
 * The user language variant which is the variant of the site content language variant, as preferred by the user. It can also be set through  in the URL (e.g. by selecting one of the tabs).
 * The page content language. This can be different for each page, even if the site and user language is the same. It is defined in getPageLanguage in Title.

All three of them are a Language object.

Page content language

 * Default value
 * $wgLang on special pages.
 * English for CSS and JS pages.
 * For MediaWiki namespace pages, the language depends on the subpage. For example, MediaWiki:Message/ar will be set to Arabic (ar), and MediaWiki:Message will be $wgContLang.
 * All other pages are $wgContLang by default.
 * Configuration
 * Extensions can change all other pages through the PageContentLanguage hook. The value for special pages, CSS, JS, and MediaWiki namespace pages cannot be overridden.


 * Examples
 * The Translate extension uses it for the page translation feature. See Project list/ar as a translation of Project list. The directionality of the page is thus correctly set to right-to-left for Arabic.


 * What does it define?
 * In SkinTemplate, it adds a  around the page text. The dir attribute sets the correct direction. The lang attribute will always be the root code, e.g. "de" even when "de-formal" is given.
 * For file pages, it is set in ImagePage.php, because there is a lot of HTML that is in the user language.
 * In Parser.php, it sets the table of contents (TOC), and stuff like grammar, although not really relevant mostly. To do that only, use parserOptions->setTargetLanguage.