Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
TranslateHooks Class Reference

Hooks for Translate extension. More...

Inheritance diagram for TranslateHooks:

Public Member Functions

 __construct (RevisionLookup $revisionLookup, ILoadBalancer $loadBalancer)
 
 onRevisionRecordInserted ( $revisionRecord)
 @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 (&$vars, Title $title, User $user)
 Used for setting an AbuseFilter variable.
 
static onAbuseFilterComputeVariable ( $method, $vars, $parameters, &$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 parserTestTables (array &$tables)
 Hook: ParserTestTables.
 
static onPageContentLanguage (Title $title, &$pageLang)
 Hook: PageContentLanguage Set the correct page content language for translation units.
 
static translateMessageDocumentationLanguage (array &$names, $code)
 Hook: LanguageGetTranslatedLanguageNames Hook: TranslateSupportedLanguages.
 
static searchProfile (array &$profiles)
 Hook: SpecialSearchProfiles.
 
static searchProfileForm (SpecialSearch $search, &$form, $profile, $term, array $opts)
 Hook: SpecialSearchProfileForm.
 
static searchProfileSetupEngine (SpecialSearch $search, $profile, SearchEngine $engine)
 Hook: SpecialSearchSetupEngine.
 
static preventCategorization (Parser $parser, &$html)
 Hook: ParserAfterTidy.
 
static showFakeCategories (OutputPage $outputPage, ParserOutput $parserOutput)
 Hook: OutputPageParserOutput.
 
static addConfig (array &$vars, OutputPage $out)
 Hook: MakeGlobalVariablesScript.
 
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 (Title $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, $summary, User $user)
 Runs the configured validator to ensure that the message meets the required criteria.
 

Detailed Description

Hooks for Translate extension.

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.

Definition at line 42 of file TranslateHooks.php.

Constructor & Destructor Documentation

◆ __construct()

TranslateHooks::__construct ( RevisionLookup $revisionLookup,
ILoadBalancer $loadBalancer )

Definition at line 58 of file TranslateHooks.php.

Member Function Documentation

◆ addConfig()

static TranslateHooks::addConfig ( array & $vars,
OutputPage $out )
static

Hook: MakeGlobalVariablesScript.

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

Parameters
array&$vars
OutputPage$out

Definition at line 758 of file TranslateHooks.php.

◆ onAbortEmailNotificationReview()

static TranslateHooks::onAbortEmailNotificationReview ( User $editor,
Title $title,
RecentChange $rc )
static

Hook: AbortEmailNotification.

False aborts the email.

Parameters
User$editor
Title$title
RecentChange$rc
Returns
bool

Definition at line 850 of file TranslateHooks.php.

◆ onAbuseFilterAlterVariables()

static TranslateHooks::onAbuseFilterAlterVariables ( & $vars,
Title $title,
User $user )
static

Used for setting an AbuseFilter variable.

Parameters
VariableHolder&$vars
Title$title
User$user

Definition at line 380 of file TranslateHooks.php.

◆ onAbuseFilterBuilder()

static TranslateHooks::onAbuseFilterBuilder ( array & $builderValues)
static

Register AbuseFilter variables provided by Translate.

Parameters
array&$builderValues

Definition at line 434 of file TranslateHooks.php.

◆ onAbuseFilterComputeVariable()

static TranslateHooks::onAbuseFilterComputeVariable ( $method,
$vars,
$parameters,
& $result )
static

Computes the translate_source_text and translate_target_language AbuseFilter variables.

Parameters
string$method
VariableHolder$vars
array$parameters
null&$result
Returns
bool

Definition at line 409 of file TranslateHooks.php.

◆ onAdminLinks()

static TranslateHooks::onAdminLinks ( ALTree $tree)
static

Hook: AdminLinks.

Parameters
ALTree$tree

Definition at line 785 of file TranslateHooks.php.

◆ onDeleteAccount()

static TranslateHooks::onDeleteAccount ( User $oldUser)
static

Hook: DeleteAccount For UserMerge extension.

Parameters
User$oldUser

Definition at line 826 of file TranslateHooks.php.

◆ onMergeAccountFromTo()

static TranslateHooks::onMergeAccountFromTo ( User $oldUser,
User $newUser )
static

Hook: MergeAccountFromTo For UserMerge extension.

Parameters
User$oldUser
User$newUser

Definition at line 802 of file TranslateHooks.php.

◆ onPageContentLanguage()

static TranslateHooks::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 569 of file TranslateHooks.php.

◆ onRevisionRecordInserted()

TranslateHooks::onRevisionRecordInserted ( $revisionRecord)

@inheritDoc

Definition at line 987 of file TranslateHooks.php.

◆ onTitleIsAlwaysKnown()

static TranslateHooks::onTitleIsAlwaysKnown ( Title $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$target
bool&$isKnown
Returns
bool

Definition at line 869 of file TranslateHooks.php.

◆ onUserGetReservedNames()

static TranslateHooks::onUserGetReservedNames ( array & $names)
static

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

Parameters
array&$names

Definition at line 368 of file TranslateHooks.php.

◆ parserTestTables()

static TranslateHooks::parserTestTables ( array & $tables)
static

Hook: ParserTestTables.

Parameters
array&$tables

Definition at line 555 of file TranslateHooks.php.

◆ preventCategorization()

static TranslateHooks::preventCategorization ( Parser $parser,
& $html )
static

Hook: ParserAfterTidy.

Parameters
Parser$parser
string&$html

Definition at line 724 of file TranslateHooks.php.

◆ schemaUpdates()

static TranslateHooks::schemaUpdates ( DatabaseUpdater $updater)
static

Hook: LoadExtensionSchemaUpdates.

Parameters
DatabaseUpdater$updater

Definition at line 457 of file TranslateHooks.php.

◆ searchProfile()

static TranslateHooks::searchProfile ( array & $profiles)
static

Hook: SpecialSearchProfiles.

Parameters
array&$profiles

Definition at line 602 of file TranslateHooks.php.

◆ searchProfileForm()

static TranslateHooks::searchProfileForm ( SpecialSearch $search,
& $form,
$profile,
$term,
array $opts )
static

Hook: SpecialSearchProfileForm.

Parameters
SpecialSearch$search
string&$form
string$profile
string$term
array$opts
Returns
bool

Definition at line 636 of file TranslateHooks.php.

◆ searchProfileSetupEngine()

static TranslateHooks::searchProfileSetupEngine ( SpecialSearch $search,
$profile,
SearchEngine $engine )
static

Hook: SpecialSearchSetupEngine.

Parameters
SpecialSearch$search
string$profile
SearchEngine$engine

Definition at line 702 of file TranslateHooks.php.

◆ setupParserHooks()

static TranslateHooks::setupParserHooks ( Parser $parser)
static

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

Parameters
Parser$parser

Definition at line 447 of file TranslateHooks.php.

◆ setupTranslate()

static TranslateHooks::setupTranslate ( )
static

Do late setup that depends on configuration.

Definition at line 66 of file TranslateHooks.php.

◆ setupTranslateParserFunction()

static TranslateHooks::setupTranslateParserFunction ( Parser $parser)
static

Hook: ParserFirstCallInit.

Parameters
Parser$parser

Definition at line 898 of file TranslateHooks.php.

◆ showFakeCategories()

static TranslateHooks::showFakeCategories ( OutputPage $outputPage,
ParserOutput $parserOutput )
static

Hook: OutputPageParserOutput.

Parameters
OutputPage$outputPage
ParserOutput$parserOutput

Definition at line 743 of file TranslateHooks.php.

◆ translateMessageDocumentationLanguage()

static TranslateHooks::translateMessageDocumentationLanguage ( array & $names,
$code )
static

Hook: LanguageGetTranslatedLanguageNames Hook: TranslateSupportedLanguages.

Parameters
array&$names
string$code

Definition at line 582 of file TranslateHooks.php.

◆ translateRenderParserFunction()

static TranslateHooks::translateRenderParserFunction ( Parser $parser)
static
Parameters
Parser$parser
Returns
string

Definition at line 906 of file TranslateHooks.php.

◆ validateMessage()

static TranslateHooks::validateMessage ( IContextSource $context,
Content $content,
Status $status,
$summary,
User $user )
static

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

Hook: EditFilterMergedContent

Parameters
IContextSource$context
Content$content
Status$status
string$summary
User$user
Returns
bool true if message is valid, false otherwise.

Definition at line 927 of file TranslateHooks.php.


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