Summary: Localization of custom editintro messages
           Product: MediaWiki
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: Normal
         Component: Page editing

Created an attachment (id=7180)
 --> (
Change showCustomIntro() to allow for localization of custom editintro messages

Custom editintro messages can be implemented by passing an additional parameter
in the URL, "editintro=".  Currently the value passed is the name of an article
page on the wiki.

This does not allow for the localization of custom editintro messages without
changing the url parameters for each and every language, an arduous task if
you're building a custom editintro message into an extension.

The editintro functionality, which is contained in EditPage::showCustomIntro()
can be easily modified to allow for an easier implementation of a localized
custom editintro message.  Then, such messages can be passed in an extension's
.i18n. file and will be displayed based on the user's selected language.

A proposed solution would be to make the following change to
EditPage::showCustomIntro() (patch is attached with this change)

     * Attempt to show a custom editing introduction, if supplied
     * Custom editing instructions can either be a message in the MediaWiki
namespace, or an article page on the wiki
     * This function tests first to see if a message exists with the key passed
as the "editintro" url parameter and
     * returns that message; if not, then it checks to see if an article exists
on the wiki and returns the article contents
     * If neither exist, then returns false.
     * @return bool
    protected function showCustomIntro() {
        global $wgOut;
        if ( $this->editintro ) {
            # checks to see if there is an existing message in the message
cache; if so, returns it.
            if( !wfEmptyMsg( wfMsg($this->editintro), $this->editintro ) ) {
                $wgOut->wrapWikiMsg( '<div
class="mw-newarticlecustomtext">$1</div>', $this->editintro );
                return true;
            $title = Title::newFromText( $this->editintro );
            if ( $title instanceof Title && $title->exists() &&
$title->userCanRead() ) {
                $revision = Revision::newFromTitle( $title );
                $wgOut->addWikiTextTitleTidy( $revision->getText(),
$this->mTitle );
                return true;
        } else {
            return false;

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

Wikibugs-l mailing list

Reply via email to