Jump to content

Help:MediaWiki namespace

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Omniplex (talk | contribs) at 21:09, 6 April 2006 (TRANSWIKI from Meta). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Template:H:h

The MediaWiki namespace is one of the 16 standard 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 [1] 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 w: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 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.

If an administrator wishes to allow general editing of a MediaWiki page, a method is to place the message on a template, and then transclude the template back onto the MediaWiki page.

Links to corresponding pages on other projects are conveniently put (on the talk pages) using a template like m:Template:ilm (backlinks edit).

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 and later, 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 AFD notices and stub warnings. Instead of pasting in the stub warning from en:Wikipedia:Boilerplate text, you could just type {{SUBST:stub}}.

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 {{NUMBEROFARTICLES}}
Example: {{msg:rcnote}} → Below are the last $1 changes in last $2 days.


MSGNW

Same as MSG, except the message is enclosed in <nowiki> tags.
Example: {{msgnw:rcnote}}

See also Help:Template#msgnw.

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 Help:Editing.
Example: {{subst:rcnote}}

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#subst.

It is very important to realise that if {{msg:something}} 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 {{msg:something}} you have to use "What links here" of MediaWiki:something.

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

See also

Template:H:f