Amire80 has uploaded a new change for review. https://gerrit.wikimedia.org/r/182456
Change subject: Fix the Markdown syntax of hooks documentation ...................................................................... Fix the Markdown syntax of hooks documentation Change-Id: I1e30dc798cdd217de48076914201c82ba3f3492e --- M hooks.md 1 file changed, 43 insertions(+), 17 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/56/182456/1 diff --git a/hooks.md b/hooks.md index e2d2e84..3ba675c 100644 --- a/hooks.md +++ b/hooks.md @@ -3,18 +3,22 @@ See also https://www.mediawiki.org/wiki/Content_translation/Front_end . -We use the mw.hooks wrapper of jQuery.Callbacks for achieving a subscriber-publisher events pattern. The hook names are prefixed with mw.cx as a convention. +We use the mw.hooks wrapper of jQuery.Callbacks for achieving +a subscriber-publisher events pattern. + +The hook names are prefixed with mw.cx as a convention. # List of hooks ## mw.cx.success -Used for displaying a success message in the info bar. The message can be passed as the argument. +Used for displaying a success message in the info bar. +The message can be passed as the argument. ## mw.cx.error -Fired whenever an error occurs. The parameter is a string (message) that will be shown -in the info bar. +Fired whenever an error occurs. +The parameter is a string (message) that will be shown in the info bar. ## mw.cx.error.anonuser @@ -23,6 +27,9 @@ ## mw.cx.progress Fired when the translation progress is recalculated. + +Parameters: + * {object} progress Map of progress data * {integer} progress.any Weight of translation sections with any content * {integer} progress.human Weight of translation sections with human modified content @@ -34,31 +41,44 @@ ## mw.cx.search.link -This is fired when a link title is searched in tools search box. The search string is passed as an argument. Example subscribers are link and dictionary tools. +This is fired when a link title is searched in tools search box. +The search string is passed as an argument. Example subscribers are link and dictionary tools. ## mw.cx.search.word -This is fired when a word is searched in the tools search box. The search string is passed as an argument. Example subscribers are link and dictionary tools. +This is fired when a word is searched in the tools search box. +The search string is passed as an argument. Example subscribers are link and dictionary tools. ## mw.cx.select.link -This is fired when a link is clicked in the source or translation column. Example subscriber is link tool. Parameters: +This is fired when a link is clicked in the source or translation column. +Example subscriber is link tool. + +Parameters: + * {string|jQuery} link The link element or target title. * {string} [language] The language where the link points to. ## mw.cx.select.reference -This is fired when a reference is clicked in the source or translation column. Example subscriber is reference tool. +This is fired when a reference is clicked in the source or translation column. +Example subscriber is reference tool. + Parameters: * {string} refNumber - The reference number. Example: [4] * {string} reference - The reference content. Can be html. -* {jQuery} [$reference] - The jquery object related to reference. If passed, the reference card give and option to delete it. +* {jQuery} [$reference] - The jquery object related to reference. +If passed, the reference card give and option to delete it. * {string} [language] - Language code of language where this reference exist. ## mw.cx.select.word -This is fired when a text is selected in the source or translation column. Example subscribers are link and dictionary tool. Parameters: +This is fired when a text is selected in the source or translation column. +Example subscribers are link and dictionary tool. + +Parameters: + * {string} The selected text * {string} [language] The language where the link points to. @@ -76,15 +96,19 @@ ## mw.cx.tools.shown -Every tool card fires this when it is ready. Tools manager listen for this so that it can stop showing the loading indicator. +Every tool card fires this when it is ready. +Tools manager listen for this so that it can stop showing the loading indicator. ## mw.cx.translation.published -Fires when the article is published successfully. Example subsciber is event logging (analytics) module. +Fires when the article is published successfully. +Example subsciber is event logging (analytics) module. ## mw.cx.translation.add -Used to trigger the pre-translation for a source section. Source section id is passed as argument. Second argument is a string which explains what action is appropriate. Known values are: clear, click, mt-not-available, mt-user-disabled, non-editable, restore, service-failure. +Used to trigger the pre-translation for a source section. Source section id is passed as argument. +Second argument is a string which explains what action is appropriate. Known values are: +clear, click, mt-not-available, mt-user-disabled, non-editable, restore, service-failure. ## mw.cx.translation.change @@ -96,7 +120,8 @@ ## mw.cx.translation.postMT -Fired after the MT is used for the pre-translation. Link, image, template adaptation can listen for this. +Fired after the MT is used for the pre-translation. +Link, image, template adaptation can listen for this. ## mw.cx.translation.ready @@ -104,12 +129,13 @@ ## mw.cx.translation.updated -Fired when the translation section was updated using the MT card, for example with the 'restore' or 'use source text' actions. +Fired when the translation section was updated using the MT card, +for example with the 'restore' or 'use source text' actions. -## mw.cx.translation.placeholders.ready +## mw.cx.translation.placeholders.ready Fired after every section in the translation column has been filled with a placeholder. -## mw.cx.translation.title.change +## mw.cx.translation.title.change Fired when the title for the translation is changed. Check for existing title listens for this. -- To view, visit https://gerrit.wikimedia.org/r/182456 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1e30dc798cdd217de48076914201c82ba3f3492e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Amire80 <amir.ahar...@mail.huji.ac.il> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits