Changing a Special Page Name in a MediaWiki Extension

As part of the redevelopment of RDFIO, I needed to change the name of one of the Special pages for the extension, due to its usage broadening from ARC2 setup to more general admin for the extension.  For the benefit of anyone else looking to do this, I’ve produced a short guide.

Files to change:

  • /extensions/[ExtensionName]/specials/Special[OldPageName].php
  • /extensions/[ExtensionName]/specials/Special[OldPageName]_body.php
  • /extensions/[ExtensionName]/[ExtensionName].alias.php
  • /extensions/[ExtensionName]/[ExtensionName].i18n.php
  • /extensions/[ExtensionName]/[ExtensionName].php

Rename the files Special[OldPageName].php and Special[OldPageName]_body.php, substituting the new page name into the title.  You now need to amend all the places within these files and the rest of the extension which reference the page.

Most of the changes can be done using a text editor’s Find and Replace command.  It’s a good idea to check and approve each replacement individually to make sure you don’t change any longer strings which include the page name but are not related.  In Vim, the command to do this would be:

%s/[OldPageName]/[NewPageName]/gc

The most difficult part of the process is dealing with localisation in the alias and i18n files.  As the English page title and possibly the page contents have changed, this affects the accuracy of the translated page titles and information messages displayed in other languages.  Some parts (e.g. acronyms and product/brand names) are used intact in the translated text, whereas other words require a new translation.  This can be done via TranslateWiki – if there is not already a translation for the term available, a speaker of that language can provide one.  It’s worth evaluating the likely user base of the extension and whether the target languages are adequately covered.