Manual:Hooks/NormalizeMessageKey

From MediaWiki.org
Jump to navigation Jump to search
NormalizeMessageKey
Available from version 1.13.0
Removed in version 1.27.0
Allows extensions to change what system message will be displayed on a page
Define function:
public static function onNormalizeMessageKey( &$key, &$useDB, &$langCode, &$transform ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"NormalizeMessageKey": "MyExtensionHooks::onNormalizeMessageKey"
	}
}

For MediaWiki ≤1.25:

$wgHooks['NormalizeMessageKey'][] = 'MyExtensionHooks::onNormalizeMessageKey';
Called from:File(s): GlobalFunctions.php

For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:NormalizeMessageKey extensions.

Details[edit]

  • &$key: (string) The message going to be displayed. Change this to display a different message in its place
  • &$useDB: (bool) Whether to query the database to get the message
  • &$langCode: (string or bool) If a string, the language code that should be used to get the message, if bool true, uses the content language, if bool false, uses the site's default language
  • &$transform: (bool) Whether to expand templates and variables in the message