Commons:Redesigning the upload form

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Pictogram voting info.svg The page is in part obsolete
The architecture of the current (February 2011) Upload page is described in the Upload.js script documentation.

This page contains instructions for users and admins who wish to "update" the Special:Upload form and menu link, in their language setting.

You can also use these instructions to create purpose-specific upload forms for any MediaWiki wiki. Some wikis report that the MediaWiki:Licenses message (the list of the licenses in the drop-down box) fails to work properly and always just shows the default. This is bugzilla:11695. To make this work on your wiki, you will need to set this in LocalSettings.php:

$wgForceUIMsgAsContentMsg = array( 'licenses' );

That will force it to check for MediaWiki:Licenses/foo and not just use the default.

MediaWiki:Upload-url contains the name of the page that is linked to under the text 'Upload file' in the sidebar menu. By default, it links to Special:Upload. It can be changed to link to a different page, for example Commons:Upload.

Localising Special pages[edit]

Labelled screenshot

Special pages are constructed of multiple system messages. The Special:Upload form consists of these messages:

System messages are defined in MediaWiki. They can be localised by editing the message in the MediaWiki namespace. If links above appear red, that just means they haven't been localised and the default message is being used. See MediaWiki localisation for the instructions how to localising the default text in your language.

Users who have their language preference set to "en" English see the above messages directly on Special:Upload, since English is the default language of Commons.

A user who has their language set to "XX" (some non-English language code) will see these messages:

If these messages haven't been defined (the pages are red links), the user will see the default English message, if it has been defined (localised). If it hasn't, they will see the default XX MediaWiki message.

You can preview how the form will appear for certain language settings by visiting and changing the "XX" in the URL to an appropriate language code.

Using and abusing the uselang parameter[edit]

The uselang parameter doesn't check if its code is a valid language code, it only checks if the translated MediaWiki messages exist. Therefore, we can point people to URLs such as and define messages such as MediaWiki:Uploadtext/ownwork, to further localise the form. That is how the "different" versions of the Special:Upload form that are linked to on Commons:Upload are created.

However, there is a problem. While viewing the Special:Upload form, other MediaWiki messages are being referenced, such as the link text in the menu, the footer, and the account links such as 'My talk', 'My preferences', 'My watchlist' etc.

Take for example MediaWiki:Mytalk. This provides the link text that logged-in users see as a link to their talk page. (It is a red link because Commons is using the default MediaWiki message.)

When a user looks at Special:Upload&uselang=ownwork, MediaWiki will try and use MediaWiki:Mytalk/ownwork for this link text. Since this doesn't exist (we haven't created it), it will "default" to the English, which is fine for users with English settings.

However if we try to create a version of the form Special:Upload&uselang=deownwork for users with German language settings, MediaWiki will look for MediaWiki:Mytalk/deownwork. Since it won't exist, it will "default" to English. Oops! This will be very strange for German users, since the rest of the time they use Commons, the correct German text will appear.

This can be fixed by defining MediaWiki:Mytalk/deownwork to be {{MediaWiki:Mytalk/de}}. And a bot can do this! So it's not such a big problem after all.

Updating the form for your language[edit]

First prepare a version of Commons:Upload either at Commons:Upload/XX or the translated word for "Upload" (verb). You don't need to have all of the "versions" or options that the English version has. Choose what is appropriate for speakers of your language, considering their likely background in Wikimedia. Talk to other users at your language Village Pump.

For the uselang parameters, make sure they are all lowercase with no spaces or underscores ("_"). Mention the language code and the function of the version, .e.g. "es" "ownwork" -> "esownwork".

Use the template {{SpecialUpload elements}} to preview the messages you need to change: {{SpecialUpload elements|fake language code}} For fake language code put esownwork or whatever you have decided to use.

Leave a request for MediaWiki Update Bot at user talk:pfctdayelise when you have completed all the form elements.



You need to set $wgUseDatabaseMessages to use modified messages in the MediaWiki namespace. Or you need to run the rebuildMessages.php maintenance script.


This variable determines whether the MediaWiki namespace is used to modify language files. If true, then the wiki's interface is editable by those with editinterface privileges; if false, then the wiki's interface is determined directly from the internationalized message file specified in $wgLanguageCode.

This will increase load times by 25-60% unless memcached is installed. Interface messages will be got from the database.

If set to false, message information will be retrieved from the corresponding language??.php each time it looks for a message; otherwise, the cached copy will be returned.

It is not recommended that this is used without memcached.

Info on memcached is at

Also see to reset the upload link in the toolbox.