MediaWiki talk:Wdsearch-autodesc.js

This is an old revision of this page, as edited by Xaosflux (talk | contribs) at 12:35, 19 August 2016 (Koninkrijk der Nederlanden: re). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Latest comment: 9 years ago by Sjoerddebruin in topic Koninkrijk der Nederlanden

Please add to the list of nationalities:

language_specific : { el : { 'nationality' : {

'Αυστρία':'Αυστριακός', 'Ηνωμένες Πολιτείες Αμερικής':'Αμερικανός', 'Σουηδία':'Σουηδός', 'Πολωνία':'Πολωνός', 'Ουκρανία':'Ουκρανός', 'Ιρλανδία':'Ιρλανδός', 'Σερβία':'Σέρβος', 'Γιουγκοσλαβία':'Γιουγκοσλάβος'

Thanks. -geraki TL 17:32, 14 March 2014 (UTC)Reply

 Done I added the appropriate closing brackets. You might want to check the list did not get truncated as the list of language seemed rather small. --Salix alba (talk): 17:50, 14 March 2014 (UTC)Reply

@Salix alba. There was some confusion here. There was already a list for el. I just wanted to add to the existing list, five rows higher from what it was added (that's why I had'n added closing brackets - I only mentioned where it should be added). Please merge the two lists. -geraki TL 12:58, 16 March 2014 (UTC)Reply

@Geraki L: Ah yes I see now. Lists merged now. --Salix alba (talk): 14:30, 16 March 2014 (UTC)Reply

Add Dutch translation

I've made a Dutch translation, it can be found on Pastebin. I've posted the whole script on Pastebin (because of the complicated translation-system of this script), so it's just copy-and-paste. Sjoerd de Bruin (talk) 21:29, 15 July 2014 (UTC)Reply

Ping Writ Keeper: ^^ the onwiki request as you requested. :) Trijnsteltalk 21:34, 15 July 2014 (UTC)Reply
Done, thanks. Writ Keeper  21:46, 15 July 2014 (UTC)Reply

Protected edit request on 16 August 2014

Please add the following lines to provide origin for organizations and groups of people, based on country of origin (P495) and headquarters ___location (P159):

This change improves descriptions such as this family or this band or this company. Laddo (talk) 15:23, 16 August 2014 (UTC)Reply

  Done--Salix alba (talk): 16:39, 16 August 2014 (UTC)Reply

Add Polish translation (protected edit request)

Please add Polish translation, which I already made. It can be found on Pastebin. You should only copy and paste. Aw, this was not an easy translation task, as in inflecting language we have complicated declension. Also adjectives decline in Polish for gender (British actor is described by the adjective brytyjski, but British actress is described by the adjective brytyjska. Thus, I was forced to create unisex forms like: brytyjski/a). Thanks, WTM (talk) 15:24, 17 August 2014 (UTC)Reply

@WTM: You've changed a lot of the whitespace in the file, which makes it hard to read the diff of your change. Could you post it again, this time preserving the whitespace? Best — Mr. Stradivarius ♪ talk ♪ 20:38, 17 August 2014 (UTC)Reply
@Mr. Stradivarius:: Yes, I can see it now. Please use this text from my sandbox. --WTM (talk) 23:16, 17 August 2014 (UTC)Reply
  Done Thanks! — Mr. Stradivarius ♪ talk ♪ 23:22, 17 August 2014 (UTC)Reply

Protected edit request on 8 January 2015

I've fixed the Dutch translation and trimmed some whitespace, please replace with this. Sjoerd de Bruin (talk) 20:18, 8 January 2015 (UTC)Reply

  Done Thanks for the update! — Mr. Stradivarius ♪ talk ♪ 20:33, 8 January 2015 (UTC)Reply

usage is unclear

I think this is amazing, but it needs better explanation. Is there some page that explains it?

1. It appears to only does something on https://www.wikidata.org, right? So the comment should say "To add this to your common.js page on wikidata.org:"

Also in the code

if (typeof mw !== 'undefined' && typeof prevent_wd_auto_desc === 'undefined' ) { // On Wikidata
	$(document).ready( function() {
		if ( mw.config.get('wgSiteName') != 'Wikidata' ) return ;
		...

The comment // On Wikidata is on the wrong line, it should be after the test for wgSiteName.

2. Why is the script hosted on en.wikipedia.org when it only works on wikidata.org?

3. It looks like this script started out matching Magnus Manske's AutoDesc code, but there's no mention of this in comments except the vague "The code hosted here also runs OUTSIDE of mediawiki scopes". Also the JavaScript on-wiki has drifted from the JS in that project.

4. It's unclear what it does on Wikidata. How do I know it's working? Even if I set wd_auto_desc_wd_always_show = true; in my common.js on Wikidata before this script, I never see its generated wikidata auto-description. I can invoke loadItem() by hand by pasting the following into the browser's developer tools JavaScript console:

wd_auto_desc.loadItem ( "Q2045965" , { callback: function (  q , html , opt  ) {
  console.log( "AutoDesc for " + q + " item=" + html );
} } ) ;

and then it displays teh AutoDesc awesomeness:

"AutoDesc for Q2045965 item=Indian author and autobiographer (*1940); Padma Shri and Sahitya Akademi Award; spouse of Surinder Singh ♀"

I'm not sure where this description is supposed to appear on the Wikidata page d:Q2045965.

I figured 4. out, the AutoDesc short descriptions appear on wikidata's d:Special:Search results page and in the search suggestions dropdown on www.wikidata.org that appears when you enter "Padma S...". This is obvious from the script name MediaWiki:Wdsearch-autodesc.js :-) , but a comment mentioning this would be nice. The AutoDesc doesn't display on individual QNNNN pages as I expected. -- SPage (WMF) (talk) 21:50, 20 August 2015 (UTC)Reply

Thanks for any elucidation, and maybe someone with rights can add comments to the script clarifying these. -- SPage (WMF) (talk) 21:01, 20 August 2015 (UTC)Reply

Improve comments (protected edit request on 20 August 2015)

https://www.wikidata.org/w/index.php?title=User:SPage_%28WMF%29/Wdsearch-autodesc.js&oldid=244389496 adds and improves comments that avoid my confusion in #usage is unclear. -- SPage (WMF) (talk) 22:29, 20 August 2015 (UTC) SPage (WMF) (talk) 22:29, 20 August 2015 (UTC)Reply

  Done. Thanks, Nakon 23:35, 20 August 2015 (UTC)Reply

jslint warnings

If I copy MediaWiki:Wdsearch-autodesc.js and edit it, the jslint in the code editor (extension CodeEditor I think) warns about various coding issues, as does standalone JSHint. Some of them have uncontroversial fixes, I made them in this diff. With these fixes I'm down to no warnings and one error, but the latter is "Too many errors. (34% scanned)." Other warnings involving tests for null and falsy require more consideration.

Koninkrijk der Nederlanden

Please add 'Koninkrijk der Nederlanden':'Nederlands' to the nl-section, will come with more improvements later. Sjoerd de Bruin (talk) 19:16, 13 August 2016 (UTC)Reply

  Not done Sjoerddebruin I'm not sure "exactly" what you want done. Can you please provide a current line as-is, and with your change included below? (Then reactivate the edit request). — xaosflux Talk 22:49, 14 August 2016 (UTC)Reply
I think this would do, as the former ones are no official nationalities. Sjoerd de Bruin (talk) 12:33, 16 August 2016 (UTC)Reply
Sjoerddebruin That diff appears to remove entries, as well as add the new entry - is that what you intend?

Current:

{'Ecuador':'Ecuadoraans','Ghana':'Ghanees','Rusland':'Russisch','Argentinië':'Argentijns','Australië':'Australisch','Oostenrijk':'Oostenrijks','België':'Belgisch','Brazilië':'Braziliaans','Canada':'Canadees','Chili':'Chileens','China':'Chinees','Denemarken':'Deens','Finland':'Fins','Faeröer':'Faeröers','Nederland':'Nederlands','Puerto Rico':'Puerto Ricaans','Frankrijk':'Frans','Luxemburg':'Luxemburgs','Duitsland':'Duits','Griekenland':'Grieks','Holland':'Nederlands','Hongarije':'Hongaars','IJsland':'IJslands','India':'Indiaas','Iran':'Iranees','Irak':'Irakees','Ierland':'Iers','Israël':'Israëlisch','Indonesië':'Indonesisch','Italië':'Italiaans','Japan':'Japans','Jamaica':'Jamaicaans','Jordanië':'Jordaans','Mexico':'Mexicaans','Nepal':'Nepalees','Nieuw-Zeeland':'Nieuw-Zeelands','Noorwegen':'Noors','Pakistan':'Pakistaans','Paraguay':'Paraguayaans','Peru':'Peruaans','Polen':'Pools','Roemenië':'Roemeens','Schotland':'Schots','Zuid-Afrika':'Zuid-Afrikaans','Spanje':'Spaans','Zwitserland':'Zwitsers','Syrië':'Syrisch','Thailand':'Thais','Turkije':'Turks','VS':'Amerikaans','Uruguay':'Uruguayaans','Venezuela':'Venezolaans','Wales':'Welsh','Verenigd Koninkrijk':'Brits','Verenigde Staten van Amerika':'Amerikaans','Zweden':'Zweeds'}
		} ,

Change to:?