Help:System message

From Meta, a Wikimedia project coordination wiki
Jump to navigation Jump to search
Blue Glass Arrow.svg MediaWiki-2020-logo.svg
A proposal to move this page to was rejected.

A MediaWiki system message is a modifiable piece of text displayed as part of the MediaWiki interface. System messages are stored in pages in the "MediaWiki" namespace. If the page for a specific system message does not exist on the current wiki, a default value defined at is used (and this value will be visible when one attempts to view the nonexistent local MediaWiki-namespace page).

Which system messages are displayed to a particular user on a particular wiki depends on various language settings. To be more specific, the language used for the interface will be the first of the following that applies:

  1. the language specified in the parameter uselang in the URL (e.g.,, if present
  2. for a logged-in user, the user's language preference, if that has been set
  3. for a user who is not logged in, and for a logged-in user who has not specified a language in their preferences, the site language (which can be determined by using {{CONTENTLANGUAGE}} — on this wiki, this gives "en" — on a German wiki, say, it would be "de")

In principle, there are more than 4,000 system messages for each of almost 400 languages supported by MediaWiki, held in language files maintained by the MediaWiki developers. In practice, however, many languages have incomplete or even missing language files. In the distant past, Wikipedias were often set up without a localized set of system messages for the relevant language, in which case either English was used for the interface or localization was done locally on the wiki itself. This can no longer happen today because the existence of a language file is a condition for opening a Wikimedia wiki in a new language. (Still, only the most-used messages must be translated before a new language wiki can be created.)

When a system message in a particular language is not available, the language that will be used for the message depends on a system of fallbacks defined for each language. For example, Tatar (in its native script) falls back to Tatar in the Cyrillic script, which falls back to Russian, which falls back to English. (Every non-English language ultimately falls back to English because the English version of the message should always exist.)

To see which system messages are being displayed on a specific page, append "?uselang=qqx" to the URL (or, if the URL already contains a query string following a "?", then append "&uselang=qqx" instead). You can see how this works by comparing the page you are reading with that given by (in particular, note the links at the top of the page and along the left side).

In addition to determining how the interface looks, system messages can also be used in page content (including in templates) through the use of the int parser function. (See, for example, Category:User interface language dependent templates.)

MediaWiki namespace[edit]

The MediaWiki namespace is one of the 16 standard MediaWiki namespaces. It allows administrators to change the default system messages. The MediaWiki namespace is enabled by $wgUseDatabaseMessages=true;, which is the default.

For example, see MediaWiki:Aboutpage, MediaWiki:Aboutpage/fr, and MediaWiki:Aboutpage/de.

However, MediaWiki:Sidebar/language_code does not work (for a sidebar for users with that interface language); instead, the page MediaWiki:Sidebar can refer to message IDs which provides link labels dependent on the user-specified interface language. If the message is neither defined in the message file concerned, nor on the MediaWiki page, the message in the message file for English is used.

When viewing a "non-existing" page of which the name is an existing message name, the page shows the default. A "non-existing" page can be recognized by the lack of a history link. When editing such a page, the default is automatically preloaded into the edit window. Transclusion of a "non-existing" page in the MediaWiki namespace trancludes the default.

For the names of all "existing" pages see @ 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

For all supported languages, all default messages and current versions can be viewed at Special:Allmessages. When creating a page to override the default it is useful to first save the default version, to allow diffs with it.

An administrator with access to the language files can choose between adapting these and creating pages in the MediaWiki namespace. The latter makes it easier to update to a new version of MediaWiki while keeping the own versions of messages. On the other hand, it is easier to transfer a language file to another MediaWiki site than to export and import pages, for the benefit of users who have selected the language concerned as interface language.

Also, an administrator can add extra pages to the MediaWiki namespace, to be accessed, for example, by function int (e.g. MediaWiki:Lang), or by a gadget. These are not shown in Special:Allmessages.

An extension can set e.g. message key aaa to bbb by:

  global $wgMessageCache;
  $wgMessageCache->addMessages( array ('aaa' => 'bbb') );

The key has to start with a lowercase letter, even though message files define messages using an ID written with a capital, and even though the corresponding MediaWiki page has a capital after the colon, in this case MediaWiki:Aaa, even on wikis which allow a lowercase first letter in page names. (The default content of MediaWiki:aaa becomes bbb, but changing it has no effect.)

After getting the array $ma of extension messages:

  $ma = $wgMessageCache->getExtensionMessagesFor( 'en' );

the value can be retrieved with $ma['aaa'], e.g. by:

  $wgOut->addWikiText( $ma['aaa'] );

The result after possible overriding by the contents of the MediaWiki page can be retrieved by wfMsg('aaa').

This applies not only for a message in the strict sense; for example, an extension can allow the user community, through an administrator, to supply parameters in this way; this can even be the name of an extension tag, see e.g. mw:Extension:PropertyTable, where the tag <properties> is the default, but e.g. the tag <pr> can be used after creating the page "MediaWiki:propertyTable tag" with the content "pr" (but note that for portability of wikitext across wikis with the same extension this flexibility has also disadvantages).

All characters of namespace prefixes are case-insensitive, so one can write "mediawiki:".

LocalSettings.php can set messages too, see thread.


By default, the whole MediaWiki namespace is 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

On the other hand, especially for pages MediaWiki:message_ID/language_code the protection is somewhat impractical because administrators do not know all the languages that can be set for the user interface.

If an administrator wishes to allow general editing of a system message, a template call can be placed in the MediaWiki page, with the template containing the message itself.

A few messages can in theory cause the software to stop working if they are changed, for example "linktrail". Therefore and for processing efficiency the effect of page MediaWiki:Linktrail has been disabled: the software ignores its contents, taking the regular expression straight out of the message files.

Technical details[edit]

The namespace number of MediaWiki messages is 8, with a corresponding MediaWiki talk namespace 9 to discuss individual messages. Some MediaWiki wikis offer templates like w:Template:editprotected [ talk edit history links ] to propose modifications, others have a page like Meta:Requests for help from a sysop or bureaucrat for this purpose.

For links to MediaWiki messages, existence detection applies to existence of the message, not existence of the page:

  • "[[mediawiki:1movedto2]]" → "mediawiki:1movedto2" [1] - link to non-existing page (view mode) for existing message
  • "[[mediawiki:1movedto3]]" → "mediawiki:1movedto3" [2] - link to non-existing page (edit mode) for non-existing message
  • "[[w:de:MediaWiki:Edit]]" → "w:de:MediaWiki:Edit" [3]
  • "[ demo]" → "demo" [4]

Each message in the i18n/en.json file corresponds to a page in the MediaWiki namespace. For example, there is a line in the JSON file:

"tog-oldsig": "Your existing signature:",

To this corresponds the page MediaWiki:Tog-oldsig, and {{int:MediaWiki:Tog-oldsig}} gives ⧼MediaWiki:Tog-oldsig⧽ [5]. When this page is edited the new message is automatically used for Special:Preferences#mw-prefsection-personal-signature. Similarly w:fr:MediaWiki:Tog-oldsig has the content Votre signature actuelle :, note that the page name itself is not translated.


Transclusion of a system message can be done with the regular tranclusion syntax for the MediaWiki page, even if the page does not exist and the default is used:

"{{mediaWiki:edit}}" → "Edit" [6], the content of MediaWiki:Edit, or if it does not exist, the system message with id "edit" for the site language

Also, parser function int can be used (for an application, see e.g. Template:Ed):

"{{int:edit}}" → "Edit" [7], the content of MediaWiki:Edit/xx where xx is the user language, or if it does not exist, the system message with id "edit" for this language.

If there is neither a page nor a default the result of "int" is different from "MediaWiki:" even if the user uses the default interface language of the site:

"{{mediaWiki:erehwon}}" → "MediaWiki:Erehwon" [8]
"{{int:erehwon}}" → "⧼erehwon⧽" [9]

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.

While $1, $2, etc. do not work as parameters when using "mediawiki":

  • "{{mediawiki:revertpage|a|b}}" gives "Reverted changes by $2 (talk) to last version by $1" [10]

they do when using "int":

  • "{{int:revertpage|a|b}}" gives "Reverted changes by b (talk) to last version by a" [11]

Error messages[edit]

Error messages are in the site language, e.g. "{{#expr:a}}" → "Expression error: Unrecognized word "a"." [12]. This allows branching depending on the type of error, independent of the user language. Note however that wikitext for such branching has to be adapted when transferring it to a wiki with an other site language. This is not needed in the case of branching depending on whether any error occurs, with #iferror.

Interlanguage links[edit]

Interlanguage links in MediaWiki messages typically do not work: noinclude tags and the link syntax may not be interpreted.

Instead, one can use in-page interlanguage links on the talk pages, Template:Ilm does this for some major MediaWiki wikis.

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:

  • The namespace titles "User", "Wikipedia", "Image", etc. ($namespaceNames)
  • The names of the special pages ($specialPageAliases)

Branching based on the user language[edit]

We have seen that the result of expansion of wikitext can depend on the user language through the use of "int". The exact behaviour with that regard is not completely clear and may change in the future (see in particular bugs 1495 and its duplicate 8188 for Commons, 13010 and 2085; $wgForceUIMsgAsContentMsg).

In addition to the possibility of directly storing the alternative texts in the MediaWiki namespace we can also use "int" only to find the code of the user language, and then use any branching method.

The code of the user language is not directly available, but can be obtained with {{int:lang}} after creating a collection of pages Mediawiki:lang/xx, each containing the corresponding language code xx, see e.g. [13]:

"{{int:lang}}" → "en" [14] (gives the code of the user language if the MediaWiki page has been created, otherwise <lang>)

and using Template:Uselang:

"{{uselang}}" → "en" [15] (gives the code of the user language if the MediaWiki page has been created, otherwise en)

Thus, while internationalization of month names can be done directly:

"{{int:January}}" → "January" [16]

we can now adapt the format to the language, e.g.

17{{#switch:{{int:lang}}|de=.}} {{int:January}} 2010 gives 17 January 2010.

or more generally, apply Template:Date, where the default language is the user language, determined inside the template.

If a separate page is used for every language version, this is commonly done with the naming scheme pagename/xx for the language with code xx (just like in the MediaWiki namespace). The templates in Category:Autotranslated templates use Template:Autotranslate, which is based on this naming scheme, and selects the local version of a template. It checks existence and applies a fall-back scheme (see also commons:Template:Fallback). If the tasks of the language versions have much in common, such as computations, or formatting unrelated to language, then it is practical to let them call a common auxiliary template, with language specific data as parameters, such as texts, see e.g. Template:Unblock granted/layout, commons:Template:Creator/layout, commons:Template:Museum/layout, and commons:Template:TemplateBox/layout.

See also[edit]

Links to other help pages

Help contents
Meta · Wikinews · Wikipedia · Wikiquote · Wiktionary · Commons: · Wikidata · MediaWiki · Wikibooks · Wikisource · MediaWiki: Manual · Google
Versions of this help page (for other languages see further)
What links here on Meta or from Meta · Wikipedia · MediaWiki
Go · Search · Stop words · Namespace · Page name · Section · Backlinks · Redirect · Category · Image page · Special pages · Printable version
Tracking changes
Recent changes (enhanced) | Related changes · Watching pages · Diff · Page history · Edit summary · User contributions · Minor edit · Patrolled edit
Logging in and preferences
Logging in · Preferences · User style
Starting a new page · Advanced editing · Editing FAQ · Edit toolbar · Export · Import · Shortcuts · Edit conflict · Page size
Links · URL · Piped links · Interwiki linking · Footnotes
Style and formatting
Wikitext examples · CSS · Reference card · HTML in wikitext · Formula · List · Table · Sorting · Colors · Images and file uploads
Fixing mistakes
Show preview · Testing · Reverting edits
Advanced functioning
Expansion · Template · Advanced templates · Parser function · Parameter default · Variable · System message · Substitution · Array · Calculation · Transclusion
Special characters · Renaming (moving) a page · Preparing a page for translation · Talk page · Signatures · Sandbox · Legal issues for editors