Help:MediaWiki namespace
From Wikipedia, the free encyclopedia
The MediaWiki namespace is one of the 16 standard namespaces in the database structure of the MediaWiki software.
Contents |
[edit] Overview
The MediaWiki namespace is a mechanism allowing administrators to customise or translate the MediaWiki web interface. It is enabled by default in recent mediawiki versions, mw:Manual:$wgUseDatabaseMessages = true enables them.
All messages defined can be viewed at Special:Allmessages with some nice features. Because this displays all system messages (over 1 MB) some users might prefer to view these messages alphabetically: @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
The contents of the MediaWiki namespace pages override any corresponding settings in the language files, i.e., the static version of messages. Using the MediaWiki namespace is a bit slower than other namespaces.
[edit] 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 in theory cause the software to stop working if they are changed, for example MediaWiki:Linktrail. In practice the software ignores the database contents for MediaWiki:Linktrail, taking the regular expression straight out of the message files, for performance and stability reasons.
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.
[edit] Technical details
The namespace number of MediaWiki messages is 8, with a corresponding MediaWiki talk namespace 9 to discuss individual messages. Some projects offer templates like en:Template:editprotected (backlinks, edit) to propose modifications, others have a page like Meta:Requests for help from a sysop or bureaucrat for this purpose.
- Links to MediaWiki messages work like links to ordinary pages, examples
- [[MediaWiki:Edit]] MediaWiki:Edit,
- [[w:de:MediaWiki:Edit]] w:de:MediaWiki:Edit,
- [{{fullurl:m:MediaWiki:Edit|action=render}} demo] demo.
Each message in the $wgAllMessagesEn array in Messages.php corresponds to a page in the MediaWiki namespace. For example, there is a line in the php file:
'confirmprotect' => 'Confirm protection',
To this corresponds the page MediaWiki:Confirmprotect, and {{ int:Confirmprotect }} gives <Confirmprotect>. When this page is edited the new message is automatically used for say http://meta.wikimedia.org/wiki/Main_page?action=protect. Similarly w:fr:MediaWiki:Confirmprotect has the content Confirmer la protection, note that the page name itself is not translated.
[edit] Inclusion
- Inclusion of MediaWiki messages can make sense, as noted below historically these messages also covered the function of templates.
- {{
MediaWiki:Edit}} = Edit this page, see m:Template:Ed (backlinks, edit). - {{
int:Edit}} = Edit this page, colon function int: is a shorthand for MediaWiki:. - {{
int:Erehwon}} = <Erehwon>, but only as far as the message exists. - {{
MediaWiki:Erehwon}} = MediaWiki:Erehwon doesn't exist.
However many messages are not suited for inclusion, because they contain $1 and similar parameters not evaluated by the template parser, or raw CSS and XHTML markup not permitted on normal pages.
[edit] Interlanguage links
Interlanguage links in MediaWiki messages typically won't work as expected. Adding <noinclude> isn't good enough, because something has to evaluate it, as it's the case for messages included like ordinary templates, but not [clarification needed] for messages used internally as system messages.
Instead, one can use in-page interlanguage links on the talk pages, m:Template:ilm (backlinks, edit) does this for some major projects.
[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

