Manual:Hooks/NormalizeMessageKey
From Linux Web Expert
File:OOjs UI icon alert-destructive.svg | <translate> This feature was removed completely in version <tvar name=ver>1.27.0</tvar>.</translate> |
NormalizeMessageKey | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate> <translate> Removed in <tvar name=1><translate> version <tvar </tvar></translate> Allows extensions to change what system message will be displayed on a page | |
<translate> Define function:</translate> | public static function onNormalizeMessageKey( &$key, &$useDB, &$langCode, &$transform ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"NormalizeMessageKey": "MediaWiki\\Extension\\MyExtension\\Hooks::onNormalizeMessageKey"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> GlobalFunctions.php |
<translate> Interface:</translate> | NormalizeMessageKeyHook.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:NormalizeMessageKey extensions</tvar>.</translate>
Details
- &$key: (string) The message going to be displayed. Change this to display a different message in its place
- &$useDB: (bool) Whether to query the database to get the message
- &$langCode: (string or bool) If a string, the language code that should be used to get the message, if bool true, uses the content language, if bool false, uses the site's default language
- &$transform: (bool) Whether to expand templates and variables in the message
See also
- MessageCache::get hook
- MessagesPreLoad hook