Manual:Hooks/MessageCache::get

From Linux Web Expert

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

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:MessageCache::get extensions</tvar>.</translate>


Details

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