Special:Nearby displays Wikidata items using the Q id page title for display. Instead it should display the label in the relevant language.
Description
Details
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | aude | T112531 [Story] see items around me (Special:Nearby) | |||
Resolved | thiemowmde | T115014 [Story] Display Wikidata pages on Special:Nearby with label instead of Q id titles | |||
Declined | • Jonas | T115759 create workaround in wikibase to make Special:Nearby display labels instead of Qids |
Event Timeline
I was thinking that display text or "display title" could be a page prop.
It shouldn't use the display title, as we have currently in page props, as wikipedians do very strange stuff with it (html formatting, etc) but something similar. To be generic, it could help fix the issue of when searching for "iPhone", it suggests "IPhone", for example, and Wikibase could hook in with what we need. in 99% of cases, it's the same as the title text.
the page prop would need a language parameter, so we get the appropriate label.
ideally the page prop goes into core. It can be flexible about using whatever backend, database or elastic and for now, with wikibase, use the terms table.
for nearby and mobile search, it would be easy enough and generic enough to request another pageprop, imho.
Using page_props to store labels basically duplicating half of the terms table. Whatever uses it needs to know how we encode languages there, and would have to re-implement language fallback. This does not seem like a good approach to me.
We already have this information in the database, we have access services and an API for it (wbgetentities or pageterms). Let's use that.
Special:Nearby doesn't offer a nice interface to plug this in. If we want this quickly, it will have to be an evil hack in JS. If domain = wikidata run extra query, replace display title.
sorry, meant to say "displaytext" would be an api prop in the query module.
for wikidata, this can come from the terms table.
If we want to make this a generic thing, then for wikitext it could be via pageprops. e.g. something like {{SEARCHDISPLAYTEXT:iPhone}} so that the suggester can show "iPhone" instead of "IPhone".
pageterms does not work for items, though could. but I don't think it's a good idea to use that, since we *only* want to use display text for entities and not override the wikitext title with pageterms.
wbgetentities does not work as a pageprop currently.
I'm also not enthusiastic about using something so wikidata specific in mobile frontend for these things, though maybe wikidata-specific (yet somewhat generic solution like a pageprop) is ok as a short term solution.
we can reuse as much code as possible from wbgetentities and pageterms.
Change 244704 had a related patch set uploaded (by Jonas Kress (WMDE)):
[WIP] Display label instead of Q id titles
Change 244698 had a related patch set uploaded (by Jonas Kress (WMDE)):
Allow the PageTerms API module to work on the repo.
Please just use mobile tag if you do not require a change in MobileFrontend. If you do require one best to create a sub task so we know how to help.
The evil hack is ready. I will prepare the evil switch: mw.config.values.wgSiteName, so we can use it on https://test.m.wikidata.org and https://m.wikidata.org
I think we should reduce the usage of words like "evil" and "hack" to where they really apply. As far as I understand this is not an "evil hack" but a domain specific solution that might be changed to be more flexible in future but is also something we can live with. If something is called "evil" I wonder how we can even deploy it.
Proposal for now: We add a check in JS that causes the label from pageterms to be used only on wikibase repos (and ideally only on entity namespaces). We also add a TODO pointing to a ticket (to be created) about a generic way to get a "nice display title".
Change 246110 had a related patch set uploaded (by Aude):
Introduce displaytext ApiQuery prop [WIP]
Change 246115 had a related patch set uploaded (by Aude):
Show displaytext as title in Special:Nearby [WIP]
Change 246282 had a related patch set uploaded (by Jdlrobson):
Hygiene: Generalise search api requests across MobileFrontend
Change 244704 abandoned by Jonas Kress (WMDE):
Display labels instead of Q id titles in Wikibase item namespaces
Change 246282 merged by jenkins-bot:
Hygiene: Generalise search api requests across MobileFrontend
Change 246115 abandoned by Jdlrobson:
Show displaytext as title in Special:Nearby [WIP]
Reason:
See https://phabricator.wikimedia.org/T115646