Open main menu

Manual:Hooks/LanguageGetTranslatedLanguageNames

< Manual:Hooks
LanguageGetTranslatedLanguageNames
Available from version 1.18.0 (r79359)
Provide translated language names.
Define function:
public static function onLanguageGetTranslatedLanguageNames( &$names, $code ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"LanguageGetTranslatedLanguageNames": "MyExtensionHooks::onLanguageGetTranslatedLanguageNames"
	}
}

For MediaWiki ≤1.25:

$wgHooks['LanguageGetTranslatedLanguageNames'][] = 'MyExtensionHooks::onLanguageGetTranslatedLanguageNames';
Called from:File(s): Language.php

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

DetailsEdit

  • &$names: array of language code => language name
  • $code: preferred language of the translations