Hook runner for the Translate extension. More...
Public Member Functions | |
__construct (HookContainer $hookContainer) | |
onTranslate_TranslatorSandbox_UserPromoted (UserIdentity $user) | |
Event generated when an account inside the translator sandbox is approved. | |
onTranslatePrefillTranslation (?string &$translation, MessageHandle $handle) | |
Provides an opportunity for a new translation to start not from as a carte blanche (the default) but from some prefilled string. | |
onTranslateBeforeAddModules (array &$modules) | |
Provides an opportunity to load extra modules. | |
onTranslateEventTranslationReview (MessageHandle $handle) | |
Event triggered when a translation is proofread. | |
onTranslateGetSpecialTranslateOptions (array &$defaults, array &$nonDefaults) | |
Provides an opportunity for overriding task values. | |
onTranslate_newTranslation (MessageHandle $handle, int $revisionId, string $text, User $user) | |
Event triggered when non-fuzzy translation has been made. | |
onTranslate_modifyMessageGroupStates (string $groupId, array &$conf) | |
Allow hooks to change workflow states depending on the group's ID. | |
onTranslateEventMessageGroupStateChange (MessageGroup $group, string $code, $oldState, string $newState) | |
Event triggered when a message group workflow state is changed in a language. | |
onTranslateGetAPIMessageGroupsParameterList (array &$params) | |
Allows extra parameters to be added to the action=query&meta=messagegroups module. | |
onTranslateGetAPIMessageGroupsPropertyDescs (array &$properties) | |
Allows extra properties to be added to captured by action=query&meta=messagegroups&mgprop=foo|bar|bat module. | |
onTranslateInitGroupLoaders (array &$groupLoader, array $deps) | |
Hook to register new message group loaders that can then load MessageGroups for translation purpose. | |
onTranslatePostInitGroups (array &$groups, array &$deps, array &$autoload) | |
Hook to register new message groups to Translate. | |
onTranslateProcessAPIMessageGroupsProperties (array &$a, array $props, array $params, MessageGroup $g) | |
Allows extra property requests to be acted upon, and the new properties returned. | |
onTranslateSupportedLanguages (array &$list, ?string $language) | |
Allows removing languages from language selectors. | |
onTranslateEventMessageMembershipChange (MessageHandle $handle, array $old, array $new) | |
When group gets new messages or loses messages. | |
Hook runner for the Translate extension.
This is a hook runner class, see docs/Hooks.md in core.
Definition at line 38 of file HookRunner.php.
MediaWiki\Extension\Translate\HookRunner::__construct | ( | HookContainer | $hookContainer | ) |
Definition at line 57 of file HookRunner.php.
MediaWiki\Extension\Translate\HookRunner::onTranslate_modifyMessageGroupStates | ( | string | $groupId, |
array & | $conf | ||
) |
Allow hooks to change workflow states depending on the group's ID.
string | $groupId | ID of the current message group |
array | &$conf | Workflow states, can be modified |
Implements MediaWiki\Extension\Translate\MessageGroupProcessing\ModifyMessageGroupStatesHook.
Definition at line 85 of file HookRunner.php.
MediaWiki\Extension\Translate\HookRunner::onTranslate_newTranslation | ( | MessageHandle | $handle, |
int | $revisionId, | ||
string | $text, | ||
User | $user | ||
) |
Event triggered when non-fuzzy translation has been made.
MessageHandle | $handle | |
int | $revisionId | |
string | $text | Content of the new translation |
User | $user | User who created or changed the translation |
Implements MediaWiki\Extension\Translate\TranslatorInterface\NewTranslationHook.
Definition at line 81 of file HookRunner.php.
MediaWiki\Extension\Translate\HookRunner::onTranslate_TranslatorSandbox_UserPromoted | ( | UserIdentity | $user | ) |
Event generated when an account inside the translator sandbox is approved.
Implements MediaWiki\Extension\Translate\TranslatorSandbox\UserPromotedHook.
Definition at line 61 of file HookRunner.php.
MediaWiki\Extension\Translate\HookRunner::onTranslateBeforeAddModules | ( | array & | $modules | ) |
Provides an opportunity to load extra modules.
string[] | &$modules | List of resource loader module names |
Implements MediaWiki\Extension\Translate\TranslatorInterface\BeforeAddModulesHook.
Definition at line 69 of file HookRunner.php.
MediaWiki\Extension\Translate\HookRunner::onTranslateEventMessageGroupStateChange | ( | MessageGroup | $group, |
string | $code, | ||
$oldState, | |||
string | $newState | ||
) |
Event triggered when a message group workflow state is changed in a language.
MessageGroup | $group | Message group instance |
string | $code | Language code |
string | false | $oldState | |
string | $newState |
Implements MediaWiki\Extension\Translate\MessageGroupProcessing\EventMessageGroupStateChangeHook.
Definition at line 89 of file HookRunner.php.
MediaWiki\Extension\Translate\HookRunner::onTranslateEventMessageMembershipChange | ( | MessageHandle | $handle, |
array | $old, | ||
array | $new | ||
) |
When group gets new messages or loses messages.
MessageHandle | $handle | |
string[] | $old | Previous groups |
string[] | $new | Current groups |
Implements MediaWiki\Extension\Translate\MessageGroupProcessing\EventMessageMembershipChangeHook.
Definition at line 128 of file HookRunner.php.
MediaWiki\Extension\Translate\HookRunner::onTranslateEventTranslationReview | ( | MessageHandle | $handle | ) |
Event triggered when a translation is proofread.
MessageHandle | $handle |
Implements MediaWiki\Extension\Translate\TranslatorInterface\EventTranslationReviewHook.
Definition at line 73 of file HookRunner.php.
MediaWiki\Extension\Translate\HookRunner::onTranslateGetAPIMessageGroupsParameterList | ( | array & | $params | ) |
Allows extra parameters to be added to the action=query&meta=messagegroups module.
array | &$params | An associative array of possible parameters (name => details; see ApiQueryMessageGroups.php for correct spacing) |
Implements MediaWiki\Extension\Translate\MessageGroupProcessing\GetAPIMessageGroupsParameterListHook.
Definition at line 99 of file HookRunner.php.
MediaWiki\Extension\Translate\HookRunner::onTranslateGetAPIMessageGroupsPropertyDescs | ( | array & | $properties | ) |
Allows extra properties to be added to captured by action=query&meta=messagegroups&mgprop=foo|bar|bat module.
array | &$properties | An associative array of properties, name => description (which is ignored) |
Implements MediaWiki\Extension\Translate\MessageGroupProcessing\GetAPIMessageGroupsPropertyDescsHook.
Definition at line 103 of file HookRunner.php.
MediaWiki\Extension\Translate\HookRunner::onTranslateGetSpecialTranslateOptions | ( | array & | $defaults, |
array & | $nonDefaults | ||
) |
Provides an opportunity for overriding task values.
array | &$defaults | Associative array of default values |
array | &$nonDefaults | Associative array of nondefault (override) values |
Implements MediaWiki\Extension\Translate\TranslatorInterface\GetSpecialTranslateOptionsHook.
Definition at line 77 of file HookRunner.php.
MediaWiki\Extension\Translate\HookRunner::onTranslateInitGroupLoaders | ( | array & | $groupLoader, |
array | $deps | ||
) |
Hook to register new message group loaders that can then load MessageGroups for translation purpose.
array | &$groupLoader | List of message group loader class names that implement the MessageGroupLoader |
array | $deps |
Implements MediaWiki\Extension\Translate\MessageGroupProcessing\InitGroupLoadersHook.
Definition at line 107 of file HookRunner.php.
MediaWiki\Extension\Translate\HookRunner::onTranslatePostInitGroups | ( | array & | $groups, |
array & | $deps, | ||
array & | $autoload | ||
) |
Hook to register new message groups to Translate.
Manual cache clear may be needed to have this hook executed.
MessageGroup[] | &$groups | Map of message group id to message group instance |
array | &$deps | List of dependencies as supported by DependencyWrapper class from MediaWiki |
string[] | &$autoload | List of autoloaded classes. Key is the name of the class and value is filename |
Implements MediaWiki\Extension\Translate\MessageGroupProcessing\PostInitGroupsHook.
Definition at line 111 of file HookRunner.php.
MediaWiki\Extension\Translate\HookRunner::onTranslatePrefillTranslation | ( | ?string & | $translation, |
MessageHandle | $handle | ||
) |
Provides an opportunity for a new translation to start not from as a carte blanche (the default) but from some prefilled string.
string | null | &$translation | The translation string as it stands, or null for new translations |
MessageHandle | $handle | The current MessageHandle object |
Implements MediaWiki\Extension\Translate\TranslatorInterface\Aid\PrefillTranslationHook.
Definition at line 65 of file HookRunner.php.
MediaWiki\Extension\Translate\HookRunner::onTranslateProcessAPIMessageGroupsProperties | ( | array & | $a, |
array | $props, | ||
array | $params, | ||
MessageGroup | $g | ||
) |
Allows extra property requests to be acted upon, and the new properties returned.
array | &$a | Associative array of the properties of $group that will be returned |
array | $props | Associative array ($name => true) of properties the user has specifically requested |
array | $params | Parameter input by the user (unprefixed name => value) |
MessageGroup | $g | The group in question |
Implements MediaWiki\Extension\Translate\MessageGroupProcessing\ProcessAPIMessageGroupsPropertiesHook.
Definition at line 115 of file HookRunner.php.
MediaWiki\Extension\Translate\HookRunner::onTranslateSupportedLanguages | ( | array & | $list, |
?string | $language | ||
) |
Allows removing languages from language selectors.
For adding $wgExtraLanguage names is recommended.
string[] | &$list | List of languages indexed by language code |
string | null | $language | Language code of the language of which language names are in |
Implements MediaWiki\Extension\Translate\Utilities\SupportedLanguagesHook.
Definition at line 124 of file HookRunner.php.