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. | |
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. | |
onTranslate_GettextFormat_headerFields (array &$headers, MessageGroup $group, string $languageCode) | |
Allows per group customization of headers in exported Gettext files per group. | |
Hook runner for the Translate extension.
This is a hook runner class, see docs/Hooks.md in core.
Definition at line 37 of file HookRunner.php.
MediaWiki\Extension\Translate\HookRunner::__construct | ( | HookContainer | $hookContainer | ) |
Definition at line 55 of file HookRunner.php.
MediaWiki\Extension\Translate\HookRunner::onTranslate_GettextFormat_headerFields | ( | array & | $headers, |
MessageGroup | $group, | ||
string | $languageCode ) |
Allows per group customization of headers in exported Gettext files per group.
Certain X-headers and Plural-Forms cannot be customized.
array<string,string> | &$headers List of prefilled headers. You can remove, change or add new headers. | |
MessageGroup | $group | |
string | $languageCode |
Implements MediaWiki\Extension\Translate\FileFormatSupport\GettextFormatHeaderFieldsHook.
Definition at line 122 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 83 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 79 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 59 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 67 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 87 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 118 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 71 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 75 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 97 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 101 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 63 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 105 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 114 of file HookRunner.php.