Help:MediaWiki namespace

Note: "MediaWiki namespace" is the name of one of the 16 namespaces in the database structure of the MediaWiki software, see Help:Namespace for an overview.

Overview
The MediaWiki namespace is a mechanism allowing non-developers, in particular administrators, to customise or translate the MediaWiki web interface. It is enabled by default in recent mediawiki versions, $wgUseDatabaseMessages = true enables them.

The contents of the MediaWiki namespace pages override any corresponding settings in the language files listed in Locales for the Wikimedia projects, i.e., the static version of messages. Using the MediaWiki namespace is a bit slower.

Each message in the $wgAllMessagesEn array in Language.php now corresponds to a page in the MediaWiki namespace. For example, there is a line in the php file:

"fromwikipedia"	=> "From $wgSitename, the free encyclopedia."

To this corresponds the page en:MediaWiki:Fromwikipedia whose whole content is "From Wikipedia, the free encyclopedia.". It is the message which is displayed at the top of each page of the English Wikipedia. When this page en:MediaWiki:Fromwikipedia is edited the new message appears automatically at the top of every page of the English Wikipedia. Similarly fr:MediaWiki:Fromwikipedia has the content "Un article de Wikipédia, l'encyclopédie libre." (note that the page name itself is not translated).

All messages defined can be viewed at Special:Allmessages - fast and live, with direct links to each editable message. Messages that have been changed are highlighted, and the default and current texts are shown side by side.

Just like in templates, interlanguage links have to be dispensed with, even though multilingual project families have for each message a corresponding page in each project. Instead, one can use in-page interlanguage links in the talk pages.

Protection
By default, all messages are protected. This is necessary for a number of reasons:


 * Many messages are in plain HTML, hence users could insert malicious scripts
 * Vandalism of some messages would be extremely disruptive, for example changes to the text of the links in the sidebar would immediately be visible to all users
 * A few messages can cause the software to stop working if they are changed, for example MediaWiki:Linktrail.

However, some messages do not suffer from any of these disadvantages, and it is expected that these messages will be identified and unprotected at some stage.

Strings exclusive to language file
Some text strings cannot be customised using this feature, and so can only be changed by editing the language file. These include:


 * The namespace titles "User", "Wikipedia", "Image", etc.
 * The names of the special pages
 * Month and days-of-the-week names
 * A number of items in Special:Preferences

To view these text strings, see Locales for the Wikipedia Software.

'For MediaWiki version 1.3, see further Help:Template. What follows below is for earlier versions.'

MediaWiki version 1.2.6
For versions before 1.3, another important function of the MediaWiki namespace is to provide customised, often used messages to use in articles (see Access section below and the use of MSG and SUBST).

Access
Besides use by the PHP script, messages can be accessed from inside articles. There are three special tags for this purpose, listed below. This makes it possible to create messages for boilerplate text, such as VFD notices and stub warnings. Instead of pasting in the stub warning from en:Wikipedia:Boilerplate text, you could just type.

A new custom message can be created by making a link in the MediaWiki namespace, such as MediaWiki:Example and editing the page with the text you wish it to contain. You may want to consider protecting the messages you create. Also list any new pages in the MediaWiki namespace in the appropriate page that tracks them.

MSG

 * Displays a message as the page is rendered, similar to


 * Example: &rarr;

MSGNW

 * Same as MSG, except the message is enclosed in  tags.


 * Example: &rarr;

See also Help:Template.

SUBST

 * Same as MSG, except that the message is substituted as the page is saved, not as it is viewed. So if someone edits the page later on, they will not see the tag in the wikitext, they will just see the message itself. This is similar to the "pipe trick" and signing on Talk pages, see How to edit a page.


 * Example:

If you want to use a modified version of the standard message, you have to save the standard version first, then edit it, because when applying preview the subst code is not yet replaced by the standard message in the edit box. In the edit summary of the temporary edit you can put "tmp" to indicate that you have not made an error but are still working on the page.

See also Help:Template.

Backlinks
It is very important to realise that if contains a wikilink then "What links here" on wikilink page will not show the article containing the msg, but MediaWiki:something instead. This behaviour was requested by editor consensus.

To see the backlinks to pages using you have to use "What links here" of MediaWiki:something.

(This problem doesn't exist when using subst.)