summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Translate/hooks.txt
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/Translate/hooks.txt')
-rw-r--r--www/wiki/extensions/Translate/hooks.txt52
1 files changed, 11 insertions, 41 deletions
diff --git a/www/wiki/extensions/Translate/hooks.txt b/www/wiki/extensions/Translate/hooks.txt
index 7a101ca2..e144adb8 100644
--- a/www/wiki/extensions/Translate/hooks.txt
+++ b/www/wiki/extensions/Translate/hooks.txt
@@ -20,19 +20,10 @@ For a guide to PHP hooks, navigate to your root MediaWiki
directory, and then find docs/hooks.txt.
=== JavaScript hooks ===
-JavaScript hooks for the Translate extension are a little different. To use
-them, declare a dependency on ext.translate.hooks:
+JavaScript hooks for the Translate extension use the standard mw.hook API provided
+by MediaWiki.
- $wgResourceModules['...'] = array(
- 'scripts' => '...js',
- 'dependencies' => array( 'ext.translate.hooks' ),
- );
-
-And then in that module use:
- mw.translateHooks.add( name, hookFunction );
-
-where name is a string, but hookFunction is not (unlike in the case of PHP hooks)
-but rather a function reference. Return values from JavaScript hooks are ignored.
+Hooks are prefixed with mw.translate as a convention.
== Events and parameters ==
@@ -46,12 +37,6 @@ Post processing step to format in wiki
=== PHP events ===
-;SpecialTranslate::executeTask: You can output the default task output
- RequestContext $context: For adding output, accessing current interface language etc.
- TranslateTask $task = null: Current task if any
- MessageGroup $group
- array $options: Active options
-
;Translate:MessageGroupStats:isIncluded: Controls whether message group is shown for a given language in language or message group statistics. Mostly used internally by Translate to hide discouraged groups and groups restricted to certain languages.
string $groupId: Message group id
string $code: Language code
@@ -73,13 +58,6 @@ Post processing step to format in wiki
;TranslateEventTranslationReview: Event triggered when a translation is proofread
MessageHandle $handle
-;TranslateFormatMessageBeforeTable: Provides an opportunity to manipulate the display of translation strings (messages) in the main table
- string &$message: The message that will be displayed
- TMessage $m: Object representing the source object, useful for $m->original() and $m->translation()
- MessageGroup $group: The source message group
- string $targetLanguage: The language for which translations are being shown
- array &$extraAttribs: An array of attributes that will be added to the table row
-
;TranslateGetBoxes: Provides an opportunity to add or remove "boxes" (translation helpers) from the translation interface
MessageGroup $group: The message group being worked on
MessageHandle $handle: An object representing the translation page (e.g. 'MediaWiki:Example/qqq')
@@ -91,10 +69,6 @@ Post processing step to format in wiki
;TranslateGetAPIMessageGroupsPropertyDescs: 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).
-;TranslateGetExtraInputs: Provides an opportunity to add extra form inputs to to the default translation editor
- string &$translation: The translation as it stands
- string &$extraInputs: The extra input space, ready for HTML to be appended
-
;TranslateGetSpecialTranslateOptions: Provides an opportunity for overriding task values
array &$defaults: Associative array of default values
array &$nondefaults: Associative array of nondefault (override) values
@@ -108,12 +82,6 @@ Post processing step to format in wiki
MessageGroup $group
array &$variables: Variable name => replacement
-;TranslateMessageTableInit: When creating new MessageTable
- MessageTable &$table: Default implementation that can be accessed or even replaced
- IContextSource $context:
- MessageCollection $collection
- MessageGroup $group
-
;Translate:newTranslation: Event triggered when non-fuzzy translation has been made
MessageHandle $handle
int $revisionId
@@ -142,22 +110,24 @@ Post processing step to format in wiki
;TranslateTranslationAids: Make new translation aids available to any message group (which must choose an implementation in its getTranslationAids() method).
array &$types: List of translation aid identifiers, numerically indexed
-;AddNewAccount: Replica of the core hook, see https://www.mediawiki.org/wiki/Manual:Hooks/AddNewAccount
+;Translate:modifyMessageGroupStates: 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.
=== JavaScript events ===
-;afterSubmit: Provides an opportunity to modify a Translate translation form immediately after it is submitted
+;mw.translate.editor.afterSubmit: Provides an opportunity to modify a Translate translation form immediately after it is submitted
jQuery form: The form that has just been submitted
-;afterEditorShown: Provides an opportunity to manipulate the editing interface once it's shown
+;mw.translate.editor.afterEditorShown: Provides an opportunity to manipulate the editing interface once it's shown
jQuery translateEditor.$editor: The current translation-editing form
-;beforeSubmit: Provides an opportunity to modify a Translate translation form immediately before it is submitted
+;mw.translate.editor.beforeSubmit: Provides an opportunity to modify a Translate translation form immediately before it is submitted
jQuery form: The form being submitted
-;formatMessageBeforeTable: Provides an opportunity to manipulate the display of translation strings (messages) in the main table
+;mw.translate.messagetable.formatMessageBeforeTable: Provides an opportunity to manipulate the display of translation strings (messages) in the main table
object message: The message object, with a range of useful (and manipulable) properties
-;showTranslationHelpers: Provides an opportunity to handle custom translation helpers
+;mw.translate.editor.showTranslationHelpers: Provides an opportunity to handle custom translation helpers
object result.helpers: JSON subset focusing on the helpers returned e.g. result.helpers.definition
jQuery translateEditor.$editor: The current translation-editing form