Variations of MediaWiki:Sidebar

Problems

edit
  1. Tool tip and access key for "Main page" are missing in navigation box (works on logo)
  2. Lower-case name for "interaction" box when "text-transform: none" is set in user CSS
  3. "Contents", "Featured content", "About Wikipedia", and "Contact us" are missing tooltips
  4. Use of periods in default tooltips is inconsistent (possibly bugzilla)

How the sidebar works

edit

This is how the sidebar works (at least for the Monobook skin):

  1. Parse MediaWiki:Sidebar
    • Lines starting with "* " indicate portlet headings
    • Lines starting with "** " indicate portlet entries; the link target and link label are separated by "|"
  2. Resolve link targets and link labels
    • Look for target and label as system messages in the "MediaWiki" namespace
    • If there is no message with that name for either the link target or the link label, use the text as is
  3. Render the portlets

For the built-in defaults, things like MediaWiki:Tooltip-n-currentevents have a system supplied value, which is why they often appear as redlinks. This means that the messages have not been customized on-wiki. The naming scheme for access keys and tooltips is extensible, so any new message added can use these system messages to get these values; in the case of new messages like "aboutwikipedia" (see below), this is required to get tooltips or access keys without using JavaScript.

There are some other wrinkles related to alternate user interface languages using the "uselang" parameter, but they're not particularly relevant.

Hopefully this shows why keeping the message keys the same is important; it allows consistent CSS/XHTML ids to be used for scripting and styling despite changes to the user interface messaging.

Caveats

edit
  1. The MediaWiki:Mainpage message is also used to create the link for the logo... It cannot be changed without making the site's home page turn into a redirect. This could be fixed by making MediaWiki use MediaWiki:Mainpage-url for the logo link, or by using something like MediaWiki:Mainpage-label for the label and copying over all of the localizations of the existing MediaWiki:Mainpage system message. The first approach is probably better. Another option would be to actually move the location of Main Page to match the value of MediaWiki:Mainpage.

Benefits of using keys for labels

edit

Changing the sidebar to use fixed key names instead of inline labels has the following benefits:

  1. Ability to have MediaWiki render tooltips and access keys into HTML source instead of having to use JavaScript
  2. Stability of XHTML ids for portlets and list items for use in scripting and custom user styles
  3. Ability to hook into interface internationalization seamlessly (e.g. http://en.wikipedia.org/wiki/Main_Page?uselang=es)

I believe these are the reasons why the core installation uses internal message keys for labels in the default MediaWiki installation. Modifying the sidebar as I've detailed here will regain these benefits.

Default

edit
Source Expanded Display

Current (as of April 16, 2007)

edit
Source Expanded Display
  • Navigation
    • Main Page|Main page
    • Wikipedia:Contents|Contents
    • Wikipedia:Featured content|Featured content
    • Portal:Current events|Current events
    • Special:Random|Random article

Proposed

edit
Source Expanded Display
  • Navigation
    • Main Page|Main page
    • Wikipedia:Contents|Contents
    • Wikipedia:Featured content|Featured content
    • Portal:Current events|Current events
    • Special:Random|Random article

Tooltips and access keys

edit
Identifier Label URL Access Key Tooltip
Key Value Key Value Key Value Key Value
about about About N/A N/A N/A N/A N/A N/A
aboutwikipedia aboutwikipedia MediaWiki:Aboutwikipedia
(About Wikipedia)
aboutwikipedia-url MediaWiki:Aboutwikipedia-url
(Wikipedia:About)
accesskey-n-aboutwikipedia MediaWiki:Accesskey-n-aboutwikipedia tooltip-n-aboutwikipedia MediaWiki:Tooltip-n-aboutwikipedia
contact contact Contact Wikipedia contact-url //en.wikipedia.org/wiki/Wikipedia:Contact_us accesskey-n-contact MediaWiki:Accesskey-n-contact tooltip-n-contact MediaWiki:Tooltip-n-contact
contents contents Contents
(Contents)
contents-url MediaWiki:Contents-url
(Wikipedia:Contents)
accesskey-n-contents MediaWiki:Accesskey-n-contents tooltip-n-contents Guides to browsing Wikipedia
currentevents currentevents Current events currentevents-url Portal:Current events accesskey-n-currentevents tooltip-n-currentevents Articles related to current events
featured featured MediaWiki:Featured
(Featured content)
featured-url MediaWiki:Featured-url
(Wikipedia:Featured content)
accesskey-n-featured MediaWiki:Accesskey-n-featured tooltip-n-featured MediaWiki:Tooltip-n-featured
help help Help helppage Help:Contents accesskey-n-help tooltip-n-help Guidance on how to use and edit Wikipedia
interaction interaction Contribute
(Interaction)
N/A N/A N/A N/A N/A N/A
mainpage mainpage Main Page
(Main page)
mainpage-url MediaWiki:Mainpage-url
(Main Page)
accesskey-n-mainpage z tooltip-n-mainpage Visit the main page
navigation navigation Navigation N/A N/A N/A N/A N/A N/A
portal portal Community portal portal-url Wikipedia:Community portal accesskey-n-portal tooltip-n-portal The hub for editors
randompage randompage Random article randompage-url Special:Random accesskey-n-randompage x tooltip-n-randompage Visit a randomly selected article
recentchanges recentchanges Recent changes recentchanges-url Special:RecentChanges accesskey-n-recentchanges r tooltip-n-recentchanges A list of recent changes to Wikipedia
sitesupport sitesupport Donate sitesupport-url https://donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&utm_medium=sidebar&utm_campaign=C13_en.wikipedia.org&uselang=en accesskey-n-sitesupport MediaWiki:Accesskey-n-sitesupport tooltip-n-sitesupport Support us by donating to the Wikimedia Foundation

Implementation

edit

Add new keys

edit

Change sidebar

edit
* navigation
** mainpage-url|mainpage
** contents-url|contents
** featuredcontent-url|featuredcontent
** currentevents-url|currentevents
** randompage-url|randompage

* interaction
** aboutwikipedia-url|aboutwikipedia
** portal-url|portal
** recentchanges-url|recentchanges
** contact-url|contact
** sitesupport-url|sitesupport
** helppage|help
* navigation
** mainpage|Main page
** contents-url|contents
** featuredcontent-url|featuredcontent
** currentevents-url|currentevents
** randompage-url|randompage

* interaction
** aboutwikipedia-url|aboutwikipedia
** portal-url|portal
** recentchanges-url|recentchanges
** contact-url|contact
** sitesupport-url|sitesupport
** helppage|help

Update existing keys

edit
  • MediaWiki:Mainpage = Main page (Note: This update should not be made yet because it may have undesired side effects; cf. #Caveats)

Tooltips, Access Keys (optional)

edit

Internationalization

edit

All of the keys listed above will need to have translations added to make interface localization work with the "uselang" parameter and/or user language preferences. This is done by editing the language-code specific subpage for each interface message. For instance, to localize the "Interaction" heading for Spanish, MediaWiki:Interaction/es should be set to "Interacción". If we want to lowercase the Turkish version of "Main page", MediaWiki:Mainpage/tr should be set to "Ana sayfa" (nearly all versions of "Main page" except English are already sentence case).

These localizations only need to be done for the interface messages used for labels, not the ones for URLs.

Impacted users

edit

All of these searches were performed on April 17/18, 2007. They should be redone if/when the issues with the sidebar are dealt with.

References to n-Contents

edit
http://en.wikipedia.org/wiki/Special:Search?ns2=1&search=n-Contents&fulltext=Search

These references will need to change from "n-Contents" to "n-contents".

edit
http://en.wikipedia.org/wiki/Special:Search?ns2=1&search=n-Featured-content&fulltext=Search

References to n-Main-page

edit
http://en.wikipedia.org/wiki/Special:Search?ns2=1&search=n-Main-page&fulltext=Search

These references will need to change from "n-Main-page" to "n-mainpage".

References to n-About-Wikipedia

edit
http://en.wikipedia.org/wiki/Special:Search?ns2=1&search=n-About-Wikipedia&fulltext=Search

References to n-About-Wikipedia

edit
http://en.wikipedia.org/wiki/Special:Search?ns2=1&search=n-About-Wikipedia&fulltext=Search



edit
Peter Blaise says: Note: Mike, I wanted to add traditional "indexes" as links in the sidebar. I found that full-length links or "&" characters in my links caused those links to fail to show up in the sidebar display. An example goal is to show a link to "All talk pages", for instance, like this raw URL that works on it's own, but not when inserted into the sidebar:
  • http://www.our-mediwiki-url.com/index.php?title=Special%3AAllpages&from=&namespace=1
... but that line just disappeared in the display of the sidebar, as did any iteration of the same, with or without spaces when adding a "|" pipe character after that link to describe it in the MediaWiki:sidebar, and so on. I contacted the mediawikil mailing list http://lists.wikimedia.org/mailman/listinfo/mediawiki-l. There, Alexis Moinet and Brion Vibber explored the problem and here's what seems to work for now, see MediaWiki-l Digest, Vol 45, Issue 34 at http://lists.wikimedia.org/pipermail/mediawiki-l/2007-June/021023.html. Instead of directly using long and complex links, we first created a new "MediaWiki:nnn" page that contains the long complex link for us. Then, using the shorter, simpler name of that newly created "MediaWiki:nnn" page, we could create a link that does finally work in the sidebar. When clicked, it goes directly to the target page from the sidebar as intended. Here are the steps to success:
How to add long and complex links to MediaWiki:sidebar
  1. Find the intended target page and copy it's full URL address
  2. In the "search" box, type: MediaWiki:new-link-page-name (page-title of your choosing), [Go]
  3. Create/edit new page "Mediawiki:new-link-page-name"
  4. Paste the long complex link of the intended target page into the contents of the new page, such as the one line in our sample:
    • http://www.our-mediwiki-url.com/index.php?title=Special%3AAllpages&from=&namespace=1
  5. Save the new page
  6. In the "search" box, type: MediaWiki:sidebar, [Go]
  7. Edit the Mediawiki:sidebar page, adding a new line at the bottom that reads:
    • ** new-link-page-name|description
  8. Save the Mediawiki:sidebar page
  9. Note, find all the "MediaWiki:nnn" pages by going to "Special:Allpages" and selecting "Mediawiki" from the drop-down menu
Caveats: This seems to require the long URL, such as:
  • http://www.our-mediwiki-url.com/index.php?title=Special%3AAllpages&from=&namespace=1
... but we cannot yet figure out how to make shorter, relative links, such as:
  • index.php?title=Special%3AAllpages&from=&namespace=1 or
  • Special:Allpages&from=&namespace=1
So, this solution is not portable, and must be custom created for a specific long, localized URL - dang! If anyone has a suggestion of a briefer, common way to accomplish putting such expanded "special:nnn" links into the sidebar, PLEASE let us know! I've copied this to MediaWiki.org at http://www.mediawiki.org/wiki/MediaWiki_talk:Sidebar since this is really MediaWiki content, not Wikipedia.org content.
-- Peter Blaise Peterblaise 12:30, 13 June 2007 (UTC)