Manual:Hooks/MessageCache::get

From MediaWiki.org
Jump to navigation Jump to search
MessageCache::get
Available from version 1.23.0
Allows changing a message key, to customize it before the translation is accessed
Define function:
public static function onMessageCache_get( &$lckey ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"MessageCache::get": "MyExtensionHooks::onMessageCacheget"
	}
}

For MediaWiki ≤1.25:

$wgHooks['MessageCache::get'][] = 'MyExtensionHooks::onMessageCacheget';
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:MessageCache::get extensions.

Details[edit]

Both the input and output keys must have an initial lowercase character. No spaces can be used in the keys; any spaces must be converted to underscores.

  • &$lckey - Message key to check and optionally customize

See also[edit]