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
editThe 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 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 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
editBy 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
editSome 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
editFor 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
editBesides 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 {{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
edit- Displays a message as the page is rendered, similar to {{NUMBEROFARTICLES}}
- Example: {{msg:sic link}} → [sic]
MSGNW
edit- Same as MSG, except the message is enclosed in <nowiki> tags.
- Example: {{msgnw:sic link}} → {{sic|link}}<noinclude>
== Usage == * <nowiki>{{sic link}}</nowiki> This template is an alternative to <nowiki>{{sic|link}}</nowiki>. == Examples == See [[Template:Sic]] for more information. [[Category:Quotation templates|{{PAGENAME}}]] </noinclude>
See also Help:Template#msgnw.
SUBST
edit- 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 Wikipedia:How to edit a page.
- Example: {{subst:sic link}}
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.
Backlinks
editIt 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
editWikinews-specific content and links to other help pages
editHelp contents Reading:
Go |
Search |
URL |
Namespace |
Page name |
Section |
Link |
Backlinks |
Piped link |
Interwiki link |
Redirect |
Variable |
Category
|