Manual:Uselang hack

The "uselang hack" (or "int:lang hack") can be used to create (or at least simulate) multiple "versions" of pages. This was originally used for the Special:Upload form on Wikimedia Commons to create variants of the same forms for different purposes (e.g. upload "Own work", upload "Government work", etc) instead of a single overcrowded form.

Caveats
Note that this is a hack and as such, may break if better functionality to achieve this purpose is introduced into MediaWiki core. It is also awkward to use on multilingual wikis, although certainly still possible.

You will need rights to edit system messages, i.e. pages in the MediaWiki: namespace. (User right 'editinterface', usually "Spsysop" group and above)

Note: for this to fully work, due to 11695, you need to put this setting in LocalSettings.php:

$wgForceUIMsgAsContentMsg = array( 'licenses' );

You likely also need

$wgUseDatabaseMessages = true;

which is the default. (This says to look in the MediaWiki: namespace for system messages content.)

How it works
The uselang hack exploits MediaWiki's internationalisation capabilities, but instead of displaying text in another language, it displays text for another purpose.


 * Normal URL for accessing the upload form
 * https://www.mediawiki.org/wiki/Special:Upload
 * Displayed language from the user's preferences (Special:Preferences)


 * Uselang parameter used to overrride user preferences
 * https://www.mediawiki.org/wiki/Special:Upload?uselang=fr
 * All the user interface, including menus and form labels, are displayed in French (language code "fr")


 * Uselang hack
 * https://www.mediawiki.org/wiki/Special:Upload?uselang=mynewform
 * Since "mynewform" is not a valid language code, there is no corresponding  file in MediaWiki. Then, for each system message, it checks the local version: e.g. for Uploadtext, it looks for MediaWiki:Uploadtext/mynewform. If this doesn't exist, it displays the default MediaWiki:Uploadtext.

Extra tips for multilingual wikis

 * Registered and unregistered users will need to be able to pick and keep their preferred language, e.g. with a method like commons:MediaWiki:AnonymousI18N.js (commons:User:Krinkle/Scripts/AnonymousI18N).
 * Content not injected via system messages will need to follow the uselang in another way, e.g. via JavaScript with a method like Meta:Language select.