Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 332128 - [MediaWiki] imageTitlePattern only handle Image|File english keyword
Summary: [MediaWiki] imageTitlePattern only handle Image|File english keyword
Status: CLOSED MOVED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: 1.3   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: David Green CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-08 08:53 EST by Nicolas Guyomar CLA
Modified: 2013-09-15 12:38 EDT (History)
2 users (show)

See Also:


Attachments
mylyn/context/zip (4.05 KB, application/octet-stream)
2010-12-08 14:02 EST, David Green CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Guyomar CLA 2010-12-08 08:53:08 EST
Hi,

Could it be possible to provide the MediaWikiApiImageFetchingStrategy class with other image pattern than "Image" or "File" to support other mediawiki languages ? 
May this be an option in the mediawiki-to-eclipse-help ant task?

For instance I'm using a french version, and got the following exception : "Unexpected title format: Fichier:MyImage.png"
In french, "Fichier" stands for File.

Regards

Nicolas Guyomar
Comment 1 David Green CLA 2010-12-08 14:02:11 EST
Nicolas, feel free to make a contribution here. I've attached a Mylyn context with landmarks pointing to the relevant code.  You'll need to modify both @MediaWikiApiImageFetchingStrategy@ and @ImageReplacementToken@.
Comment 2 David Green CLA 2010-12-08 14:02:20 EST
Created attachment 184809 [details]
mylyn/context/zip
Comment 3 Carsten Hammer CLA 2012-07-21 04:19:37 EDT
Discussion on changes at https://bugs.eclipse.org/bugs/show_bug.cgi?id=383287 might be interesting for you.
Best regarsds,
Carsten
Comment 4 Jeremie Bresson CLA 2012-08-24 09:26:27 EDT
An other approach to get all the images used in a page, could be to use the MediaWiki API:

Example :
http://wiki.eclipse.org/api.php?format=xml&action=query&prop=images&titles=DocumentationGuidelines/CrowdSourcingExample

Give this back:
<api>
	<query>
		<pages>
			<page pageid="23598" ns="0" title="DocumentationGuidelines/CrowdSourcingExample">
				<images>
					<im ns="6" title="Image:Crowdsourcing-help-content.png"/>
					<im ns="6" title="Image:Crowdsourcing-toc.png"/>
					<im ns="6" title="Image:What-is-wikitext.png"/>
				</images>
			</page>
		</pages>
	</query>
</api>

The images are in <im> tags (children of <images>). This works also with a MediaWiki instance configured in french.


This do not solve the parsing part (ImageReplacementToken is still english only).

It will be hard to have the WikiText Library to follow all the MediaWiki namespaces possibilities (it is possible to localized and to alias them)
See: https://www.mediawiki.org/wiki/Help:Namespaces#Localisation


A possible approach would be to access the configuration of the MediaWiki instance:
The "Image" or "File" or whatever Namespace has id=6 + its aliases.

http://wiki.eclipse.org/api.php?format=xml&action=query&meta=siteinfo&siprop=namespaces|namespacealiases

This is the output on a MediaWiki 1.17.0 (English):
<api>
	<query>
		<namespaces>
			<ns id="-2" case="first-letter" canonical="Media" xml:space="preserve">Media</ns>
			<ns id="-1" case="first-letter" canonical="Special" xml:space="preserve">Special</ns>
			<ns id="0" case="first-letter" content="" xml:space="preserve"/>
			<ns id="1" case="first-letter" subpages="" canonical="Talk" xml:space="preserve">Talk</ns>
			<ns id="2" case="first-letter" subpages="" canonical="User" xml:space="preserve">User</ns>
			<ns id="3" case="first-letter" subpages="" canonical="User talk" xml:space="preserve">User talk</ns>
			<ns id="4" case="first-letter" canonical="Project" xml:space="preserve">TestMediaWiki</ns>
			<ns id="5" case="first-letter" subpages="" canonical="Project talk" xml:space="preserve">TestMediaWiki talk</ns>
			<ns id="6" case="first-letter" canonical="File" xml:space="preserve">File</ns>
			<ns id="7" case="first-letter" subpages="" canonical="File talk" xml:space="preserve">File talk</ns>
			<ns id="8" case="first-letter" subpages="" canonical="MediaWiki" xml:space="preserve">MediaWiki</ns>
			<ns id="9" case="first-letter" subpages="" canonical="MediaWiki talk" xml:space="preserve">MediaWiki talk</ns>
			<ns id="10" case="first-letter" canonical="Template" xml:space="preserve">Template</ns>
			<ns id="11" case="first-letter" subpages="" canonical="Template talk" xml:space="preserve">Template talk</ns>
			<ns id="12" case="first-letter" canonical="Help" xml:space="preserve">Help</ns>
			<ns id="13" case="first-letter" subpages="" canonical="Help talk" xml:space="preserve">Help talk</ns>
			<ns id="14" case="first-letter" canonical="Category" xml:space="preserve">Category</ns>
			<ns id="15" case="first-letter" subpages="" canonical="Category talk" xml:space="preserve">Category talk</ns>
		</namespaces>
		<namespacealiases>
			<ns id="6" xml:space="preserve">Image</ns>
			<ns id="7" xml:space="preserve">Image talk</ns>
		</namespacealiases>
	</query>
</api>
Comment 5 David Green CLA 2012-08-28 12:05:01 EDT
Thanks for the MediaWiki configuration API pointer, that looks very useful.  A good place to start would be to take a look at subclassing @org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguageConfiguration@ which is intended to be used for this type of configuration.
Comment 6 Jeremie Bresson CLA 2012-10-25 17:14:34 EDT
As suggested by David Green in comment #5, I have pushed a patch that add a @MediaWikiLanguageConfiguration@:

https://git.eclipse.org/r/8378

Feel free to give feedback.

To my mind this patch can be contributed without having the mediawiki-to-eclipse help using it.

We can discuss (here a in a new bug) how the mediawiki-to-eclipse should set the local mediawiki configuration. I think the best way is to parse the API file (with simple XPath queries).
Comment 7 David Green CLA 2013-08-02 12:41:51 EDT
Closed as part of backlog clean-up.  Please re-open if you'd like to see this revisited, perhaps with a contribution.
Comment 8 Jeremie Bresson CLA 2013-09-15 03:34:28 EDT
The problem still exists. Please reopen
Comment 9 David Green CLA 2013-09-15 12:38:24 EDT
reopening per comment #8
Comment 10 Eclipse Webmaster CLA 2022-11-15 11:45:08 EST
Mylyn has been restructured, and our issue tracking has moved to GitHub [1].

We are closing ~14K Bugzilla issues to give the new team a fresh start. If you feel that this issue is still relevant, please create a new one on GitHub.

[1] https://github.com/orgs/eclipse-mylyn