Open main menu

Manual:Hooks/MessagesPreLoad

MessagesPreLoad
Available from version 1.5.7 (r12999)
When loading a message from the database
Define function:
public static function onMessagesPreLoad( $title, &$message, $code ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"MessagesPreLoad": "MyExtensionHooks::onMessagesPreLoad"
	}
}

For MediaWiki ≤1.25:

$wgHooks['MessagesPreLoad'][] = 'MyExtensionHooks::onMessagesPreLoad';
Called from:File(s): cache/MessageCache.php

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

DetailsEdit

  • $title: title of the message (string)
  • $message: value (string), change it to the message you want to define
  • $code: language code being requested (string)

This hook is sometimes used to programatically provide the text of a message. Note though that that will not work when the message's useDatabase flag has been disabled.

See alsoEdit