Help:System message



A system message is a snippet of plain text (nowiki), wikitext, CSS, or JavaScript that can be used to customize the behavior of MediaWiki and its appearance for each language and locale. MediaWiki uses messages for any user-facing part of the interface, allowing for internationalization and localization of the MediaWiki UI, for both core and extensions. All messages used in MediaWiki are defined in a messages file.

Overriding messages on-wiki
Messages can be overridden from their default values by editing them on-wiki. Each message has a wiki page in the MediaWiki namespace with its message key as the name of the page. For example, the "aboutsite" message is stored at MediaWiki:aboutsite. By default this namespace is restricted from editing unless the user has the "editinterface" permission. A list of all message pages can be found on Special:AllMessages. Editing interface messages is typically straightforward, just like editing a normal wiki page, but it is restricted to users with the editinterface permission, which is assigned to administrators (and interface administrators) by default. The Special:AllMessages table contains two columns: the linked interface name, and the text. The text is horizontally split to show the default text above, and the customized text below. When a custom message does not exist, only the default will be shown. To customize a message, click the upper link in the left column (the name of the message). This link is red if the default text is in use, because the edit page is empty.

The lower links in the left column cells lead to the discussion pages for that message.

Finding messages and documentation
How each message is used by MediaWiki, variables available, parameters used, limitations, et cetera is explained with the [//translatewiki.net/w/i.php?title=Special:Translate&task=reviewall&group=core&language=qqq&limit=5000&action=page&filter= complete documentation in the qqq pseudo-language] files, as per localization>Special:MyLanguage/Localisation#Message_documentation|message documentation guidelines. Some longer explanation pages may exist for some interface messages at the older .

In MediaWiki 1.18 and above, you can find a message key by browsing a wiki in the special pseudo-language code  , which can be done by appending   to the URL, or   if the URL already contains a  character ([ example]). All the messages will then be replaced by their message keys, so you can identify which message is responsible. Messages that are always in the content language will not be shown using qqx.

Some parts of the interface add   to the string that is shown when you use the qqx trick. For example the label for the tab that links to the discussion page in the main namespace is shown as  , but the string is actually located at MediaWiki:Talk</>.

In case the page uses tabs like e.g. prefs>Special:Preferences#mw-prefsection-rendering</>|special page "Preferences" you will have to add the tab after the  parameter, e.g. <tvar|qqxparam3> </>.

Using messages
MediaWiki uses a central repository of messages which are referenced by keys in the code. This is different from, for example,, which just extracts the translatable strings from the source files. The key-based system makes some things easier, like refining the original texts and tracking changes to messages. The drawback is of course that the list of used messages and the list of source texts for those keys can get out of sync. In practice this isn't a big problem, and the only significant problem is that sometimes extra messages that are not used anymore still stay up for translation.

To make message keys more manageable and easy to find, also with grep, always write them completely and don't rely too much on creating them dynamically. You may concatenate parts of message keys if you feel that it gives your code better structure, but put a comment nearby with a list of the possible resulting keys. For example:

PHP

JS

To use a message in JavaScript, you have to list it in the definition of your ResourceLoader module, in the  property.

The detailed use of message functions in PHP and JavaScript is on. ''' This is an important documentation page, and you should read it before you write code that uses messages. '''

Adding new messages
See also:

Choosing the message key
See also:

The message key must be globally unique. This includes core MediaWiki and all the extensions and skins.

Stick to lower case letters, numbers, and dashes in message names; most other characters are between less practical or not working at all. Per MediaWiki convention, first character is case-insensitive and other chars are case-sensitive.

Please follow global or local conventions for naming. For extensions, use a standard prefix, preferably the extension name in lower case, followed by a hyphen ("-"). Exceptions are:


 * Messages used by the API. These must begin with ,  ,  .  After this prefix put the extension prefix. ( Note that these messages should be in a separate file, usually under includes/i18/api. )
 * Log-related messages. These must begin with ,  ,.
 * User rights. The key for the name of the right as displayed on Special:ListGroupRights must begin with  .  The name of the action that completes the sentence "" must begin with.
 * Revisions tags must begin with.
 * Special page titles must begin with.

Other things to note when creating messages

 * 1) Make sure that you are using suitable handling for the message (parsing,  -replacement, escaping for HTML, etc.)
 * 1) If your message is part of core, it should usually be added to , although some components, such as Installer , EXIF tags, and ApiHelp have their own message files.
 * 1) If your message is in an extension add it to the   file or the   file in the appropriate subdirectory.  In particular, API messages that are only seen by developers and not by most end users are usually in a separate file, such as  .  If an extensions has a lot of messages, you may create subdirectories under  .  All the message directories, including the default  <, must be listed in the   section in   or in the variable.
 * 1) Take a pause and consider the wording of the message.  Is it as clear as possible?  Can it be misunderstood? Ask for comments from other developers or localisers if possible.  Follow the #internationalisation hints.
 * 1) Add documentation to  in the same directory.