Gadget kitchen/Requests

From mediawiki.org

This seems to be a place where anyone can share their ideas what they would like to see implemented. It does not mean that anyone will implement it.

Colour-coded character sets in edit box[edit]

In Russian Wikisource I was looking at a book, where lists of literature references contain a mix of Russian and German titles. This book was OCRed for Russian, so when the print says "Barentz" in Latin letters, the OCR text says "Вагепгг", which are Cyrillic (Russian) letters that look similar, but actually transcribe to the nonsense "Vagepgg".

When proofreading such a text in a wiki edit box (using the ProofreadPage extension, as Wikisource does), it would be a great help if all Cyrillic letters (a range of Unicode characters) in the edit box could be coloured different from the Latin ones. Is this possible to achieve with a personal or site-wide Javascript, stylesheet or gadget?

What I would like is a gadget that allows the user to decide if Unicode range XX to YY in the edit box should be coloured in ZZ,

Here is a diff link to the page in question, http://ru.wikisource.org/w/index.php?title=%D0%A1%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0%3AGeo_stat_rus_imp_4.djvu%2F863&diff=702229&oldid=701373 The large print is the text of an encyclopedic article. The small print is the list of literature references. --LA2 04:15, 8 March 2012 (UTC)[reply]

Discussion[edit]

Gadget / script to see namespace names in English in non-English wikis[edit]

I am comfortable with the English namespace names, but when I am in other Wikipedias, specially those that don't use the Latin script, it becomes a little difficult to deal with the local namespace names in the URLs and page titles that are served. This problem is compounded if the characters show up as boxes. I am aware that English namespace names work as aliases in other language projects, and we can change the interface language on any wiki, so can we have a script or gadget to have the namespace names in URLs and page titles in English on non-English wikis? Is there already some way to do this, and is it technically possible? A possible generalisation of this concept could be to show the namespace names in the interface language selected by the user. The Discoverer (talk) 11:58, 4 May 2016 (UTC)[reply]

Here:
$( function () {
	var cns = mw.config.get( 'wgCanonicalNamespace' ),
		title = mw.config.get( 'wgTitle' );
	if ( cns ) {
		$( '#firstHeading' ).text( cns + ':' + title );
	}
});
This uses "Project" for the project namespace, though, instead of an English translation of the project name. Is that okay? --Yair rand (talk) 20:58, 4 May 2016 (UTC)[reply]
Hello Yair rand, thanks for your quick reply. The code works well and converts the titles into English. It is helpful for me because it lets me know exactly which namespace I'm in on any Wikipedia, and I can easily create valid links using the page title, which is now in English, without having to use another script.
  • I noticed that it does not change the URL that is served nor the html <title> tag, and I guess that this would not be possible for a user script or gadget, and it would require a modification of the MediaWiki software. Am I correct?
  • The Konkani Wikipedia (gomwiki) has the content and interface in both, the Latin and Devanagari scripts. At present, the namespaces are only in the Devanagari script (gom-deva), with no aliases (except, of course the English namespaces, which work globally). I'm thinking that if we add the Latin Konkani (gom-latn) namespaces as aliases, we can have a gadget that allows users to choose to see page titles in either gom-deva, gom-latn or en, and all these titles would be valid wikilinks. A simple gadget that can go a long way in improving the users' localisation experience. What are your thoughts on this?
Thanks and regards, The Discoverer (talk) 08:09, 5 May 2016 (UTC)[reply]
Okay, new version:
$( function () {
	var cns = mw.config.get( 'wgCanonicalNamespace' ),
		title = mw.config.get( 'wgTitle' ),
		pagename = mw.config.get( 'wgPageName' ).replace( /\_/g, ' ' );
	if ( cns ) {
		$( '#firstHeading, title' ).text( function ( i, t ) { 
			return t.replace( pagename, cns + ':' + title );
		} );
	}
});
This fixes the <title>, but doesn't do anything about the URL. Fixing the URL as well is possible, but somewhat more difficult.
Re Konkani, that would require having a list of the namespaces in both variants, which is not immediately accessible, but could, I suppose, but compiled manually. However, I'm hesitant to have a gadget in widespread use doing this kind of thing. It should be possible for namespaces to be displayed based on user settings from the Mediawiki side of things. I think there's a task open somewhere on Phabricator for this. --Yair rand (talk) 08:54, 5 May 2016 (UTC)[reply]
Thanks Yair rand! I was surprised to see the simple solution for changing the title tag. I agree with your point that it's best if this kind of things are done by Mediawiki itself. Thank you for your help and information. Regards, The Discoverer (talk) 08:47, 6 May 2016 (UTC)[reply]

Tab to switch scripts in the Konkani Wikipedia[edit]

The Konkani Wikipedia contains articles in three scripts: Latin, Devanagari and Kannada. We have a widely-used template called Lipi that creates tabs that contain links to articles on the same topic but written in different scripts (see, for example the tabs below the page title on Konknni bhas). Could you help write a gadget that would replace the template Lipi, if it exists on a page, by a tab using the p-cactions portlet? I'm thinking of something like the tab that converts between Cyrillic and Latin text in the Serbian Wikipedia. The Discoverer (talk) 09:53, 22 January 2021 (UTC)[reply]