The "uselang hack" can be used to create (or at least simulate) multiple "versions" of pages. This is useful for the Special:Upload form, for example: create forms that have different purposes, to avoid crowding too much information into a single form.
Caveats[edit | edit source]
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.
$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[edit | edit source]
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
- Displayed language from the user's preferences (special:preferences)
- Uselang parameter used to overrride user preferences
- All the user interface, including menus and form labels, are displayed in French (language code "fr")
- Uselang hack
- Since "mynewform" is not a valid language code, there is no corresponding Messages.php 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.