< Manual:Hooks
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": "MyExtensionHooks::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

  • &$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
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.