Help:MediaWiki namespace

From Wikinews, the free news source you can write!
Jump to navigation Jump to search
Noia 64 apps help index.png
This is a copy of m:Help:MediaWiki namespace using Wikinews-specific templates. Don't edit this page, except to replace the contents with the current version of that master page. To make changes applicable on all projects, edit the master page; to change Wikinews-specific content, edit the templates; to make demos work, copy templates to this project, and images to Wikimedia Commons. Please see the history of the master page for author details. Please note that all meta content is licensed under the GFDL. As a result this page is licensed under the GFDL.- Edit this template

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[edit]

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 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[edit]

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[edit]

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[edit]

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[edit]

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 {{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[edit]

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[edit]

en:Wikipedia:MediaWiki namespace, Message substitution

Wikinews-specific content and links to other help pages[edit]

Help contents

Reading: Go | Search | URL | Namespace | Page name | Section | Link | Backlinks | Piped link | Interwiki link | Redirect | Variable | Category
Tracking changes: Recent | (enhanced) | Related | Watching pages | Page history | Diff | User contributions | Edit summary | Minor edit
Logging in and preferences: Logging in | Preferences | User style
Editing: Overview | New page | Images/files | Image description page | Special characters | Formula | Table | EasyTimeline | Template | Renaming (moving) a page | Automatic conversion of wikitext | Talk page | Testing || rlc | Meta | Wikibooks | Wikicommons | Wikipedia | Wikiquote | Wikisource | Wiktionary