Extension:Gadgets/Gadgets 2.0

Gadgets 2.0 is a broad overhaul of the Gadgets extension to make it more powerful and user-friendly. See ResourceLoader/Version 2 Design Specification for more information.

Features

 * A Gadget Manager interface making it easy to create, edit, or delete gadgets from a wiki
 * New Gadget and Gadget_definition namespaces (along with associated content models and user rights)
 * Simple interface for exporting gadgets
 * Multi-language support for Gadgets via localized messages

Gadget Manager
Gadgets 2.0 will feature a completely revamped Special:Gadgets page. This page will allow users to not only view the configured gadgets, but also create, edit, and delete them. It will replace MediaWiki:Gadgets-definition as the interface for managing the gadgets on a wiki.

Adding multi-language support to a gadget
Gadgets can now easily use translatable MediaWiki messages. This means that your gadget's interface can be rendered entirely in the language of the user using the gadget (regardless of what wiki they are on). There are two ways that a message and it's translations can be defined: either within the MediaWiki software itself or on-wiki in the MediaWiki namespace (or both).

Defining messages
If your gadget has a simple interface, you may be able to find messages already defined in the MediaWiki software. Some examples:

If your gadget has a more complicated interface, you may need to define your own messages for it. For example, let's say that you want to create a link for your gadget that says "My favorite categories", but you want it to be translatable. To create this translatable message, you will need to create a page for it in the MediaWiki namespace. The page will be titled MediaWiki:, where  is a string with no spaces related to the message you are creating. It is strongly recommended that you prefix the message key with "gadget--" so that it doesn't collide with messages defined for other gadgets or MediaWiki software. If your gadget were named "Category links", you could create the message page at MediaWiki:gadget-categorylinks-favorite-categories.

The content of the MediaWiki page should be the string you want displayed written in the default language of the wiki. In our example above, this would be "My favorite categories" (if you were on the English Wikipedia). You could then enable a French translation by creating a page at MediaWiki:gadget-categorylinks-favorite-categories/fr with the French version of the string: "Mes catégories favorites". For each language that you want to support, just create additional sub-pages of your MediaWiki message pages using the language codes for those languages.

Temporary method until Gadgets 2.0 code is merged
To try out the new Gadgets 2.0 interface, you'll need to check out the RL2 branch of the Gadgets repo. If you have already cloned the existing Gerrit repo for Gadgets, you can do this by running the following command from the repo: git checkout -b RL2 origin/RL2

You will then need to update your LocalSettings.php config with the following: $wgGadgetsRepoClass = "GadgetDefinitionNamespaceRepo";

Migrating existing gadgets
To migrate your existing gadgets, run the  script. This will move your existing gadget JS and CSS pages into the Gadget namespace and will create new gadget definitions in the Gadget_definition namespace.