Uses data in MediaWiki:Gadget-TranslationAdder-Data.js.
For usage instructions, see MediaWiki:Gadget-TranslationAdder.js/help.
{{tt}}
, {{tt+}}
, {{multitrans}}
(discussion).This code adds an input box below the translation table and passes an edit-object to the Editor.js-script when the user press "preview". It stores settings in cookies for every time the user press save on the blue editor-popup.
At the basic level, edits can be made by passing an edit object to the editor. Edit objects consist of a "redo" function which modifies the page HTML to reflect the edit, an "undo" function which does exactly the opposite of "redo", an "edit" function which performs the edit, and a "summary" string to be added to the edit summary.
Disable the gadget "Enable the buttons that allow editing of translation tables on by default" in Special:Preferences#mw-prefsection-gadgets. Make an editable version by copying the code in MediaWiki:Gadget-TranslationAdder.js to User:YourNameHere/scripts/TranslationAdder.js
. (Put your name in place of YourNameHere
and change the page name however you want.) Run this editable version by putting this code in Special:MyPage/common.js:
// This array of dependencies comes from ].
// If the list of dependencies changes, copy the text after dependencies=
// for TranslationAdder and run console.log(JSON.stringify("paste dependencies here".split(/, ?/)))
// in your browser's JavaScript console. Put the resulting array as the first argument to mw.loader.using.
mw.loader.using(,
function() {
importScript('User:YourNameHere/scripts/TranslationAdder.js');
});
Edit and see if you can make any improvements.