JS2 Overview

Primary Motivation:
We need a script server to package language text into javascript. When a user invokes a interface component say the add media wizard we don't want to pull the entire interface code base and all the messages at once. Instead we just want to grab enough to display the current interface interaction. Once the user click on some tab say the 'archive.org search' we then want to import the code to run the archive.org search and the localized messages specific to that interface component. In other words we don't want to package all the message text in the html output of the initial page.

Show me the Code!
The script loader has been merged into the trunk distribution of mediaWiki.

In the JS
then at the top of mv_embed.js you would put something like: note the json variable that you pass to loadGM has to be valid JSON (not javascript) or php will complain.

Then in your message file you put the normal msg key pairs: "msg_key":"My localized text", Insert non-formatted text here Right now we only support basic $1 replace ... Things get tricky with contextual wiki-text type replacements.

Also bug thread: [https://bugzilla.wikimedia.org/show_bug.cgi?id=19190 bug 19190

How to use the ScriptLoader in your Extension
You can use the scriptLoader in your Extension with some small modifications: