Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
MediaWiki\Extension\Translate\HookHandler Class Reference

Hooks for Translate extension. More...

Inheritance diagram for MediaWiki\Extension\Translate\HookHandler:

Public Member Functions

 __construct (RevisionLookup $revisionLookup, ILoadBalancer $loadBalancer, Config $config, LanguageNameUtils $languageNameUtils)
 
 onUserGetReservedNames (&$reservedUsernames)
 Prevents anyone from registering or logging in as FuzzyBot @inheritDoc.
 
 onParserFirstCallInit ( $parser)
 
 translateRenderParserFunction (Parser $parser)
 
 onRevisionRecordInserted ( $revisionRecord)
 @inheritDoc
 
 onListDefinedTags (&$tags)
 @inheritDoc
 
 onChangeTagsListActive (&$tags)
 @inheritDoc
 

Static Public Member Functions

static setupTranslate ()
 Do late setup that depends on configuration.
 
static onAbuseFilterAlterVariables (VariableHolder &$vars, Title $title, User $user)
 Used for setting an AbuseFilter variable.
 
static onAbuseFilterComputeVariable (string $method, VariableHolder $vars, array $parameters, ?string &$result)
 Computes the translate_source_text and translate_target_language AbuseFilter variables.
 
static onAbuseFilterBuilder (array &$builderValues)
 Register AbuseFilter variables provided by Translate.
 
static setupParserHooks (Parser $parser)
 Hook: ParserFirstCallInit Registers <languages> tag with the parser.
 
static onPageContentLanguage (Title $title, &$pageLang)
 Hook: PageContentLanguage Set the correct page content language for translation units.
 
static translateMessageDocumentationLanguage (array &$names, ?string $code)
 Hook: LanguageGetTranslatedLanguageNames Hook: TranslateSupportedLanguages.
 
static searchProfile (array &$profiles)
 Hook: SpecialSearchProfiles.
 
static searchProfileForm (SpecialSearch $search, string &$form, string $profile, string $term, array $opts)
 Hook: SpecialSearchProfileForm.
 
static searchProfileSetupEngine (SpecialSearch $search, string $profile, SearchEngine $engine)
 Hook: SpecialSearchSetupEngine.
 
static preventCategorization (Parser $parser, string &$html)
 Hook: ParserAfterTidy.
 
static showFakeCategories (OutputPage $outputPage, ParserOutput $parserOutput)
 Hook: OutputPageParserOutput.
 
static addConfig (array &$vars, OutputPage $out)
 Hook: MakeGlobalVariablesScript Adds $wgTranslateDocumentationLanguageCode to ResourceLoader configuration when Special:Translate is shown.
 
static onAdminLinks (ALTree $tree)
 Hook: AdminLinks.
 
static onMergeAccountFromTo (User $oldUser, User $newUser)
 Hook: MergeAccountFromTo For UserMerge extension.
 
static onDeleteAccount (User $oldUser)
 Hook: DeleteAccount For UserMerge extension.
 
static onAbortEmailNotificationReview (User $editor, Title $title, RecentChange $rc)
 Hook: AbortEmailNotification.
 
static onTitleIsAlwaysKnown ( $target, &$isKnown)
 Hook: TitleIsAlwaysKnown Make Special:MyLanguage links red if the target page doesn't exist.
 
static validateMessage (IContextSource $context, Content $content, Status $status, string $summary, User $user)
 Runs the configured validator to ensure that the message meets the required criteria.
 

Detailed Description

Hooks for Translate extension.

Contains class with basic non-feature specific hooks. Main subsystems, like page translation, should have their own hook handler. * Most of the hooks on this class are still old style static functions, but new new hooks should use the new style hook handlers with interfaces.

Author
Niklas Laxström @license GPL-2.0-or-later

Definition at line 83 of file HookHandler.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Extension\Translate\HookHandler::__construct ( RevisionLookup $revisionLookup,
ILoadBalancer $loadBalancer,
Config $config,
LanguageNameUtils $languageNameUtils )

Definition at line 103 of file HookHandler.php.

Member Function Documentation

◆ addConfig()

static MediaWiki\Extension\Translate\HookHandler::addConfig ( array & $vars,
OutputPage $out )
static

Hook: MakeGlobalVariablesScript Adds $wgTranslateDocumentationLanguageCode to ResourceLoader configuration when Special:Translate is shown.

Definition at line 741 of file HookHandler.php.

◆ onAbortEmailNotificationReview()

static MediaWiki\Extension\Translate\HookHandler::onAbortEmailNotificationReview ( User $editor,
Title $title,
RecentChange $rc )
static

Hook: AbortEmailNotification.

Definition at line 815 of file HookHandler.php.

◆ onAbuseFilterAlterVariables()

static MediaWiki\Extension\Translate\HookHandler::onAbuseFilterAlterVariables ( VariableHolder & $vars,
Title $title,
User $user )
static

Used for setting an AbuseFilter variable.

Definition at line 501 of file HookHandler.php.

◆ onAbuseFilterBuilder()

static MediaWiki\Extension\Translate\HookHandler::onAbuseFilterBuilder ( array & $builderValues)
static

Register AbuseFilter variables provided by Translate.

Definition at line 550 of file HookHandler.php.

◆ onAbuseFilterComputeVariable()

static MediaWiki\Extension\Translate\HookHandler::onAbuseFilterComputeVariable ( string $method,
VariableHolder $vars,
array $parameters,
?string & $result )
static

Computes the translate_source_text and translate_target_language AbuseFilter variables.

Definition at line 523 of file HookHandler.php.

◆ onAdminLinks()

static MediaWiki\Extension\Translate\HookHandler::onAdminLinks ( ALTree $tree)
static

Hook: AdminLinks.

Definition at line 763 of file HookHandler.php.

◆ onChangeTagsListActive()

MediaWiki\Extension\Translate\HookHandler::onChangeTagsListActive ( & $tags)

@inheritDoc

Definition at line 984 of file HookHandler.php.

◆ onDeleteAccount()

static MediaWiki\Extension\Translate\HookHandler::onDeleteAccount ( User $oldUser)
static

Hook: DeleteAccount For UserMerge extension.

Definition at line 799 of file HookHandler.php.

◆ onListDefinedTags()

MediaWiki\Extension\Translate\HookHandler::onListDefinedTags ( & $tags)

@inheritDoc

Definition at line 979 of file HookHandler.php.

◆ onMergeAccountFromTo()

static MediaWiki\Extension\Translate\HookHandler::onMergeAccountFromTo ( User $oldUser,
User $newUser )
static

Hook: MergeAccountFromTo For UserMerge extension.

Definition at line 777 of file HookHandler.php.

◆ onPageContentLanguage()

static MediaWiki\Extension\Translate\HookHandler::onPageContentLanguage ( Title $title,
& $pageLang )
static

Hook: PageContentLanguage Set the correct page content language for translation units.

Parameters
Title$title
Language | StubUserLang | string&$pageLang

Definition at line 573 of file HookHandler.php.

◆ onParserFirstCallInit()

MediaWiki\Extension\Translate\HookHandler::onParserFirstCallInit ( $parser)

Definition at line 852 of file HookHandler.php.

◆ onRevisionRecordInserted()

MediaWiki\Extension\Translate\HookHandler::onRevisionRecordInserted ( $revisionRecord)

@inheritDoc

Definition at line 942 of file HookHandler.php.

◆ onTitleIsAlwaysKnown()

static MediaWiki\Extension\Translate\HookHandler::onTitleIsAlwaysKnown ( $target,
& $isKnown )
static

Hook: TitleIsAlwaysKnown Make Special:MyLanguage links red if the target page doesn't exist.

A bit hacky because the core code is not so flexible.

Parameters
Title$targetTitle object that is being checked
bool | null&$isKnownWhether MediaWiki currently thinks this page is known
Returns
bool True or no return value to continue or false to abort

Definition at line 831 of file HookHandler.php.

◆ onUserGetReservedNames()

MediaWiki\Extension\Translate\HookHandler::onUserGetReservedNames ( & $reservedUsernames)

Prevents anyone from registering or logging in as FuzzyBot @inheritDoc.

Definition at line 495 of file HookHandler.php.

◆ preventCategorization()

static MediaWiki\Extension\Translate\HookHandler::preventCategorization ( Parser $parser,
string & $html )
static

Hook: ParserAfterTidy.

Definition at line 705 of file HookHandler.php.

◆ searchProfile()

static MediaWiki\Extension\Translate\HookHandler::searchProfile ( array & $profiles)
static

Hook: SpecialSearchProfiles.

Definition at line 601 of file HookHandler.php.

◆ searchProfileForm()

static MediaWiki\Extension\Translate\HookHandler::searchProfileForm ( SpecialSearch $search,
string & $form,
string $profile,
string $term,
array $opts )
static

Hook: SpecialSearchProfileForm.

Definition at line 627 of file HookHandler.php.

◆ searchProfileSetupEngine()

static MediaWiki\Extension\Translate\HookHandler::searchProfileSetupEngine ( SpecialSearch $search,
string $profile,
SearchEngine $engine )
static

Hook: SpecialSearchSetupEngine.

Definition at line 687 of file HookHandler.php.

◆ setupParserHooks()

static MediaWiki\Extension\Translate\HookHandler::setupParserHooks ( Parser $parser)
static

Hook: ParserFirstCallInit Registers <languages> tag with the parser.

Definition at line 562 of file HookHandler.php.

◆ setupTranslate()

static MediaWiki\Extension\Translate\HookHandler::setupTranslate ( )
static

Do late setup that depends on configuration.

Definition at line 116 of file HookHandler.php.

◆ showFakeCategories()

static MediaWiki\Extension\Translate\HookHandler::showFakeCategories ( OutputPage $outputPage,
ParserOutput $parserOutput )
static

Hook: OutputPageParserOutput.

Definition at line 729 of file HookHandler.php.

◆ translateMessageDocumentationLanguage()

static MediaWiki\Extension\Translate\HookHandler::translateMessageDocumentationLanguage ( array & $names,
?string $code )
static

Hook: LanguageGetTranslatedLanguageNames Hook: TranslateSupportedLanguages.

Definition at line 584 of file HookHandler.php.

◆ translateRenderParserFunction()

MediaWiki\Extension\Translate\HookHandler::translateRenderParserFunction ( Parser $parser)

Definition at line 856 of file HookHandler.php.

◆ validateMessage()

static MediaWiki\Extension\Translate\HookHandler::validateMessage ( IContextSource $context,
Content $content,
Status $status,
string $summary,
User $user )
static

Runs the configured validator to ensure that the message meets the required criteria.

Hook: EditFilterMergedContent

Returns
bool true if message is valid, false otherwise.

Definition at line 878 of file HookHandler.php.


The documentation for this class was generated from the following file: