https://bugzilla.wikimedia.org/show_bug.cgi?id=22724

           Summary: Localization of custom editintro messages
           Product: MediaWiki
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: Normal
         Component: Page editing
        AssignedTo: wikibugs-l@lists.wikimedia.org
        ReportedBy: lhrid...@gmail.com


Created an attachment (id=7180)
 --> (https://bugzilla.wikimedia.org/attachment.cgi?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: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- 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
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to