Jump to content

Manual:Hooks/MessagesPreLoad

From mediawiki.org
MessagesPreLoad
Available from version 1.5.7 (r12999, codereview)
When loading a message from the database
Define function:
public static function onMessagesPreLoad( $title, &$message, $code ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"MessagesPreLoad": "MediaWiki\\Extension\\MyExtension\\Hooks::onMessagesPreLoad"
	}
}
Called from: File(s): language/MessageCache.php
Interface: MessagesPreLoadHook.php

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

Details

[edit]
  • $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 also

[edit]