Cannabis Ruderalis

Wikipedia uses system message pages to create the user interface as seen by readers. The user interface includes all visual elements of Wikipedia, such as the left sidebar, the top toolbar and error messages. These system pages are in located in the MediaWiki namespace, available for each supported language, customizable and can be edited only by administrators, and interface editors, and interface administrators. CSS and JS pages can only be edited by interface editors and interface administrators.

Technical[edit]

In principle for every language a set of c. 4,000 system messages in that language is provided in the message file languages/i18n/languagecode.json. In the preferences a logged-in user can select an interface language. For incidental use it can also be specified in the URL with the parameter uselang=language_code. As of June 2021, there are ca. 300 interface languages to choose from. For completeness of the language files see localization statistics on Translatewiki.net

Each MediaWiki site has a site language. This is the default interface language for that site. Some messages are always parsed using the site language (calling the inContentLanguage method), whereas others are parsed in the interface language (not calling that method).

Finding system messages[edit]

You can find a message key by browsing Wikipedia in the special pseudo-language code qqx, which can be done by appending ?uselang=qqxto the URL, or &uselang=qqx 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. Special:Preferences#mw-prefsection-gadgets has the option "Add a toolbox link to reload the current page with the system message names exposed". This gadget uses the same qqx you can add manually.

When the URL includes a fragment that links to a particular point on the page such as a section or a tab like e.g. special page "Preferences" you will have to add the fragment after the uselang parameter, e.g. Special:Preferences?uselang=qqx#mw-prefsection-rendering.

Message keys which depend on data sent by the user may not be shown when qqx is used. Allmessages from the API lists around 26,000 messages. They can be searched for a string with Ctrl+F in many browsers. Note that the underlying wikitext is often shown and not only the rendered text.

A list of all messages can be seen at Special:AllMessages.

MediaWiki namespace[edit]

The MediaWiki namespace is one of the 16 standard namespaces in the database structure of the MediaWiki software. For all languages this namespace allows administrators to create site-specific deviations from the default system messages. It is enabled by default. $wgUseDatabaseMessages = true; enables them. For each deviation from the default in the site language $wgLanguageCode there is a page MediaWiki:message_ID, and for each deviation from the default in each other language a page MediaWiki:message_ID/language_code. See e.g. MediaWiki:Aboutpage. 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 ID's 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. The edit page autofills with the default. Transclusion of a "non-existing" page in the MediaWiki namespace transcludes 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 the interface language set in the preferences, all default messages and current versions can be viewed at Special:Allmessages, with red links to create new deviations from the defaults. When creating a page to override the default it is useful to first save the default version, to allow diffs with it.

Protection[edit]

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 MediaWiki page, a method is to place the message on a template, and transclude the template onto the MediaWiki page.

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.

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

Transclusion of a system message, see e.g. template:Ed ( talk edit history links ), 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 this page, the system message with id "edit" that the site uses in the default interface interlanguage of the site.

Also, parser function int can be used:

{{int:Edit}} = Edit this page, the system message with id "edit" that the site uses in the user-specified interface interlanguage.

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
{{int:Erehwon}} = ⧼Erehwon⧽

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.

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 ( talk edit history links ) 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)

See also[edit]

Leave a Reply