Last modified: 2014-09-24 00:06:31 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T24724, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 22724 - Localization of custom editintro messages
Localization of custom editintro messages
Status: NEW
Product: MediaWiki
Classification: Unclassified
Page editing (Other open bugs)
unspecified
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: i18n, patch, patch-reviewed
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-03-05 08:15 UTC by Lisa Ridley
Modified: 2014-09-24 00:06 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Change showCustomIntro() to allow for localization of custom editintro messages (1.38 KB, patch)
2010-03-05 08:15 UTC, Lisa Ridley
Details
Another approach -- use MediaWiki: and internationalize everything (1.63 KB, text/plain)
2011-12-05 22:43 UTC, Neil Kandalgaonkar
Details

Description Lisa Ridley 2010-03-05 08:15:01 UTC
Created attachment 7180 [details]
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;
		}
	}
Comment 1 p858snake 2011-04-30 00:09:41 UTC
*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*
Comment 2 Sumana Harihareswara 2011-11-09 23:46:36 UTC
Lisa Ridley, I'm sorry that no one responded to your patch for more than a year!  I'm adding the "need-review" keyword now to signal to developers that your patch awaits review.  Thanks for the contribution.
Comment 3 Neil Kandalgaonkar 2011-12-05 22:43:28 UTC
Created attachment 9617 [details]
Another approach -- use MediaWiki: and internationalize everything
Comment 4 Neil Kandalgaonkar 2011-12-05 22:54:26 UTC
Conferred with others, seems like a bit of a hack. Tried another way to do this (see attachment 9617 [details]) which was rejected as an even worse hack. 

It is not obvious that this is high priority. Revising to low priority. 

To the OP: since you are doing this with an extension, can you solve your problem with the EditPage::showEditForm:initial hook?

http://www.mediawiki.org/wiki/Manual:Hooks/EditPage::showEditForm:initial?
Comment 5 Amir E. Aharoni 2012-03-18 19:11:43 UTC
The patch is functionally OK. I don't see how it is a bad hack.

It is, however, very local: Reviewing it made me realize that currently the editintro system is, in general, used in a very strange way. Unless i'm missing something, in the core it can only be used naturally for a custom intro when adding talk page sections. For everything else really weird hacks are needed; for an example see function addEditIntro in https://en.wikipedia.org/wiki/MediaWiki:Common.js.

What would be really useful is to redo the editintro system so it would be useful without weird hacks.

For this particular issue using a hook, as Neil suggests, would probably be better.
Comment 6 Sumana Harihareswara 2012-03-18 19:12:23 UTC
Marking patch reviewed; thanks, Amir.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links