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)
 
 onRevisionRecordInserted ( $revisionRecord)
 @inheritDoc
 
 onListDefinedTags (&$tags)
 @inheritDoc
 
 onChangeTagsListActive (&$tags)
 @inheritDoc
 

Static Public Member Functions

static setupTranslate ()
 Do late setup that depends on configuration.
 
static onUserGetReservedNames (array &$names)
 Hook: UserGetReservedNames Prevents anyone from registering or logging in as FuzzyBot.
 
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 schemaUpdates (DatabaseUpdater $updater)
 Hook: LoadExtensionSchemaUpdates.
 
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 setupTranslateParserFunction (Parser $parser)
 Hook: ParserFirstCallInit.
 
static translateRenderParserFunction (Parser $parser)
 
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 75 of file HookHandler.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 88 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 785 of file HookHandler.php.

◆ onAbortEmailNotificationReview()

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

Hook: AbortEmailNotification.

Definition at line 859 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 441 of file HookHandler.php.

◆ onAbuseFilterBuilder()

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

Register AbuseFilter variables provided by Translate.

Definition at line 490 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 463 of file HookHandler.php.

◆ onAdminLinks()

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

Hook: AdminLinks.

Definition at line 807 of file HookHandler.php.

◆ onChangeTagsListActive()

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

@inheritDoc

Definition at line 1026 of file HookHandler.php.

◆ onDeleteAccount()

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

Hook: DeleteAccount For UserMerge extension.

Definition at line 843 of file HookHandler.php.

◆ onListDefinedTags()

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

@inheritDoc

Definition at line 1021 of file HookHandler.php.

◆ onMergeAccountFromTo()

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

Hook: MergeAccountFromTo For UserMerge extension.

Definition at line 821 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 613 of file HookHandler.php.

◆ onRevisionRecordInserted()

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

@inheritDoc

Definition at line 984 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 875 of file HookHandler.php.

◆ onUserGetReservedNames()

static MediaWiki\Extension\Translate\HookHandler::onUserGetReservedNames ( array & $names)
static

Hook: UserGetReservedNames Prevents anyone from registering or logging in as FuzzyBot.

Definition at line 435 of file HookHandler.php.

◆ preventCategorization()

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

Hook: ParserAfterTidy.

Definition at line 746 of file HookHandler.php.

◆ schemaUpdates()

static MediaWiki\Extension\Translate\HookHandler::schemaUpdates ( DatabaseUpdater $updater)
static

Hook: LoadExtensionSchemaUpdates.

Definition at line 507 of file HookHandler.php.

◆ searchProfile()

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

Hook: SpecialSearchProfiles.

Definition at line 641 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 667 of file HookHandler.php.

◆ searchProfileSetupEngine()

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

Hook: SpecialSearchSetupEngine.

Definition at line 728 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 501 of file HookHandler.php.

◆ setupTranslate()

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

Do late setup that depends on configuration.

Definition at line 99 of file HookHandler.php.

◆ setupTranslateParserFunction()

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

Hook: ParserFirstCallInit.

Definition at line 897 of file HookHandler.php.

◆ showFakeCategories()

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

Hook: OutputPageParserOutput.

Definition at line 773 of file HookHandler.php.

◆ translateMessageDocumentationLanguage()

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

Hook: LanguageGetTranslatedLanguageNames Hook: TranslateSupportedLanguages.

Definition at line 624 of file HookHandler.php.

◆ translateRenderParserFunction()

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

Definition at line 901 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 920 of file HookHandler.php.


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