Jump to content


From mediawiki.org
Available from version 1.23.0 (Gerrit change 98078)
Allows changing a message key, to customize it before the translation is accessed
Define function:
public static function onMessageCache_get( string &$lckey ) { ... }
Attach hook: In extension.json:
	"Hooks": {
		"MessageCache::get": "MediaWiki\\Extension\\MyExtension\\Hooks::onMessageCacheget"
Called from: File(s): includes/language/MessageCache.php
Interface: MessageCache__getHook.php

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


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]