Jump to content

Manual:Hooks/GetLangPreferredVariant

From mediawiki.org
GetLangPreferredVariant
Available from version 1.31.0 (Gerrit change 367326)
allows fetching the language variant code from cookies or other such alternative storage.
Define function:
public static function onGetLangPreferredVariant( &$req ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"GetLangPreferredVariant": "MediaWiki\\Extension\\MyExtension\\Hooks::onGetLangPreferredVariant"
	}
}
Called from: File(s): ../languages/LanguageConverter.php
Function(s): getPreferredVariant
Interface: GetLangPreferredVariantHook.php

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


Details

[edit]
  • &$req: language variant from the URL (string) or boolean false if no variant was specified in the URL; the value of this variable comes from LanguageConverter::getURLVariant